Skip to content

Commit

Permalink
Added debug messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
dchapyshev committed Dec 3, 2023
1 parent e7b2f24 commit 6af1af7
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 12 deletions.
11 changes: 11 additions & 0 deletions source/client/ui/authorization_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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();
Expand All @@ -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."),
Expand All @@ -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."),
Expand All @@ -178,6 +188,7 @@ void AuthorizationDialog::onButtonBoxClicked(QAbstractButton* button)
}
else
{
LOG(LS_INFO) << "[ACTION] Rejected by user";
reject();
}

Expand Down
8 changes: 8 additions & 0 deletions source/client/ui/desktop/desktop_toolbar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -839,6 +841,8 @@ void DesktopToolBar::createAdditionalMenu(proto::SessionType session_type)
else
return;

LOG(LS_INFO) << "[ACTION] Scale chenged: " << scale_;

emit sig_scaleChanged();
});

Expand Down Expand Up @@ -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();
});

Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions source/client/ui/desktop/qt_desktop_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 << ")";
Expand Down
3 changes: 1 addition & 2 deletions source/client/ui/file_transfer/file_remove_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<QMessageBox> dialog(new QMessageBox(this));
Expand Down
15 changes: 5 additions & 10 deletions source/client/ui/file_transfer/file_transfer_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions source/client/ui/update_settings_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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();
});
Expand Down

0 comments on commit 6af1af7

Please sign in to comment.