Commit aa2a9714 authored by Lorenz Meier's avatar Lorenz Meier

Rearranged action bar, saved screen state

parent 898eddc8
...@@ -11,14 +11,14 @@ ...@@ -11,14 +11,14 @@
#define WITH_TEXT_TO_SPEECH 1 #define WITH_TEXT_TO_SPEECH 1
#define QGC_APPLICATION_NAME "QGroundControl" #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 namespace QGC
{ {
const QString APPNAME = "QGROUNDCONTROL"; const QString APPNAME = "QGROUNDCONTROL";
const QString COMPANYNAME = "QGROUNDCONTROL"; const QString COMPANYNAME = "QGROUNDCONTROL";
const int APPLICATIONVERSION = 106; // 1.0.6 const int APPLICATIONVERSION = 107; // 1.0.7
} }
#endif // QGC_CONFIGURATION_H #endif // QGC_CONFIGURATION_H
...@@ -161,17 +161,21 @@ MainWindow::MainWindow(QWidget *parent): ...@@ -161,17 +161,21 @@ MainWindow::MainWindow(QWidget *parent):
// Load Toolbar // Load Toolbar
toolBar = new QGCToolBar(this); toolBar = new QGCToolBar(this);
this->addToolBar(toolBar); this->addToolBar(toolBar);
// Add actions (inverted order due to insert)
// Add actions for average users (displayed next to each other)
QList<QAction*> actions; QList<QAction*> actions;
actions << ui.actionMissionView; actions << ui.actionMissionView;
actions << ui.actionFlightView; actions << ui.actionFlightView;
actions << ui.actionEngineersView;
actions << ui.actionSimulation_View;
actions << ui.actionConfiguration_2; actions << ui.actionConfiguration_2;
toolBar->setPerspectiveChangeActions(actions); toolBar->setPerspectiveChangeActions(actions);
// Add actions for advanced users (displayed in dropdown under "advanced")
QList<QAction*> advancedActions;
advancedActions << ui.actionSimulation_View;
advancedActions << ui.actionEngineersView;
toolBar->setPerspectiveChangeAdvancedActions(advancedActions);
customStatusBar = new QGCStatusBar(this); customStatusBar = new QGCStatusBar(this);
setStatusBar(customStatusBar); setStatusBar(customStatusBar);
statusBar()->setSizeGripEnabled(true); statusBar()->setSizeGripEnabled(true);
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>21</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuMGround"> <widget class="QMenu" name="menuMGround">
...@@ -480,7 +480,10 @@ ...@@ -480,7 +480,10 @@
<normaloff>:/files/images/categories/preferences-system.svg</normaloff>:/files/images/categories/preferences-system.svg</iconset> <normaloff>:/files/images/categories/preferences-system.svg</normaloff>:/files/images/categories/preferences-system.svg</iconset>
</property> </property>
<property name="text"> <property name="text">
<string>Configuration</string> <string>Config</string>
</property>
<property name="toolTip">
<string>Configuration options of the vehicle.</string>
</property> </property>
</action> </action>
<action name="actionAdvanced_Mode"> <action name="actionAdvanced_Mode">
......
...@@ -186,7 +186,7 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions) ...@@ -186,7 +186,7 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
{ {
if (actions.count() > 1) if (actions.count() > 1)
{ {
QButtonGroup* group = new QButtonGroup(this); group = new QButtonGroup(this);
group->setExclusive(true); group->setExclusive(true);
QToolButton *first = new QToolButton(this); QToolButton *first = new QToolButton(this);
...@@ -197,11 +197,11 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions) ...@@ -197,11 +197,11 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
first->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); first->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
first->setCheckable(true); first->setCheckable(true);
connect(first, SIGNAL(clicked(bool)), actions.first(), SIGNAL(triggered(bool))); 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); addWidget(first);
group->addButton(first); group->addButton(first);
for (int i = 1; i < actions.count() - 1; i++) for (int i = 1; i < actions.count(); i++)
{ {
// Add last button // Add last button
QToolButton *btn = new QToolButton(this); QToolButton *btn = new QToolButton(this);
...@@ -212,23 +212,22 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions) ...@@ -212,23 +212,22 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); btn->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
btn->setCheckable(true); btn->setCheckable(true);
connect(btn, SIGNAL(clicked(bool)), actions.at(i), SIGNAL(triggered(bool))); 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); addWidget(btn);
group->addButton(btn); group->addButton(btn);
} }
// Add last button // Add last button
QToolButton *last = new QToolButton(this); advancedButton = new QPushButton(this);
// Add first button // Add first button
last->setIcon(actions.last()->icon()); advancedButton->setIcon(QIcon(":/files/images/apps/utilities-system-monitor.svg"));
last->setText(actions.last()->text()); advancedButton->setText(tr("Pro"));
last->setToolTip(actions.last()->toolTip()); advancedButton->setToolTip(tr("Options for advanced users"));
last->setCheckable(true); advancedButton->setCheckable(true);
connect(last, SIGNAL(clicked(bool)), actions.last(), SIGNAL(triggered(bool))); // advancedButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
last->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; }");
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(advancedButton);
addWidget(last); group->addButton(advancedButton);
group->addButton(last);
} else { } else {
qDebug() << __FILE__ << __LINE__ << "Not enough perspective change actions provided"; qDebug() << __FILE__ << __LINE__ << "Not enough perspective change actions provided";
} }
...@@ -237,6 +236,27 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions) ...@@ -237,6 +236,27 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
createUI(); createUI();
} }
void QGCToolBar::setPerspectiveChangeAdvancedActions(const QList<QAction*> &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) void QGCToolBar::setActiveUAS(UASInterface* active)
{ {
// Do nothing if system is the same or NULL // Do nothing if system is the same or NULL
......
...@@ -40,6 +40,7 @@ class QGCToolBar : public QToolBar ...@@ -40,6 +40,7 @@ class QGCToolBar : public QToolBar
public: public:
explicit QGCToolBar(QWidget* parent = 0); explicit QGCToolBar(QWidget* parent = 0);
void setPerspectiveChangeActions(const QList<QAction*> &action); void setPerspectiveChangeActions(const QList<QAction*> &action);
void setPerspectiveChangeAdvancedActions(const QList<QAction*> &action);
~QGCToolBar(); ~QGCToolBar();
public slots: public slots:
...@@ -112,6 +113,8 @@ protected: ...@@ -112,6 +113,8 @@ protected:
bool systemArmed; bool systemArmed;
LinkInterface* currentLink; LinkInterface* currentLink;
QAction* firstAction; QAction* firstAction;
QPushButton *advancedButton;
QButtonGroup *group;
}; };
#endif // QGCTOOLBAR_H #endif // QGCTOOLBAR_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment