From 6af1af7d153e8c9c2c2abffb0ec2465a1144bad8 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Sun, 3 Dec 2023 23:33:16 +0100 Subject: [PATCH] Added debug messages. --- source/client/ui/authorization_dialog.cc | 11 +++++++++++ source/client/ui/desktop/desktop_toolbar.cc | 8 ++++++++ source/client/ui/desktop/qt_desktop_window.cc | 12 ++++++++++++ .../client/ui/file_transfer/file_remove_dialog.cc | 3 +-- .../ui/file_transfer/file_transfer_dialog.cc | 15 +++++---------- source/client/ui/update_settings_dialog.cc | 7 +++++++ 6 files changed, 44 insertions(+), 12 deletions(-) diff --git a/source/client/ui/authorization_dialog.cc b/source/client/ui/authorization_dialog.cc index 1d67b18724..5f5fffcd50 100644 --- a/source/client/ui/authorization_dialog.cc +++ b/source/client/ui/authorization_dialog.cc @@ -112,6 +112,8 @@ void AuthorizationDialog::setPassword(const QString& password) //-------------------------------------------------------------------------------------------------- void AuthorizationDialog::showEvent(QShowEvent* event) { + LOG(LS_INFO) << "Show event detected"; + if (ui.edit_username->text().isEmpty() && !ui.checkbox_one_time_password->isChecked()) ui.edit_username->setFocus(); else @@ -123,6 +125,8 @@ void AuthorizationDialog::showEvent(QShowEvent* event) //-------------------------------------------------------------------------------------------------- void AuthorizationDialog::onShowPasswordButtonToggled(bool checked) { + LOG(LS_INFO) << "[ACTION] Show passowrd button toggled: " << checked; + if (checked) { ui.edit_password->setEchoMode(QLineEdit::Normal); @@ -141,6 +145,8 @@ void AuthorizationDialog::onShowPasswordButtonToggled(bool checked) //-------------------------------------------------------------------------------------------------- void AuthorizationDialog::onOneTimePasswordToggled(bool checked) { + LOG(LS_INFO) << "[ACTION] One time password toggled: " << checked; + ui.label_username->setVisible(!checked); ui.edit_username->setVisible(!checked); ui.edit_username->clear(); @@ -153,10 +159,13 @@ void AuthorizationDialog::onButtonBoxClicked(QAbstractButton* button) { if (ui.buttonbox->standardButton(button) == QDialogButtonBox::Ok) { + LOG(LS_INFO) << "[ACTION] Accepted by user"; + if (!ui.checkbox_one_time_password->isChecked()) { if (ui.edit_username->text().isEmpty()) { + LOG(LS_ERROR) << "Empty user name"; QMessageBox::warning(this, tr("Warning"), tr("Username cannot be empty."), @@ -167,6 +176,7 @@ void AuthorizationDialog::onButtonBoxClicked(QAbstractButton* button) if (ui.edit_password->text().isEmpty()) { + LOG(LS_ERROR) << "Empty password"; QMessageBox::warning(this, tr("Warning"), tr("Password cannot be empty."), @@ -178,6 +188,7 @@ void AuthorizationDialog::onButtonBoxClicked(QAbstractButton* button) } else { + LOG(LS_INFO) << "[ACTION] Rejected by user"; reject(); } diff --git a/source/client/ui/desktop/desktop_toolbar.cc b/source/client/ui/desktop/desktop_toolbar.cc index 2bde14bab2..bfc00ab8ce 100644 --- a/source/client/ui/desktop/desktop_toolbar.cc +++ b/source/client/ui/desktop/desktop_toolbar.cc @@ -765,6 +765,8 @@ void DesktopToolBar::onShowRecordSettings() //-------------------------------------------------------------------------------------------------- void DesktopToolBar::createAdditionalMenu(proto::SessionType session_type) { + LOG(LS_INFO) << "Create additional menu"; + // Create a menu and add actions to it. additional_menu_ = new QMenu(this); @@ -839,6 +841,8 @@ void DesktopToolBar::createAdditionalMenu(proto::SessionType session_type) else return; + LOG(LS_INFO) << "[ACTION] Scale chenged: " << scale_; + emit sig_scaleChanged(); }); @@ -867,6 +871,8 @@ void DesktopToolBar::createAdditionalMenu(proto::SessionType session_type) scale_ = 100; } + LOG(LS_INFO) << "[ACTION] Fit window changed (checked=" << checked << " scale=" << scale_ << ")"; + emit sig_scaleChanged(); }); @@ -898,6 +904,8 @@ void DesktopToolBar::createAdditionalMenu(proto::SessionType session_type) //-------------------------------------------------------------------------------------------------- void DesktopToolBar::showFullScreenButtons(bool show) { + LOG(LS_INFO) << "Show full screen buttons: " << show; + // MacOS does not have the ability to minimize a window from full screen mode. Therefore, for // MacOS we disable the minimize button from full screen mode. // For more info see: https://bugreports.qt.io/browse/QTBUG-62991 diff --git a/source/client/ui/desktop/qt_desktop_window.cc b/source/client/ui/desktop/qt_desktop_window.cc index f2828b0fba..c2156f15d5 100644 --- a/source/client/ui/desktop/qt_desktop_window.cc +++ b/source/client/ui/desktop/qt_desktop_window.cc @@ -489,6 +489,8 @@ void QtDesktopWindow::setMetrics(const DesktopWindow::Metrics& metrics) { if (!statistics_dialog_) { + LOG(LS_INFO) << "Statistics dialog not created yet"; + statistics_dialog_ = new StatisticsDialog(this); statistics_dialog_->setAttribute(Qt::WA_DeleteOnClose); @@ -611,6 +613,8 @@ void QtDesktopWindow::onSystemInfoRequest(const proto::system_info::SystemInfoRe //-------------------------------------------------------------------------------------------------- void QtDesktopWindow::onInternalReset() { + LOG(LS_INFO) << "Internal reset"; + if (system_info_) { LOG(LS_INFO) << "Close System Info window"; @@ -765,6 +769,7 @@ void QtDesktopWindow::showEvent(QShowEvent* event) //-------------------------------------------------------------------------------------------------- void QtDesktopWindow::focusOutEvent(QFocusEvent* event) { + LOG(LS_INFO) << "Focus out event"; desktop_->userLeftFromWindow(); QWidget::focusOutEvent(event); } @@ -1124,12 +1129,19 @@ void QtDesktopWindow::scaleDesktop() int scale = toolbar_->scale(); if (scale != -1) + { target_size = scaledSize(source_size, scale); + LOG(LS_INFO) << "Scaling enabled (source_size=" << source_size << " target_size=" + << target_size << " scale=" << scale << ")"; + } desktop_->resize(source_size.scaled(target_size, Qt::KeepAspectRatio)); if (resize_timer_->isActive()) + { + LOG(LS_INFO) << "Resize timer stopped"; resize_timer_->stop(); + } LOG(LS_INFO) << "Starting resize timer (scale=" << scale << " size=" << size() << " target_size=" << target_size << ")"; diff --git a/source/client/ui/file_transfer/file_remove_dialog.cc b/source/client/ui/file_transfer/file_remove_dialog.cc index da8dd12d5e..7156917998 100644 --- a/source/client/ui/file_transfer/file_remove_dialog.cc +++ b/source/client/ui/file_transfer/file_remove_dialog.cc @@ -144,8 +144,7 @@ void FileRemoveDialog::errorOccurred(const std::string& path, else { message = tr("Failed to delete \"%1\": %2.") - .arg(QString::fromStdString(path)) - .arg(fileErrorToString(error_code)); + .arg(QString::fromStdString(path), fileErrorToString(error_code)); } QPointer dialog(new QMessageBox(this)); diff --git a/source/client/ui/file_transfer/file_transfer_dialog.cc b/source/client/ui/file_transfer/file_transfer_dialog.cc index 212848dbc2..eb8480f595 100644 --- a/source/client/ui/file_transfer/file_transfer_dialog.cc +++ b/source/client/ui/file_transfer/file_transfer_dialog.cc @@ -297,37 +297,32 @@ QString FileTransferDialog::errorToMessage(const FileTransfer::Error& error) case FileTransfer::Error::Type::CREATE_DIRECTORY: { return tr("Failed to create directory \"%1\": %2") - .arg(QString::fromStdString(error.path())) - .arg(fileErrorToString(error.code())); + .arg(QString::fromStdString(error.path()), fileErrorToString(error.code())); } case FileTransfer::Error::Type::CREATE_FILE: case FileTransfer::Error::Type::ALREADY_EXISTS: { return tr("Failed to create file \"%1\": %2") - .arg(QString::fromStdString(error.path())) - .arg(fileErrorToString(error.code())); + .arg(QString::fromStdString(error.path()), fileErrorToString(error.code())); } case FileTransfer::Error::Type::OPEN_FILE: { return tr("Failed to open file \"%1\": %2") - .arg(QString::fromStdString(error.path())) - .arg(fileErrorToString(error.code())); + .arg(QString::fromStdString(error.path()), fileErrorToString(error.code())); } case FileTransfer::Error::Type::WRITE_FILE: { return tr("Failed to write file \"%1\": %2") - .arg(QString::fromStdString(error.path())) - .arg(fileErrorToString(error.code())); + .arg(QString::fromStdString(error.path()), fileErrorToString(error.code())); } case FileTransfer::Error::Type::READ_FILE: { return tr("Failed to read file \"%1\": %2") - .arg(QString::fromStdString(error.path())) - .arg(fileErrorToString(error.code())); + .arg(QString::fromStdString(error.path()), fileErrorToString(error.code())); } default: diff --git a/source/client/ui/update_settings_dialog.cc b/source/client/ui/update_settings_dialog.cc index c60085a63f..bb09e115f8 100644 --- a/source/client/ui/update_settings_dialog.cc +++ b/source/client/ui/update_settings_dialog.cc @@ -55,6 +55,7 @@ UpdateSettingsDialog::UpdateSettingsDialog(QWidget* parent) connect(ui.checkbox_custom_server, &QCheckBox::toggled, this, [this](bool checked) { + LOG(LS_INFO) << "[ACTION] Custom server checkbox: " << checked; ui.edit_server->setEnabled(checked); if (!checked) @@ -65,10 +66,16 @@ UpdateSettingsDialog::UpdateSettingsDialog(QWidget* parent) { if (ui.button_box->standardButton(button) == QDialogButtonBox::Ok) { + LOG(LS_INFO) << "[ACTION] Accepted by user"; + ClientSettings settings; settings.setCheckUpdates(ui.checkbox_check_updates->isChecked()); settings.setUpdateServer(ui.edit_server->text()); } + else + { + LOG(LS_INFO) << "[ACTION] Rejected by user"; + } close(); });