[Pkg-owncloud-commits] [owncloud-client] 16/120: Settings dialog: improve layout a bit

Sandro Knauß hefee-guest at moszumanska.debian.org
Mon Aug 24 00:02:38 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 6b4a9d9cd9e47ec40b5da6c93a28d3669ceddd4f
Author: Daniel Molkentin <danimo at owncloud.com>
Date:   Mon Aug 10 10:50:57 2015 +0200

    Settings dialog: improve layout a bit
---
 client.qrc                                  |   3 +++
 resources/account.png                       | Bin 2777 -> 1439 bytes
 resources/{account.png => account at 2x.png}   | Bin
 resources/activity.png                      | Bin 1993 -> 1129 bytes
 resources/{activity.png => activity at 2x.png} | Bin
 resources/network.png                       | Bin 1459 -> 879 bytes
 resources/network at 2x.png                    | Bin 0 -> 2556 bytes
 resources/settings.png                      | Bin 3677 -> 1950 bytes
 resources/{settings.png => settings at 2x.png} | Bin
 src/gui/settingsdialog.cpp                  |  37 ++++++++++++++++++++--------
 10 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/client.qrc b/client.qrc
index 19e1bf1..f1116f6 100644
--- a/client.qrc
+++ b/client.qrc
@@ -10,8 +10,11 @@
         <file>resources/warning.png</file>
         <file>resources/warning at 2x.png</file>
         <file>resources/settings.png</file>
+        <file>resources/settings at 2x.png</file>
         <file>resources/activity.png</file>
+        <file>resources/activity at 2x.png</file>
         <file>resources/network.png</file>
+        <file>resources/network at 2x.png</file>
         <file>resources/lock-http.png</file>
         <file>resources/lock-http at 2x.png</file>
         <file>resources/lock-https.png</file>
diff --git a/resources/account.png b/resources/account.png
index c227f8d..e2eede8 100644
Binary files a/resources/account.png and b/resources/account.png differ
diff --git a/resources/account.png b/resources/account at 2x.png
similarity index 100%
copy from resources/account.png
copy to resources/account at 2x.png
diff --git a/resources/activity.png b/resources/activity.png
index 8d4ae9f..a05e841 100644
Binary files a/resources/activity.png and b/resources/activity.png differ
diff --git a/resources/activity.png b/resources/activity at 2x.png
similarity index 100%
copy from resources/activity.png
copy to resources/activity at 2x.png
diff --git a/resources/network.png b/resources/network.png
index 0e9fe77..bed57f7 100644
Binary files a/resources/network.png and b/resources/network.png differ
diff --git a/resources/network at 2x.png b/resources/network at 2x.png
new file mode 100644
index 0000000..5190c9a
Binary files /dev/null and b/resources/network at 2x.png differ
diff --git a/resources/settings.png b/resources/settings.png
index d868ea8..b7c6b11 100644
Binary files a/resources/settings.png and b/resources/settings.png differ
diff --git a/resources/settings.png b/resources/settings at 2x.png
similarity index 100%
copy from resources/settings.png
copy to resources/settings at 2x.png
diff --git a/src/gui/settingsdialog.cpp b/src/gui/settingsdialog.cpp
index ce57eeb..20df8fe 100644
--- a/src/gui/settingsdialog.cpp
+++ b/src/gui/settingsdialog.cpp
@@ -32,13 +32,23 @@
 #include <QDebug>
 #include <QSettings>
 #include <QToolBar>
+#include <QToolButton>
 #include <QLayout>
+#include <QVBoxLayout>
 
 namespace {
   const char TOOLBAR_CSS[] =
     "QToolBar { background: white; margin: 0; padding: 0; border: none; border-bottom: 1px solid %1; spacing: 0; } "
     "QToolBar QToolButton { background: white; border: none; border-bottom: 1px solid %1; margin: 0; padding: 0; } "
     "QToolBar QToolButton:checked { background: %2; color: %3; }";
+
+  void addActionToToolBar(QAction *action, QToolBar *tb) {
+    QToolButton* btn = new QToolButton;
+    btn->setDefaultAction(action);
+    btn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+    btn->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+    tb->addWidget(btn);
+  }
 }
 
 namespace OCC {
@@ -54,11 +64,11 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) :
     setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
     _ui->setupUi(this);
     QToolBar *toolBar = new QToolBar;
