Commit aa2a9714 authored by Lorenz Meier's avatar Lorenz Meier

Rearranged action bar, saved screen state

parent 898eddc8
......@@ -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
......@@ -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<QAction*> 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<QAction*> advancedActions;
advancedActions << ui.actionSimulation_View;
advancedActions << ui.actionEngineersView;
toolBar->setPerspectiveChangeAdvancedActions(advancedActions);
customStatusBar = new QGCStatusBar(this);
setStatusBar(customStatusBar);
statusBar()->setSizeGripEnabled(true);
......
......@@ -51,7 +51,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
<height>22</height>
</rect>
</property>
<widget class="QMenu" name="menuMGround">
......@@ -480,7 +480,10 @@
<normaloff>:/files/images/categories/preferences-system.svg</normaloff>:/files/images/categories/preferences-system.svg</iconset>
</property>
<property name="text">
<string>Configuration</string>
<string>Config</string>
</property>
<property name="toolTip">
<string>Configuration options of the vehicle.</string>
</property>
</action>
<action name="actionAdvanced_Mode">
......
......@@ -186,7 +186,7 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &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<QAction*> &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<QAction*> &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<QAction*> &actions)
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)
{
// Do nothing if system is the same or NULL
......
......@@ -40,6 +40,7 @@ class QGCToolBar : public QToolBar
public:
explicit QGCToolBar(QWidget* parent = 0);
void setPerspectiveChangeActions(const QList<QAction*> &action);
void setPerspectiveChangeAdvancedActions(const QList<QAction*> &action);
~QGCToolBar();
public slots:
......@@ -112,6 +113,8 @@ protected:
bool systemArmed;
LinkInterface* currentLink;
QAction* firstAction;
QPushButton *advancedButton;
QButtonGroup *group;
};
#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