From bc91eac2e55097c12dbe65bd559315fc65f41c1c Mon Sep 17 00:00:00 2001 From: alex-z Date: Mon, 9 Oct 2023 22:51:05 +0200 Subject: [PATCH] Improve Settings dialog design. Signed-off-by: alex-z --- src/gui/generalsettings.cpp | 27 +- src/gui/generalsettings.ui | 437 +++++++++++++++------------- src/gui/networksettings.cpp | 10 +- src/gui/networksettings.ui | 562 +++++++++++++++++++++++------------- src/libsync/theme.cpp | 30 +- src/libsync/theme.h | 5 + 6 files changed, 649 insertions(+), 422 deletions(-) diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 394d13c0d9772..114aab7cd9dd8 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -18,7 +18,6 @@ #include "theme.h" #include "configfile.h" #include "application.h" -#include "configfile.h" #include "owncloudsetupwizard.h" #include "accountmanager.h" #include "guiutility.h" @@ -124,7 +123,7 @@ void createDebugArchive(const QString &filename) zip.writeData(clientParameters, clientParameters.size()); zip.finishWriting(clientParameters.size()); - const auto buildInfo = QString(OCC::Theme::instance()->about() + "\n\n" + OCC::Theme::instance()->aboutDetails()).toUtf8(); + const auto buildInfo = QString(OCC::Theme::instance()->aboutInfo() + "\n\n" + OCC::Theme::instance()->aboutDetails()).toUtf8(); zip.prepareWriting("__nextcloud_client_buildinfo.txt", {}, {}, buildInfo.size()); zip.writeData(buildInfo, buildInfo.size()); zip.finishWriting(buildInfo.size()); @@ -169,14 +168,17 @@ GeneralSettings::GeneralSettings(QWidget *parent) } // setup about section - QString about = Theme::instance()->about(); - _ui->aboutLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction); - _ui->aboutLabel->setText(about); - _ui->aboutLabel->setOpenExternalLinks(true); + _ui->infoAndUpdatesLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction); + _ui->infoAndUpdatesLabel->setText(Theme::instance()->about()); + _ui->infoAndUpdatesLabel->setOpenExternalLinks(true); // About legal notice connect(_ui->legalNoticeButton, &QPushButton::clicked, this, &GeneralSettings::slotShowLegalNotice); + connect(_ui->usageDocumentationButton, &QPushButton::clicked, this, []() { + Utility::openBrowser(QUrl(Theme::instance()->helpUrl())); + }); + loadMiscSettings(); // updater info now set in: customizeStyle //slotUpdateInfo(); @@ -277,7 +279,7 @@ void GeneralSettings::slotUpdateInfo() const auto updater = Updater::instance(); if (ConfigFile().skipUpdateCheck() || !updater) { // updater disabled on compile - _ui->updatesGroupBox->setVisible(false); + _ui->updatesContainer->setVisible(false); return; } @@ -517,15 +519,18 @@ void GeneralSettings::slotStyleChanged() void GeneralSettings::customizeStyle() { // setup about section - QString about = Theme::instance()->about(); - Theme::replaceLinkColorStringBackgroundAware(about); - _ui->aboutLabel->setText(about); + const auto aboutText = []() { + auto aboutText = Theme::instance()->about(); + Theme::replaceLinkColorStringBackgroundAware(aboutText); + return aboutText; + }(); + _ui->infoAndUpdatesLabel->setText(aboutText); #if defined(BUILD_UPDATER) // updater info slotUpdateInfo(); #else - _ui->updatesGroupBox->setVisible(false); + _ui->updatesContainer->setVisible(false); #endif } diff --git a/src/gui/generalsettings.ui b/src/gui/generalsettings.ui index 568213e56206d..0bbb5483dc6dc 100644 --- a/src/gui/generalsettings.ui +++ b/src/gui/generalsettings.ui @@ -14,207 +14,6 @@ Form - - - - About - - - - - - - 0 - 0 - - - - About - - - - - - - - - Legal notice - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - General Settings - - - - - - For System Tray - - - Use &Monochrome Icons - - - - - - - &Launch on System Startup - - - - - - - Show Server &Notifications - - - - - - - Show Call Notifications - - - - - - - - - - Updates - - - - - - - - &Automatically check for Updates - - - true - - - - - - - - - - - - 0 - 0 - - - - &Channel - - - updateChannel - - - - - - - - 0 - 0 - - - - - stable - - - - - beta - - - - - - - - - - - true - - - true - - - - - - - - 0 - 0 - - - - &Restart && Update - - - - - - - - - - 0 - 0 - - - - &Check for Update now - - - - - - - - - - Qt::Vertical - - - - 20 - 0 - - - - @@ -356,7 +155,7 @@ - Show sync folders in &Explorer's Navigation Pane + Show sync folders in &Explorer's navigation pane @@ -413,6 +212,239 @@ + + + + Info + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Desktop client x.x.x + + + + + + + + + + 0 + 0 + + + + Update channel + + + + + + + + 0 + 0 + + + + + stable + + + + + beta + + + + + + + + + + + true + + + true + + + + + + + + 0 + 0 + + + + &Restart && Update + + + + + + + + + + + + 0 + 0 + + + + &Automatically check for updates + + + true + + + + + + + + 0 + 0 + + + + Check Now + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Usage Documentation + + + + + + + Legal Notice + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + General Settings + + + + + + For System Tray + + + Use &monochrome icons + + + + + + + &Launch on system startup + + + + + + + Show server &notifications + + + + + + + Show call notifications + + + + + + @@ -423,7 +455,6 @@ newFolderLimitCheckBox newFolderLimitSpinBox crashreporterCheckBox - autoCheckForUpdatesCheckBox restartButton diff --git a/src/gui/networksettings.cpp b/src/gui/networksettings.cpp index 0be6fa8366f7e..4ea7d19340838 100644 --- a/src/gui/networksettings.cpp +++ b/src/gui/networksettings.cpp @@ -34,6 +34,8 @@ NetworkSettings::NetworkSettings(QWidget *parent) { _ui->setupUi(this); + _ui->manualSettings->setVisible(_ui->manualProxyRadioButton->isChecked()); + _ui->proxyGroupBox->setVisible(!Theme::instance()->doNotUseProxy()); if (!Theme::instance()->doNotUseProxy()) { @@ -53,8 +55,7 @@ NetworkSettings::NetworkSettings(QWidget *parent) _ui->authWidgets->setEnabled(_ui->authRequiredcheckBox->isChecked()); connect(_ui->authRequiredcheckBox, &QAbstractButton::toggled, _ui->authWidgets, &QWidget::setEnabled); - connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, _ui->manualSettings, &QWidget::setEnabled); - connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, _ui->typeComboBox, &QWidget::setEnabled); + connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, _ui->manualSettings, &QWidget::setVisible); connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled, this, &NetworkSettings::checkAccountLocalhost); loadProxySettings(); @@ -79,6 +80,11 @@ NetworkSettings::NetworkSettings(QWidget *parent) loadBWLimitSettings(); + _ui->downloadSpinBox->setVisible(_ui->downloadLimitRadioButton->isChecked()); + _ui->downloadSpinBoxLabel->setVisible(_ui->downloadLimitRadioButton->isChecked()); + _ui->uploadSpinBox->setVisible(_ui->uploadLimitRadioButton->isChecked()); + _ui->uploadSpinBoxLabel->setVisible(_ui->uploadLimitRadioButton->isChecked()); + connect(_ui->uploadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings); connect(_ui->noUploadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings); connect(_ui->autoUploadLimitRadioButton, &QAbstractButton::clicked, this, &NetworkSettings::saveBWLimitSettings); diff --git a/src/gui/networksettings.ui b/src/gui/networksettings.ui index dd21dc646f0f8..3974a1f82caa0 100644 --- a/src/gui/networksettings.ui +++ b/src/gui/networksettings.ui @@ -6,34 +6,46 @@ 0 0 - 623 - 581 + 524 + 527 Form + + + + Qt::Vertical + + + + 20 + 40 + + + + true + + + 0 + 0 + + Proxy Settings - - - - false - - - - No Proxy + No proxy true @@ -53,142 +65,232 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + - Specify proxy manually as + Manually specify proxy proxyButtonGroup - - - - false - - - - 0 - - - + + + + + + true + + + + 0 + 0 + + + + + 0 + - - - Host - - + + + + + true + + + + 0 + 0 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - - 0 - 0 - + + + + + Host + + + + + + + + 1 + 0 + + + + + + + + + + + : + + + + + + + + 0 + 0 + + + + 1 + + + 65535 + + + 8080 + + + + + + + + + false - + Proxy server requires authentication - - - : + + + true + + + 0 + + + 0 + + + 0 + + + 0 + + + + + false + + + + 1 + 0 + + + + + + + + + + + false + + + + 1 + 0 + + + + + + + QLineEdit::Password + + + + - - - - 0 - 0 - - - - 1 - - - 65535 - - - 8080 + + + Note: proxy settings have no effects for accounts on localhost - - - - - false - - - Proxy server requires authentication - - - - - - - false - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - - - - - - QLineEdit::Password - - - - - - - - - - Note: proxy settings have no effects for accounts on localhost - - - - - + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - + + + 0 + + + 0 + - + 0 0 @@ -196,14 +298,19 @@ Download Bandwidth + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + - - - - Limit to - - - + + 9 + + + 0 + + + 6 + @@ -214,25 +321,29 @@ - - - - Qt::Vertical + + + + Limit to 3/4 of estimated bandwidth - - - 147 - 25 - + + Limit automatically - + + + + + + Limit to + + - + - false + true 999999 @@ -243,7 +354,13 @@ - + + + + 0 + 0 + + KBytes/s @@ -251,15 +368,18 @@ - - - - Limit to 3/4 of estimated bandwidth + + + + Qt::Vertical - - Limit automatically + + + 20 + 40 + - + @@ -267,7 +387,7 @@ - + 0 0 @@ -275,40 +395,28 @@ Upload Bandwidth + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + false + - - - - Limit to - - - - - - - Limit to 3/4 of estimated bandwidth - - - Limit automatically - - - - - - - No limit - - - true - - - - - + + 9 + + + 0 + + + 6 + + + - false + true 1 @@ -322,7 +430,13 @@ - + + + + 0 + 0 + + KBytes/s @@ -330,27 +444,55 @@ + + + + Limit to 3/4 of estimated bandwidth + + + Limit automatically + + + + + + + Limit to + + + + + + + No limit + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + autoUploadLimitRadioButton uploadLimitRadioButton noUploadLimitRadioButton + verticalSpacer_3 - - - - Qt::Vertical - - - - 20 - 0 - - - - @@ -359,15 +501,31 @@ downloadLimitRadioButton toggled(bool) downloadSpinBox - setEnabled(bool) + setVisible(bool) + + + 75 + 315 + + + 49 + 334 + + + + + downloadLimitRadioButton + toggled(bool) + downloadSpinBoxLabel + setVisible(bool) - 73 - 69 + 75 + 315 - 131 - 78 + 107 + 334 @@ -375,15 +533,31 @@ uploadLimitRadioButton toggled(bool) uploadSpinBox - setEnabled(bool) + setVisible(bool) + + + 330 + 315 + + + 304 + 334 + + + + + uploadLimitRadioButton + toggled(bool) + uploadSpinBoxLabel + setVisible(bool) - 322 - 101 + 330 + 315 - 411 - 106 + 362 + 334 diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index bb930494ea9db..46060c5b7f81b 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -530,7 +530,7 @@ QString Theme::gitSHA1() const const QString githubPrefix(QLatin1String( "https://github.com/nextcloud/desktop/commit/")); const QString gitSha1(QLatin1String(GIT_SHA1)); - devString = QCoreApplication::translate("nextcloudTheme::about()", + devString = QCoreApplication::translate("nextcloudTheme::aboutInfo()", "

