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.
This commit is contained in:
Mark Liversedge
2013-11-24 14:18:21 +00:00
parent 06c1b466be
commit c34b060b2f
4 changed files with 53 additions and 6 deletions

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -127,6 +127,7 @@
<file>images/mac/hide.png</file>
<file>images/mac/show.png</file>
<file>images/mac/sidebar.png</file>
<file>images/mac/lowbar.png</file>
<file>images/mac/left.png</file>
<file>images/mac/right.png</file>
<file>images/analysis.png</file>