comparison src/mainwindow.cpp @ 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 a03264984ef8
comparison
equal deleted inserted replaced
642:b16e8ef6919b 645:e2f6bb97cc22
119 connect(m_hgTabs, SIGNAL(selectionChanged()), 119 connect(m_hgTabs, SIGNAL(selectionChanged()),
120 this, SLOT(enableDisableActions())); 120 this, SLOT(enableDisableActions()));
121 connect(m_hgTabs, SIGNAL(showAllChanged()), 121 connect(m_hgTabs, SIGNAL(showAllChanged()),
122 this, SLOT(showAllChanged())); 122 this, SLOT(showAllChanged()));
123 123
124 setUnifiedTitleAndToolBarOnMac(true);
125 connectActions(); 124 connectActions();
126 clearState(); 125 clearState();
127 enableDisableActions(); 126 enableDisableActions();
128 127
129 if (m_firstStart) { 128 if (m_firstStart) {
3083 3082
3084 void MainWindow::createToolBars() 3083 void MainWindow::createToolBars()
3085 { 3084 {
3086 int sz = 32; 3085 int sz = 32;
3087 3086
3087 QString spacerBefore, spacerAfter;
3088
3089 spacerBefore = spacerAfter = " ";
3090
3091 #ifdef Q_OS_MAC
3092 spacerAfter = "";
3093 #endif
3094
3095 #ifdef Q_OS_WIN32
3096 spacerBefore = spacerAfter = " "
3097 #endif
3098
3088 bool spacingReqd = false; 3099 bool spacingReqd = false;
3089 QString spacer = ""; 3100 QString spacer = "";
3090 #ifndef Q_OS_MAC 3101
3091 spacingReqd = true; 3102 m_repoToolBar = addToolBar(tr("Remote"));
3092 spacer = " "; 3103 m_repoToolBar->setIconSize(QSize(sz, sz));
3093 #ifdef Q_OS_WIN32 3104 if (spacerBefore != "") {
3094 spacer = " "; 3105 m_repoToolBar->addWidget(new QLabel(spacerBefore));
3095 #endif 3106 }
3096 #endif 3107 m_repoToolBar->addAction(m_openAct);
3108 if (spacerAfter != "") {
3109 m_repoToolBar->addWidget(new QLabel(spacerAfter));
3110 }
3111 m_repoToolBar->addSeparator();
3112 m_repoToolBar->addAction(m_hgIncomingAct);
3113 m_repoToolBar->addAction(m_hgPullAct);
3114 m_repoToolBar->addAction(m_hgPushAct);
3115 m_repoToolBar->setMovable(false);
3097 3116
3098 m_workFolderToolBar = new QToolBar(tr("Work")); 3117 m_workFolderToolBar = new QToolBar(tr("Work"));
3099 addToolBar(Qt::LeftToolBarArea, m_workFolderToolBar); 3118 addToolBar(Qt::LeftToolBarArea, m_workFolderToolBar);
3100 m_workFolderToolBar->setIconSize(QSize(sz, sz)); 3119 m_workFolderToolBar->setIconSize(QSize(sz, sz));
3101 if (spacingReqd) { 3120
3102 QWidget *w = new QWidget; 3121 QWidget *w = new QWidget;
3103 w->setFixedHeight(6); 3122 w->setFixedHeight(6);
3104 m_workFolderToolBar->addWidget(w); 3123 m_workFolderToolBar->addWidget(w);
3105 } 3124
3106 m_workFolderToolBar->addAction(m_hgFolderDiffAct); 3125 m_workFolderToolBar->addAction(m_hgFolderDiffAct);
3107 m_workFolderToolBar->addSeparator(); 3126 m_workFolderToolBar->addSeparator();
3108 m_workFolderToolBar->addAction(m_hgRevertAct); 3127 m_workFolderToolBar->addAction(m_hgRevertAct);
3109 m_workFolderToolBar->addAction(m_hgUpdateAct); 3128 m_workFolderToolBar->addAction(m_hgUpdateAct);
3110 m_workFolderToolBar->addAction(m_hgCommitAct); 3129 m_workFolderToolBar->addAction(m_hgCommitAct);
3111 m_workFolderToolBar->addAction(m_hgMergeAct); 3130 m_workFolderToolBar->addAction(m_hgMergeAct);
3112 m_workFolderToolBar->addSeparator(); 3131 m_workFolderToolBar->addSeparator();
3113 m_workFolderToolBar->addAction(m_hgAddAct); 3132 m_workFolderToolBar->addAction(m_hgAddAct);
3114 m_workFolderToolBar->addAction(m_hgRemoveAct); 3133 m_workFolderToolBar->addAction(m_hgRemoveAct);
3115 m_workFolderToolBar->setMovable(false); 3134 m_workFolderToolBar->setMovable(false);
3116
3117 m_repoToolBar = addToolBar(tr("Remote"));
3118 m_repoToolBar->setIconSize(QSize(sz, sz));
3119 if (spacingReqd) {
3120 m_repoToolBar->addWidget(new QLabel(spacer));
3121 }
3122 m_repoToolBar->addAction(m_openAct);
3123 if (spacingReqd) {
3124 m_repoToolBar->addWidget(new QLabel(spacer));
3125 }
3126 m_repoToolBar->addSeparator();
3127 m_repoToolBar->addAction(m_hgIncomingAct);
3128 m_repoToolBar->addAction(m_hgPullAct);
3129 m_repoToolBar->addAction(m_hgPushAct);
3130 m_repoToolBar->setMovable(false);
3131 3135
3132 updateToolBarStyle(); 3136 updateToolBarStyle();
3133 } 3137 }
3134 3138
3135 void MainWindow::updateToolBarStyle() 3139 void MainWindow::updateToolBarStyle()