From 2b3a1137bcef344d99edd2f7dde8e68661d1de48 Mon Sep 17 00:00:00 2001 From: Martchus Date: Mon, 3 Oct 2016 01:16:47 +0200 Subject: [PATCH] Improve appearance settings --- tray/application/settings.cpp | 8 ++ tray/application/settings.h | 1 + tray/gui/appearanceoptionpage.ui | 39 ++++++++-- tray/gui/settingsdialog.cpp | 2 + tray/gui/traywidget.cpp | 4 + tray/translations/syncthingtray_de_DE.ts | 95 +++++++++++++++--------- tray/translations/syncthingtray_en_US.ts | 95 +++++++++++++++--------- 7 files changed, 166 insertions(+), 78 deletions(-) diff --git a/tray/application/settings.cpp b/tray/application/settings.cpp index 061592d..9af0896 100644 --- a/tray/application/settings.cpp +++ b/tray/application/settings.cpp @@ -11,6 +11,7 @@ #include #include #include +#include using namespace std; using namespace Data; @@ -74,6 +75,11 @@ int &frameStyle() static int v = QFrame::StyledPanel | QFrame::Sunken; return v; } +int &tabPosition() +{ + static int v = QTabWidget::South; + return v; +} // autostart/launcher bool &launchSynchting() @@ -179,6 +185,7 @@ void restore() showTraffic() = settings.value(QStringLiteral("showTraffic"), showTraffic()).toBool(); trayMenuSize() = settings.value(QStringLiteral("trayMenuSize"), trayMenuSize()).toSize(); frameStyle() = settings.value(QStringLiteral("frameStyle"), frameStyle()).toInt(); + tabPosition() = settings.value(QStringLiteral("tabPos"), tabPosition()).toInt(); settings.endGroup(); settings.beginGroup(QStringLiteral("startup")); @@ -228,6 +235,7 @@ void save() settings.setValue(QStringLiteral("showTraffic"), showTraffic()); settings.setValue(QStringLiteral("trayMenuSize"), trayMenuSize()); settings.setValue(QStringLiteral("frameStyle"), frameStyle()); + settings.setValue(QStringLiteral("tabPos"), tabPosition()); settings.endGroup(); settings.beginGroup(QStringLiteral("startup")); diff --git a/tray/application/settings.h b/tray/application/settings.h index cff8b04..a279778 100644 --- a/tray/application/settings.h +++ b/tray/application/settings.h @@ -39,6 +39,7 @@ bool &showSyncthingNotifications(); bool &showTraffic(); QSize &trayMenuSize(); int &frameStyle(); +int &tabPosition(); // autostart/launcher bool &launchSynchting(); diff --git a/tray/gui/appearanceoptionpage.ui b/tray/gui/appearanceoptionpage.ui index 2c464a1..0300883 100644 --- a/tray/gui/appearanceoptionpage.ui +++ b/tray/gui/appearanceoptionpage.ui @@ -2,14 +2,6 @@ QtGui::AppearanceOptionPage - - - 0 - 0 - 422 - 149 - - Appearance @@ -155,6 +147,37 @@ + + + + Tab position + + + + + + + + Top + + + + + Bottom + + + + + Left + + + + + Right + + + + diff --git a/tray/gui/settingsdialog.cpp b/tray/gui/settingsdialog.cpp index da42acd..db22b9d 100644 --- a/tray/gui/settingsdialog.cpp +++ b/tray/gui/settingsdialog.cpp @@ -275,6 +275,7 @@ bool AppearanceOptionPage::apply() default: style |= QFrame::Sunken; } frameStyle() = style; + tabPosition() = ui()->tabPosComboBox->currentIndex(); } return true; } @@ -299,6 +300,7 @@ void AppearanceOptionPage::reset() default: index = 2; } ui()->frameShadowComboBox->setCurrentIndex(index); + ui()->tabPosComboBox->setCurrentIndex(tabPosition()); } } diff --git a/tray/gui/traywidget.cpp b/tray/gui/traywidget.cpp index a625c96..e2cd51c 100644 --- a/tray/gui/traywidget.cpp +++ b/tray/gui/traywidget.cpp @@ -333,6 +333,7 @@ void TrayWidget::applySettings() // update visual appearance instance->m_ui->trafficFormWidget->setVisible(Settings::showTraffic()); + instance->m_ui->trafficIconLabel->setVisible(Settings::showTraffic()); if(Settings::showTraffic()) { instance->updateTraffic(); } @@ -343,6 +344,9 @@ void TrayWidget::applySettings() } else { instance->m_cornerFrame->setFrameStyle(Settings::frameStyle()); } + if(Settings::tabPosition() >= QTabWidget::North && Settings::tabPosition() <= QTabWidget::East) { + instance->m_ui->tabWidget->setTabPosition(static_cast(Settings::tabPosition())); + } } } diff --git a/tray/translations/syncthingtray_de_DE.ts b/tray/translations/syncthingtray_de_DE.ts index 91053aa..a965631 100644 --- a/tray/translations/syncthingtray_de_DE.ts +++ b/tray/translations/syncthingtray_de_DE.ts @@ -4,80 +4,105 @@ QtGui::AppearanceOptionPage - + Appearance - + Menu size - + Optional GUI elements - + Traffic statistics - + x - + px - + Frame shape - + Frame shadow - + No frame - + Box - + Panel - + Styled panel - + Plain - + Raised - + Sunken + + + Tab position + + + + + Top + + + + + Bottom + + + + + Left + + + + + Right + + QtGui::AutostartOptionPage @@ -92,22 +117,22 @@ - + This is achieved by adding a *.desktop file under <i>~/.config/autostart</i> so the setting only affects the current user. - + This is achieved by adding a registry key under <i>HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run</i> so the setting only affects the current user. Note that the startup entry is invalidated when moving <i>syncthingtray.exe</i>. - + This feature has not been implemented for your platform (yet). - + unable to modify startup entry @@ -333,13 +358,13 @@ - + Syncthing existed with exit code %1 - + Syncthing crashed with exit code %1 @@ -381,22 +406,22 @@ QtGui::SettingsDialog - + Tray - + Startup - + Settings - + Web view @@ -531,7 +556,7 @@ For <i>all</i> notifications, checkout the log - + unknown @@ -633,12 +658,12 @@ For <i>all</i> notifications, checkout the log - + The directory <i>%1</i> does not exist on the local machine. - + The file <i>%1</i> does not exist on the local machine. @@ -670,7 +695,7 @@ For <i>all</i> notifications, checkout the log QtGui::WebViewOptionPage - + General @@ -700,7 +725,7 @@ For <i>all</i> notifications, checkout the log - + Syncthing Tray has not been built with vieb view support utilizing either Qt WebKit or Qt WebEngine. The Web UI will be opened in the default web browser instead. @@ -709,7 +734,7 @@ The Web UI will be opened in the default web browser instead. Settings::restore - + Unable to load certificate "%1" when restoring settings. @@ -717,22 +742,22 @@ The Web UI will be opened in the default web browser instead. main - + You must configure how to connect to Syncthing when using Syncthing Tray the first time. - + Note that the settings dialog allows importing URL, credentials and API-key from the local Syncthing configuration. - + The system tray is (currently) not available. You could open the tray menu as a regular window using the -w flag, though. - + The Qt libraries have not been built with tray icon support. You could open the tray menu as a regular window using the -w flag, though. diff --git a/tray/translations/syncthingtray_en_US.ts b/tray/translations/syncthingtray_en_US.ts index 6042fb2..902cdb3 100644 --- a/tray/translations/syncthingtray_en_US.ts +++ b/tray/translations/syncthingtray_en_US.ts @@ -4,80 +4,105 @@ QtGui::AppearanceOptionPage - + Appearance - + Menu size - + Optional GUI elements - + Traffic statistics - + x - + px - + Frame shape - + Frame shadow - + No frame - + Box - + Panel - + Styled panel - + Plain - + Raised - + Sunken + + + Tab position + + + + + Top + + + + + Bottom + + + + + Left + + + + + Right + + QtGui::AutostartOptionPage @@ -92,22 +117,22 @@ - + This is achieved by adding a *.desktop file under <i>~/.config/autostart</i> so the setting only affects the current user. - + This is achieved by adding a registry key under <i>HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run</i> so the setting only affects the current user. Note that the startup entry is invalidated when moving <i>syncthingtray.exe</i>. - + This feature has not been implemented for your platform (yet). - + unable to modify startup entry @@ -333,13 +358,13 @@ - + Syncthing existed with exit code %1 - + Syncthing crashed with exit code %1 @@ -381,22 +406,22 @@ QtGui::SettingsDialog - + Tray - + Startup - + Settings - + Web view @@ -531,7 +556,7 @@ For <i>all</i> notifications, checkout the log - + unknown @@ -633,12 +658,12 @@ For <i>all</i> notifications, checkout the log - + The directory <i>%1</i> does not exist on the local machine. - + The file <i>%1</i> does not exist on the local machine. @@ -670,7 +695,7 @@ For <i>all</i> notifications, checkout the log QtGui::WebViewOptionPage - + General @@ -700,7 +725,7 @@ For <i>all</i> notifications, checkout the log - + Syncthing Tray has not been built with vieb view support utilizing either Qt WebKit or Qt WebEngine. The Web UI will be opened in the default web browser instead. @@ -709,7 +734,7 @@ The Web UI will be opened in the default web browser instead. Settings::restore - + Unable to load certificate "%1" when restoring settings. @@ -717,22 +742,22 @@ The Web UI will be opened in the default web browser instead. main - + You must configure how to connect to Syncthing when using Syncthing Tray the first time. - + Note that the settings dialog allows importing URL, credentials and API-key from the local Syncthing configuration. - + The system tray is (currently) not available. You could open the tray menu as a regular window using the -w flag, though. - + The Qt libraries have not been built with tray icon support. You could open the tray menu as a regular window using the -w flag, though.