changeset 645:e2f6bb97cc22

Toolbar spacing adjustments; avoid using unified toolbar on Mac because it breaks the left toolbar with Qt 4.8
author Chris Cannam
date Fri, 11 Jan 2013 10:29:04 +0000
parents b16e8ef6919b
children 6653fc50a546
files src/mainwindow.cpp
diffstat 1 files changed, 32 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/src/mainwindow.cpp	Fri Oct 19 12:08:11 2012 +0100
+++ b/src/mainwindow.cpp	Fri Jan 11 10:29:04 2013 +0000
@@ -121,7 +121,6 @@
     connect(m_hgTabs, SIGNAL(showAllChanged()),
             this, SLOT(showAllChanged()));
 
-    setUnifiedTitleAndToolBarOnMac(true);
     connectActions();
     clearState();
     enableDisableActions();
@@ -3085,24 +3084,44 @@
 {
     int sz = 32;
 
+    QString spacerBefore, spacerAfter;
+
+    spacerBefore = spacerAfter = " ";
+
+#ifdef Q_OS_MAC
+    spacerAfter = "";
+#endif
+
+#ifdef Q_OS_WIN32
+    spacerBefore = spacerAfter = "  "
+#endif
+
     bool spacingReqd = false;
     QString spacer = "";
-#ifndef Q_OS_MAC
-    spacingReqd = true;
-    spacer = " ";
-#ifdef Q_OS_WIN32
-    spacer = "  ";
-#endif
-#endif
+
+    m_repoToolBar = addToolBar(tr("Remote"));
+    m_repoToolBar->setIconSize(QSize(sz, sz));
+    if (spacerBefore != "") {
+        m_repoToolBar->addWidget(new QLabel(spacerBefore));
+    }
+    m_repoToolBar->addAction(m_openAct);
+    if (spacerAfter != "") {
+        m_repoToolBar->addWidget(new QLabel(spacerAfter));
+    }
+    m_repoToolBar->addSeparator();
+    m_repoToolBar->addAction(m_hgIncomingAct);
+    m_repoToolBar->addAction(m_hgPullAct);
+    m_repoToolBar->addAction(m_hgPushAct);
+    m_repoToolBar->setMovable(false);
 
     m_workFolderToolBar = new QToolBar(tr("Work"));
     addToolBar(Qt::LeftToolBarArea, m_workFolderToolBar);
     m_workFolderToolBar->setIconSize(QSize(sz, sz));
-    if (spacingReqd) {
-        QWidget *w = new QWidget;
-        w->setFixedHeight(6);
-        m_workFolderToolBar->addWidget(w);
-    }
+
+    QWidget *w = new QWidget;
+    w->setFixedHeight(6);
+    m_workFolderToolBar->addWidget(w);
+
     m_workFolderToolBar->addAction(m_hgFolderDiffAct);
     m_workFolderToolBar->addSeparator();
     m_workFolderToolBar->addAction(m_hgRevertAct);
@@ -3114,21 +3133,6 @@
     m_workFolderToolBar->addAction(m_hgRemoveAct);
     m_workFolderToolBar->setMovable(false);
 
-    m_repoToolBar = addToolBar(tr("Remote"));
-    m_repoToolBar->setIconSize(QSize(sz, sz));
-    if (spacingReqd) {
-        m_repoToolBar->addWidget(new QLabel(spacer));
-    }
-    m_repoToolBar->addAction(m_openAct);
-    if (spacingReqd) {
-        m_repoToolBar->addWidget(new QLabel(spacer));
-    }
-    m_repoToolBar->addSeparator();
-    m_repoToolBar->addAction(m_hgIncomingAct);
-    m_repoToolBar->addAction(m_hgPullAct);
-    m_repoToolBar->addAction(m_hgPushAct);
-    m_repoToolBar->setMovable(false);
-
     updateToolBarStyle();
 }