From fcd2e28abb5916aa64d887b5ff1fe2bbbf9f9dc3 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 24 Jun 2018 03:15:12 +0100 Subject: [PATCH] Add some logs. --- Telegram/SourceFiles/data/data_session.cpp | 3 +++ .../export/view/export_view_panel_controller.cpp | 11 +++++++++++ Telegram/SourceFiles/mainwidget.cpp | 3 +++ Telegram/SourceFiles/ui/widgets/separate_panel.cpp | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index ad57e3962707a..9bfd063f27400 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -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 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 callback) { void Session::stopExport() { if (_exportPanel) { + LOG(("Export Info: Destroying.")); _exportPanel = nullptr; _exportViewChanges.fire(nullptr); } diff --git a/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp b/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp index bb33768d0ac7e..ddf353dc8b76e 100644 --- a/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp +++ b/Telegram/SourceFiles/export/view/export_view_panel_controller.cpp @@ -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(&_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 callback) { if (!_state.is()) { + 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 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()) { + LOG(("Export Info: Stop Panel After Cancel.")); stopExport(); } } diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index fffdaab7e0282..71c580db66885 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -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(); } } diff --git a/Telegram/SourceFiles/ui/widgets/separate_panel.cpp b/Telegram/SourceFiles/ui/widgets/separate_panel.cpp index 07ddaffdedabd..cbcbeb0b3bf1c 100644 --- a/Telegram/SourceFiles/ui/widgets/separate_panel.cpp +++ b/Telegram/SourceFiles/ui/widgets/separate_panel.cpp @@ -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(); } }