-    toolBar->setIconSize(QSize(32,32));
     QString highlightColor(palette().highlight().color().name());
     QString altBase(palette().alternateBase().color().name());
     QString dark(palette().dark().color().name());
     toolBar->setStyleSheet(QString::fromAscii(TOOLBAR_CSS).arg(dark).arg(highlightColor).arg(altBase));
+    toolBar->setIconSize(QSize(32, 32));
     toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
     layout()->setMenuBar(toolBar);
 
@@ -68,6 +78,7 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) :
     connect(closeWindowAction, SIGNAL(triggered()), SLOT(accept()));
     addAction(closeWindowAction);
 
+
     setObjectName("Settings"); // required as group for saveGeometry call
     setWindowTitle(Theme::instance()->appNameGUI());
 
@@ -75,24 +86,29 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) :
     auto spacer = new QWidget();
     spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
     toolBar->addWidget(spacer);
+    QActionGroup *group = new QActionGroup(this);
+    group->setExclusive(true);
 
     // Note: all the actions have a '\n' because the account name is in two lines and
     // all buttons must have the same size in order to keep a good layout
     QIcon protocolIcon(QLatin1String(":/client/resources/activity.png"));
-    _protocolAction = toolBar->addAction(protocolIcon, tr("Activity") + QLatin1Char('\n'));
+    _protocolAction = group->addAction(protocolIcon, tr("Activity"));
     _protocolAction->setCheckable(true);
+    addActionToToolBar(_protocolAction, toolBar);
     ProtocolWidget *protocolWidget = new ProtocolWidget;
     _ui->stack->addWidget(protocolWidget);
 
     QIcon generalIcon(QLatin1String(":/client/resources/settings.png"));
-    QAction *generalAction = toolBar->addAction(generalIcon, tr("General") + QLatin1Char('\n'));
+    QAction *generalAction =  group->addAction(generalIcon, tr("General"));
     generalAction->setCheckable(true);
+    addActionToToolBar(generalAction, toolBar);
     GeneralSettings *generalSettings = new GeneralSettings;
     _ui->stack->addWidget(generalSettings);
 
     QIcon networkIcon(QLatin1String(":/client/resources/network.png"));
-    QAction *networkAction = toolBar->addAction(networkIcon, tr("Network") + QLatin1Char('\n'));
+    QAction *networkAction =  group->addAction(networkIcon, tr("Network"));
     networkAction->setCheckable(true);
+    addActionToToolBar(networkAction, toolBar);
     NetworkSettings *networkSettings = new NetworkSettings;
     _ui->stack->addWidget(networkSettings);
 
@@ -100,11 +116,6 @@ SettingsDialog::SettingsDialog(ownCloudGui *gui, QWidget *parent) :
     _actions.insert(generalAction, generalSettings);
     _actions.insert(networkAction, networkSettings);
 
-    QActionGroup *group = new QActionGroup(this);
-    group->addAction(_protocolAction);
-    group->addAction(generalAction);
-    group->addAction(networkAction);
-    group->setExclusive(true);
     connect(group, SIGNAL(triggered(QAction*)), SLOT(slotSwitchPage(QAction*)));
 
     connect(AccountManager::instance(), SIGNAL(accountAdded(AccountState*)),
@@ -167,8 +178,14 @@ void SettingsDialog::accountAdded(AccountState *s)
     Q_ASSERT(toolBar);
     auto accountAction = new QAction(accountIcon, s->shortDisplayNameForSettings(), this);
     accountAction->setToolTip(s->account()->displayName());
-    toolBar->insertAction(toolBar->actions().at(0), accountAction);
     accountAction->setCheckable(true);
+
+    QToolButton* accountButton = new QToolButton;
+    accountButton->setDefaultAction(accountAction);
+    accountButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
+    accountButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
+    toolBar->insertWidget(toolBar->actions().at(0), accountButton);
+
     auto accountSettings = new AccountSettings(s, this);
     _ui->stack->insertWidget(0 , accountSettings);
     _actions.insert(accountAction, accountSettings);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list