Built from Git revision %2" " on %3, %4 using Qt %5, %6

") .arg(githubPrefix + gitSha1) @@ -543,25 +543,31 @@ QString Theme::gitSHA1() const return devString; } -QString Theme::about() const +QString Theme::aboutInfo() const { // Shorten Qt's OS name: "macOS Mojave (10.14)" -> "macOS" QStringList osStringList = Utility::platformName().split(QLatin1Char(' ')); QString osName = osStringList.at(0); - QString devString; //: Example text: "

Nextcloud Desktop Client

" (%1 is the application name) - devString = tr("

%1 Desktop Client

") - .arg(APPLICATION_NAME); + auto devString = QString(tr("

%1 Desktop Client

Version %1. For more information please click here.

") + QStringLiteral(" (%3)")) + .arg(APPLICATION_NAME, QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION)), helpUrl(), osName); + - devString += tr("

Version %1. For more information please click here.

") - .arg(QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION)) + QString(" (%1)").arg(osName)) - .arg(helpUrl()); + devString += tr("

Using virtual files plugin: %1

").arg(Vfs::modeToString(bestAvailableVfsMode())); + devString += QStringLiteral("
%1").arg(QSysInfo::productType() % QLatin1Char('-') % QSysInfo::kernelVersion()); - devString += tr("

Using virtual files plugin: %1

") - .arg(Vfs::modeToString(bestAvailableVfsMode())); - devString += QStringLiteral("
%1") - .arg(QSysInfo::productType() % QLatin1Char('-') % QSysInfo::kernelVersion()); + return devString; +} + +QString Theme::about() const +{ + // Shorten Qt's OS name: "macOS Mojave (10.14)" -> "macOS" + QStringList osStringList = Utility::platformName().split(QLatin1Char(' ')); + QString osName = osStringList.at(0); + + //: Example text: "

Nextcloud Desktop Client

" (%1 is the application name) + const auto devString = tr("

%1 desktop client %2

").arg(APPLICATION_NAME, QString::fromLatin1(MIRALL_STRINGIFY(MIRALL_VERSION))); return devString; } diff --git a/src/libsync/theme.h b/src/libsync/theme.h index cb06e1263bf3f..41597c32e27c8 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -336,6 +336,11 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject */ [[nodiscard]] QString gitSHA1() const; + /** + * About info text + */ + [[nodiscard]] QString aboutInfo() const; + /** * About dialog contents */