Add some logs.

This commit is contained in:
John Preston 2018-06-24 03:15:12 +01:00
parent 2522e66969
commit fcd2e28abb
4 changed files with 22 additions and 0 deletions

View File

@ -83,6 +83,7 @@ void Session::startExport() {
_exportPanel->stopRequests(
) | rpl::start_with_next([=] {
LOG(("Export Info: Stop requested."));
stopExport();
}, _export->lifetime());
}
@ -129,6 +130,7 @@ void Session::stopExportWithConfirmation(FnMut<void()> callback) {
}
auto closeAndCall = [=, callback = std::move(callback)]() mutable {
auto saved = std::move(callback);
LOG(("Export Info: Stop With Confirmation."));
stopExport();
if (saved) {
saved();
@ -139,6 +141,7 @@ void Session::stopExportWithConfirmation(FnMut<void()> callback) {
void Session::stopExport() {
if (_exportPanel) {
LOG(("Export Info: Destroying."));
_exportPanel = nullptr;
_exportViewChanges.fire(nullptr);
}

View File

@ -137,6 +137,7 @@ void PanelController::createPanel() {
_panel->setInnerSize(st::exportPanelSize);
_panel->closeRequests(
) | rpl::start_with_next([=] {
LOG(("Export Info: Panel Hide By Close."));
_panel->hideGetDuration();
}, _panel->lifetime());
_panelCloseEvents.fire(_panel->closeEvents());
@ -157,6 +158,7 @@ void PanelController::showSettings() {
settings->cancelClicks(
) | rpl::start_with_next([=] {
LOG(("Export Info: Panel Hide By Cancel."));
_panel->hideGetDuration();
}, settings->lifetime());
@ -170,6 +172,8 @@ void PanelController::showSettings() {
}
void PanelController::showError(const ApiErrorState &error) {
LOG(("Export Info: API Error '%1'.").arg(error.data.type()));
if (error.data.type() == qstr("TAKEOUT_INVALID")) {
showError(lang(lng_export_invalid));
} else if (error.data.type().startsWith(qstr("TAKEOUT_INIT_DELAY_"))) {
@ -236,6 +240,7 @@ void PanelController::showError(const QString &text) {
weak->setCloseByOutsideClick(false);
weak->boxClosing(
) | rpl::start_with_next([=] {
LOG(("Export Info: Panel Hide By Error: %1.").arg(text));
_panel->hideGetDuration();
}, weak->lifetime());
if (hidden) {
@ -265,6 +270,8 @@ void PanelController::showProgress() {
) | rpl::start_with_next([=] {
if (const auto finished = base::get_if<FinishedState>(&_state)) {
File::ShowInFolder(finished->path);
LOG(("Export Info: Panel Hide By Done: %1."
).arg(finished->path));
_panel->hideGetDuration();
}
}, progress->lifetime());
@ -275,12 +282,14 @@ void PanelController::showProgress() {
void PanelController::stopWithConfirmation(FnMut<void()> callback) {
if (!_state.is<ProcessingState>()) {
LOG(("Export Info: Stop Panel Without Confirmation."));
stopExport();
callback();
return;
}
auto stop = [=, callback = std::move(callback)]() mutable {
if (auto saved = std::move(callback)) {
LOG(("Export Info: Stop Panel With Confirmation."));
stopExport();
saved();
} else {
@ -310,6 +319,7 @@ void PanelController::stopWithConfirmation(FnMut<void()> callback) {
void PanelController::stopExport() {
_stopRequested = true;
_panel->showAndActivate();
LOG(("Export Info: Panel Hide By Stop"));
_panel->hideGetDuration();
}
@ -334,6 +344,7 @@ void PanelController::updateState(State &&state) {
_panel->setTitle(Lang::Viewer(lng_export_title));
_panel->setHideOnDeactivate(false);
} else if (_state.is<CancelledState>()) {
LOG(("Export Info: Stop Panel After Cancel."));
stopExport();
}
}

View File

@ -1696,14 +1696,17 @@ void MainWidget::setCurrentExportView(Export::View::PanelController *view) {
) | rpl::start_with_next([=](Export::View::Content &&data) {
if (!data.rows.empty()
&& data.rows[0].id == Export::View::Content::kDoneId) {
LOG(("Export Info: Destroy top bar by Done."));
destroyExportTopBar();
} else if (!_exportTopBar) {
LOG(("Export Info: Create top bar by State."));
createExportTopBar(std::move(data));
} else {
_exportTopBar->entity()->updateData(std::move(data));
}
}, _currentExportView->lifetime());
} else {
LOG(("Export Info: Destroy top bar by controller removal."));
destroyExportTopBar();
}
}

View File

@ -111,6 +111,7 @@ void SeparatePanel::setHideOnDeactivate(bool hideOnDeactivate) {
if (!_hideOnDeactivate) {
showAndActivate();
} else if (!isActiveWindow()) {
LOG(("Export Info: Panel Hide On Inactive Change."));
hideGetDuration();
}
}
@ -132,6 +133,7 @@ void SeparatePanel::keyPressEvent(QKeyEvent *e) {
bool SeparatePanel::eventHook(QEvent *e) {
if (e->type() == QEvent::WindowDeactivate && _hideOnDeactivate) {
LOG(("Export Info: Panel Hide On Inactive Window."));
hideGetDuration();
}
return RpWidget::eventHook(e);
@ -230,12 +232,14 @@ void SeparatePanel::finishClose() {
hide();
crl::on_main(this, [=] {
if (isHidden() && !_visible && !_opacityAnimation.animating()) {
LOG(("Export Info: Panel Closed."));
_closeEvents.fire({});
}
});
}
int SeparatePanel::hideGetDuration() {
LOG(("Export Info: Panel Hide Requested."));
toggleOpacityAnimation(false);
if (_animationCache.isNull()) {
finishClose();
@ -529,6 +533,7 @@ void SeparatePanel::mousePressEvent(QMouseEvent *e) {
_dragStartMousePosition = e->globalPos();
_dragStartMyPosition = QPoint(x(), y());
} else if (!rect().contains(e->pos()) && _hideOnDeactivate) {
LOG(("Export Info: Panel Hide On Click."));
hideGetDuration();
}
}