From aa2a971426fc62e6c087924e0b5eb23a590f93ec Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Fri, 10 May 2013 18:20:13 +0200 Subject: [PATCH] Rearranged action bar, saved screen state --- src/configuration.h | 4 ++-- src/ui/MainWindow.cc | 12 +++++++---- src/ui/MainWindow.ui | 7 +++++-- src/ui/QGCToolBar.cc | 48 +++++++++++++++++++++++++++++++------------- src/ui/QGCToolBar.h | 3 +++ 5 files changed, 52 insertions(+), 22 deletions(-) diff --git a/src/configuration.h b/src/configuration.h index cddf6cc43..21ee4e375 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -11,14 +11,14 @@ #define WITH_TEXT_TO_SPEECH 1 #define QGC_APPLICATION_NAME "QGroundControl" -#define QGC_APPLICATION_VERSION "v. 1.0.6 (beta)" +#define QGC_APPLICATION_VERSION "v. 1.0.7 (beta)" namespace QGC { const QString APPNAME = "QGROUNDCONTROL"; const QString COMPANYNAME = "QGROUNDCONTROL"; -const int APPLICATIONVERSION = 106; // 1.0.6 +const int APPLICATIONVERSION = 107; // 1.0.7 } #endif // QGC_CONFIGURATION_H diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index d0753f1f8..ae7c673e6 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -161,17 +161,21 @@ MainWindow::MainWindow(QWidget *parent): // Load Toolbar toolBar = new QGCToolBar(this); this->addToolBar(toolBar); - // Add actions (inverted order due to insert) + // Add actions for average users (displayed next to each other) QList actions; - actions << ui.actionMissionView; actions << ui.actionFlightView; - actions << ui.actionEngineersView; - actions << ui.actionSimulation_View; actions << ui.actionConfiguration_2; toolBar->setPerspectiveChangeActions(actions); + // Add actions for advanced users (displayed in dropdown under "advanced") + QList advancedActions; + advancedActions << ui.actionSimulation_View; + advancedActions << ui.actionEngineersView; + + toolBar->setPerspectiveChangeAdvancedActions(advancedActions); + customStatusBar = new QGCStatusBar(this); setStatusBar(customStatusBar); statusBar()->setSizeGripEnabled(true); diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index 96b8aa259..0a238b786 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -51,7 +51,7 @@ 0 0 800 - 21 + 22 @@ -480,7 +480,10 @@ :/files/images/categories/preferences-system.svg:/files/images/categories/preferences-system.svg - Configuration + Config + + + Configuration options of the vehicle. diff --git a/src/ui/QGCToolBar.cc b/src/ui/QGCToolBar.cc index 37932647e..1348ed8ce 100644 --- a/src/ui/QGCToolBar.cc +++ b/src/ui/QGCToolBar.cc @@ -186,7 +186,7 @@ void QGCToolBar::setPerspectiveChangeActions(const QList &actions) { if (actions.count() > 1) { - QButtonGroup* group = new QButtonGroup(this); + group = new QButtonGroup(this); group->setExclusive(true); QToolButton *first = new QToolButton(this); @@ -197,11 +197,11 @@ void QGCToolBar::setPerspectiveChangeActions(const QList &actions) first->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); first->setCheckable(true); connect(first, SIGNAL(clicked(bool)), actions.first(), SIGNAL(triggered(bool))); - first->setStyleSheet("QToolButton { min-width: 70px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 8px; margin-right: 0px; border-radius: 0px; border : 0px solid blue; border-bottom-left-radius: 6px; border-top-left-radius: 6px; border-left: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); + first->setStyleSheet("QToolButton { min-width: 60px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 8px; margin-right: 0px; border-radius: 0px; border : 0px solid blue; border-bottom-left-radius: 6px; border-top-left-radius: 6px; border-left: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); addWidget(first); group->addButton(first); - for (int i = 1; i < actions.count() - 1; i++) + for (int i = 1; i < actions.count(); i++) { // Add last button QToolButton *btn = new QToolButton(this); @@ -212,23 +212,22 @@ void QGCToolBar::setPerspectiveChangeActions(const QList &actions) btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); btn->setCheckable(true); connect(btn, SIGNAL(clicked(bool)), actions.at(i), SIGNAL(triggered(bool))); - btn->setStyleSheet("QToolButton { min-width: 70px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: -2px; margin-right: -2px; padding-left: 0px; padding-right: 0px; border-radius: 0px; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); + btn->setStyleSheet("QToolButton { min-width: 60px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: -2px; margin-right: -2px; padding-left: 0px; padding-right: 0px; border-radius: 0px; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); addWidget(btn); group->addButton(btn); } // Add last button - QToolButton *last = new QToolButton(this); + advancedButton = new QPushButton(this); // Add first button - last->setIcon(actions.last()->icon()); - last->setText(actions.last()->text()); - last->setToolTip(actions.last()->toolTip()); - last->setCheckable(true); - connect(last, SIGNAL(clicked(bool)), actions.last(), SIGNAL(triggered(bool))); - last->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); - last->setStyleSheet("QToolButton { min-width: 70px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 0px; margin-right: 8px; padding-left: 0px; padding-right: 0px; border-radius: 0px; border : 0px solid blue; border-bottom-right-radius: 6px; border-top-right-radius: 6px; border-right: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); - addWidget(last); - group->addButton(last); + advancedButton->setIcon(QIcon(":/files/images/apps/utilities-system-monitor.svg")); + advancedButton->setText(tr("Pro")); + advancedButton->setToolTip(tr("Options for advanced users")); + advancedButton->setCheckable(true); +// advancedButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); + advancedButton->setStyleSheet("QPushButton { min-width: 60px; font-weight: bold; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 0px; margin-right: 13px; padding-left: 0px; padding-right: 8px; border-radius: 0px; border : 0px solid blue; border-bottom-right-radius: 6px; border-top-right-radius: 6px; border-right: 1px solid #484848; border-top: 1px solid #484848; border-bottom: 1px solid #484848; } QPushButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); + addWidget(advancedButton); + group->addButton(advancedButton); } else { qDebug() << __FILE__ << __LINE__ << "Not enough perspective change actions provided"; } @@ -237,6 +236,27 @@ void QGCToolBar::setPerspectiveChangeActions(const QList &actions) createUI(); } +void QGCToolBar::setPerspectiveChangeAdvancedActions(const QList &actions) +{ + if (actions.count() > 1) + { + QMenu *menu = new QMenu(advancedButton); + + for (int i = 0; i < actions.count(); i++) + { + + menu->addAction(actions.at(i)); + } + + menu->setStyleSheet("QMenu { font-weight: bold; min-width: 70px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); border: 1px solid #484848; } QMenu:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDDDDD; }"); + + advancedButton->setMenu(menu); + + } else { + qDebug() << __FILE__ << __LINE__ << "Not enough perspective change actions provided"; + } +} + void QGCToolBar::setActiveUAS(UASInterface* active) { // Do nothing if system is the same or NULL diff --git a/src/ui/QGCToolBar.h b/src/ui/QGCToolBar.h index 5a76f3f0f..a21f0c3cc 100644 --- a/src/ui/QGCToolBar.h +++ b/src/ui/QGCToolBar.h @@ -40,6 +40,7 @@ class QGCToolBar : public QToolBar public: explicit QGCToolBar(QWidget* parent = 0); void setPerspectiveChangeActions(const QList &action); + void setPerspectiveChangeAdvancedActions(const QList &action); ~QGCToolBar(); public slots: @@ -112,6 +113,8 @@ protected: bool systemArmed; LinkInterface* currentLink; QAction* firstAction; + QPushButton *advancedButton; + QButtonGroup *group; }; #endif // QGCTOOLBAR_H -- 2.22.0