From c34b060b2fad5d07331b6ff98bbf5cc467062c29 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sun, 24 Nov 2013 14:18:21 +0000 Subject: [PATCH] Compare toolbar/menu option Just added a toolbar button and menu to bring up the compare pane, before adding it to the tab and view classes. --- src/CriticalPowerWindow.cpp | 4 ++-- src/MainWindow.cpp | 45 ++++++++++++++++++++++++++++++++++++- src/MainWindow.h | 9 +++++--- src/application.qrc | 1 + 4 files changed, 53 insertions(+), 6 deletions(-) diff --git a/src/CriticalPowerWindow.cpp b/src/CriticalPowerWindow.cpp index a043449ce..063725438 100644 --- a/src/CriticalPowerWindow.cpp +++ b/src/CriticalPowerWindow.cpp @@ -200,7 +200,7 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo anI2SpinBox->setAlignment(Qt::AlignRight); anI2SpinBox->setValue(360); // 6 minutes - QHBoxLayout *anLayout = new QHBoxLayout(this); + QHBoxLayout *anLayout = new QHBoxLayout; anLayout->addWidget(anI1SpinBox); anLayout->addWidget(anI2SpinBox); cl->addRow(new QLabel(tr("Interval 1 (seconds)")), anLayout); @@ -221,7 +221,7 @@ CriticalPowerWindow::CriticalPowerWindow(const QDir &home, Context *context, boo aeI2SpinBox->setAlignment(Qt::AlignRight); aeI2SpinBox->setValue(3600); // 30 minutes - QHBoxLayout *aeLayout = new QHBoxLayout(this); + QHBoxLayout *aeLayout = new QHBoxLayout; aeLayout->addWidget(aeI1SpinBox); aeLayout->addWidget(aeI2SpinBox); cl->addRow(new QLabel(tr("Interval 2 (seconds)")), aeLayout); diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 272bbf67f..47c431d91 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -250,6 +250,14 @@ MainWindow::MainWindow(const QDir &home) sidebar->setToolTip("Sidebar"); sidebar->setSelected(true); // assume always start up with sidebar selected + lowbar = new QtMacButton(this, QtMacButton::TexturedRounded); + QPixmap *lowbarImg = new QPixmap(":images/mac/lowbar.png"); + lowbar->setImage(lowbarImg); + lowbar->setMinimumSize(25, 25); + lowbar->setMaximumSize(25, 25); + lowbar->setToolTip("Compare"); + lowbar->setSelected(false); // assume always start up with lowbar deselected + actbuttons = new QtMacSegmentedButton(3, acts); actbuttons->setWidth(115); actbuttons->setNoSelect(); @@ -268,13 +276,22 @@ MainWindow::MainWindow(const QDir &home) QHBoxLayout *pq = new QHBoxLayout(viewsel); pq->setContentsMargins(0,0,0,0); pq->setSpacing(5); - pq->addWidget(sidebar); + QHBoxLayout *ps = new QHBoxLayout; + ps->setContentsMargins(0,0,0,0); + ps->setSpacing (2); // low and sidebar button close together + ps->addStretch(); + ps->addWidget(sidebar); + ps->addWidget(lowbar); + ps->addStretch(); + pq->addLayout(ps); + styleSelector = new QtMacSegmentedButton(2, viewsel); styleSelector->setWidth(80); // actually its 80 but we want a 30px space between is and the searchbox styleSelector->setImage(0, new QPixmap(":images/mac/tabbed.png"), 24); styleSelector->setImage(1, new QPixmap(":images/mac/tiled.png"), 24); pq->addWidget(styleSelector); connect(sidebar, SIGNAL(clicked(bool)), this, SLOT(toggleSidebar())); + connect(lowbar, SIGNAL(clicked(bool)), this, SLOT(toggleLowbar())); connect(styleSelector, SIGNAL(clicked(int,bool)), this, SLOT(toggleStyle())); // setup Mac thetoolbar @@ -313,6 +330,7 @@ MainWindow::MainWindow(const QDir &home) splitIcon = iconFromPNG(":images/mac/split.png"); deleteIcon = iconFromPNG(":images/mac/trash.png"); sidebarIcon = iconFromPNG(":images/mac/sidebar.png"); + lowbarIcon = iconFromPNG(":images/mac/lowbar.png"); tabbedIcon = iconFromPNG(":images/mac/tabbed.png"); tiledIcon = iconFromPNG(":images/mac/tiled.png"); QSize isize(19,19); @@ -338,6 +356,15 @@ MainWindow::MainWindow(const QDir &home) compose->setPalette(metal); connect(compose, SIGNAL(clicked(bool)), this, SLOT(manualRide())); + lowbar = new QPushButton(this); + lowbar->setIcon(lowbarIcon); + lowbar->setIconSize(isize); + lowbar->setFixedHeight(25); + lowbar->setStyle(toolStyle); + lowbar->setToolTip(tr("Toggle Compare Pane")); + lowbar->setPalette(metal); + connect(lowbar, SIGNAL(clicked(bool)), this, SLOT(toggleLowbar())); + sidebar = new QPushButton(this); sidebar->setIcon(sidebarIcon); sidebar->setIconSize(isize); @@ -382,6 +409,7 @@ MainWindow::MainWindow(const QDir &home) head->addStretch(); head->addWidget(sidebar); + head->addWidget(lowbar); head->addWidget(styleSelector); #ifdef GC_HAVE_LUCENE @@ -553,6 +581,9 @@ MainWindow::MainWindow(const QDir &home) showhideSidebar = viewMenu->addAction(tr("Show Left Sidebar"), this, SLOT(showSidebar(bool))); showhideSidebar->setCheckable(true); showhideSidebar->setChecked(true); + showhideLowbar = viewMenu->addAction(tr("Show Compare Pane"), this, SLOT(showLowbar(bool))); + showhideLowbar->setCheckable(true); + showhideLowbar->setChecked(false); #ifndef Q_OS_MAC // not on a Mac QAction *showhideToolbar = viewMenu->addAction(tr("Show Toolbar"), this, SLOT(showToolbar(bool))); showhideToolbar->setCheckable(true); @@ -624,6 +655,18 @@ MainWindow::showSidebar(bool want) tab->setSidebarEnabled(want); } +void +MainWindow::toggleLowbar() +{ + //XXX tab->toggleSidebar(); +} + +void +MainWindow::showLowbar(bool want) +{ + //XXX tab->setLowbarEnabled(want); +} + void MainWindow::showToolbar(bool want) { diff --git a/src/MainWindow.h b/src/MainWindow.h index 6361dc3e9..ec297939d 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -107,6 +107,8 @@ class MainWindow : public QMainWindow void toggleStyle(); void setStyle(); void setStyleFromSegment(int); // special case for linux/win qtsegmentcontrol toggline + void toggleLowbar(); + void showLowbar(bool want); // Analysis View void setActivityMenu(); @@ -177,18 +179,18 @@ class MainWindow : public QMainWindow #ifdef Q_OS_MAC // Mac Native Support - QtMacButton *import, *compose, *sidebar; + QtMacButton *import, *compose, *sidebar, *lowbar; QtMacSegmentedButton *actbuttons, *styleSelector; QToolBar *head; #else // Not on Mac so use other types - QPushButton *import, *compose, *sidebar; + QPushButton *import, *compose, *sidebar, *lowbar; QtSegmentControl *actbuttons, *styleSelector; GcToolBar *head; // the icons QIcon importIcon, composeIcon, intervalIcon, splitIcon, - deleteIcon, sidebarIcon, tabbedIcon, tiledIcon; + deleteIcon, sidebarIcon, lowbarIcon, tabbedIcon, tiledIcon; #endif // chart menus @@ -202,6 +204,7 @@ class MainWindow : public QMainWindow // only keeping those used outside of mainwindow constructor QAction *styleAction; QAction *showhideSidebar; + QAction *showhideLowbar; QAction *tweetAction; QAction *shareAction; QAction *ttbAction; diff --git a/src/application.qrc b/src/application.qrc index e5bb144fa..ae6d9f38c 100644 --- a/src/application.qrc +++ b/src/application.qrc @@ -127,6 +127,7 @@ images/mac/hide.png images/mac/show.png images/mac/sidebar.png + images/mac/lowbar.png images/mac/left.png images/mac/right.png images/analysis.png