Commit ff66b8cd authored by Bryant's avatar Bryant

Started moving the QGCToolBar over to a .ui file.

parent 5bd50690
...@@ -265,6 +265,22 @@ QPushButton:pressed#killButton { ...@@ -265,6 +265,22 @@ QPushButton:pressed#killButton {
border-radius: 5px; border-radius: 5px;
} }
QPushButton#connectButton {
min-height: 20px;
color: #222222;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5AAA49, stop: 1 #106B38);
margin-left: 4px;
margin-right: 4px;
border-radius: 4px;
border: 1px solid #085B35;
}
QPushButton:checked#connectButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #FFD450);
color: #222222;
border-color: #D1892A;
}
QScrollBar { QScrollBar {
border: 1px solid #333; border: 1px solid #333;
} }
......
...@@ -226,7 +226,8 @@ FORMS += src/ui/MainWindow.ui \ ...@@ -226,7 +226,8 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QGCHilXPlaneConfiguration.ui \ src/ui/QGCHilXPlaneConfiguration.ui \
src/ui/designer/QGCComboBox.ui \ src/ui/designer/QGCComboBox.ui \
src/ui/designer/QGCTextLabel.ui \ src/ui/designer/QGCTextLabel.ui \
src/ui/uas/UASQuickView.ui src/ui/uas/UASQuickView.ui \
src/ui/QGCToolBar.ui
INCLUDEPATH += src \ INCLUDEPATH += src \
src/ui \ src/ui \
src/ui/linechart \ src/ui/linechart \
......
...@@ -25,6 +25,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -25,6 +25,7 @@ This file is part of the QGROUNDCONTROL project
#include <QLabel> #include <QLabel>
#include <QSpacerItem> #include <QSpacerItem>
#include "QGCToolBar.h" #include "QGCToolBar.h"
#include "ui_QGCToolBar.h"
#include "UASManager.h" #include "UASManager.h"
#include "MainWindow.h" #include "MainWindow.h"
...@@ -39,9 +40,9 @@ QGCToolBar::QGCToolBar(QWidget *parent) : ...@@ -39,9 +40,9 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
wpDistance(0), wpDistance(0),
systemArmed(false), systemArmed(false),
currentLink(NULL), currentLink(NULL),
firstAction(NULL) firstAction(NULL),
m_ui(new Ui::QGCToolBar)
{ {
setObjectName("QGC_TOOLBAR");
// Do not load UI, wait for actions // Do not load UI, wait for actions
} }
...@@ -85,83 +86,7 @@ void QGCToolBar::heartbeatTimeout(bool timeout, unsigned int ms) ...@@ -85,83 +86,7 @@ void QGCToolBar::heartbeatTimeout(bool timeout, unsigned int ms)
void QGCToolBar::createUI() void QGCToolBar::createUI()
{ {
// CREATE TOOLBAR ITEMS m_ui->setupUi(this);
// Add internal actions
// Add MAV widget
symbolButton = new QToolButton(this);
symbolButton->setStyleSheet("QWidget { margin-left: 10px; background-color: #050508; color: #DDDDDF; background-clip: border; }");
addWidget(symbolButton);
toolBarNameLabel = new QLabel("------", this);
toolBarNameLabel->setToolTip(tr("Currently controlled vehicle"));
toolBarNameLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarNameLabel);
toolBarTimeoutLabel = new QLabel("UNCONNECTED", this);
toolBarTimeoutLabel->setToolTip(tr("System timed out, interval since last message"));
toolBarTimeoutLabel->setStyleSheet(QString("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: %1; background-color: %2; border-radius: 4px;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name()));
toolBarTimeoutLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarTimeoutLabel);
toolBarSafetyLabel = new QLabel("SAFE", this);
toolBarSafetyLabel->setStyleSheet("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: #14C814; }");
toolBarSafetyLabel->setToolTip(tr("Vehicle safety state"));
toolBarSafetyLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarSafetyLabel);
toolBarModeLabel = new QLabel("------", this);
toolBarModeLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 14px; color: #ACEBFE; }");
toolBarModeLabel->setToolTip(tr("Vehicle mode"));
toolBarModeLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarModeLabel);
toolBarStateLabel = new QLabel("------", this);
toolBarStateLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 14px; color: #FEC654; }");
toolBarStateLabel->setToolTip(tr("Vehicle state"));
toolBarStateLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarStateLabel);
toolBarBatteryBar = new QProgressBar(this);
toolBarBatteryBar->setMinimum(0);
toolBarBatteryBar->setMaximum(100);
toolBarBatteryBar->setMinimumWidth(20);
toolBarBatteryBar->setMaximumWidth(100);
toolBarBatteryBar->setValue(0);
toolBarBatteryBar->setToolTip(tr("Battery charge level"));
addWidget(toolBarBatteryBar);
toolBarBatteryVoltageLabel = new QLabel("xx.x V");
toolBarBatteryVoltageLabel->setStyleSheet(QString("QLabel { margin: 0px 0px 0px 4px; font: 14px; color: %1; }").arg(QColor(Qt::green).name()));
toolBarBatteryVoltageLabel->setToolTip(tr("Battery voltage"));
toolBarBatteryVoltageLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarBatteryVoltageLabel);
toolBarWpLabel = new QLabel("WP--", this);
toolBarWpLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 18px; color: #ACEBFE; }");
toolBarWpLabel->setToolTip(tr("Current waypoint"));
toolBarWpLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarWpLabel);
toolBarDistLabel = new QLabel("--- ---- m", this);
toolBarDistLabel->setToolTip(tr("Distance to current waypoint"));
toolBarDistLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarDistLabel);
toolBarMessageLabel = new QLabel("", this);
toolBarMessageLabel->setStyleSheet("QLabel { margin: 3px 2px; font: 14px; color: #ACEBFE; }");
toolBarMessageLabel->setToolTip(tr("Most recent system message"));
addWidget(toolBarMessageLabel);
QWidget* spacer = new QWidget();
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
spacer->setStyleSheet("* { margin: 0px; background-color: transparent; min-height: 24px}");
addWidget(spacer);
connectButton = new QPushButton(tr("Connect"), this);
connectButton->setToolTip(tr("Connect wireless link to MAV"));
connectButton->setCheckable(true);
connectButton->setStyleSheet("QPushButton {min-height: 20px; color: #222222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #5AAA49, stop: 1 #106B38); margin-left: 4px; margin-right: 4px; border-radius: 4px; border: 1px solid #085B35; } QPushButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #FFD450); color: #222222; border-color: #D1892A}");
addWidget(connectButton);
connect(connectButton, SIGNAL(clicked(bool)), this, SLOT(connectLink(bool))); connect(connectButton, SIGNAL(clicked(bool)), this, SLOT(connectLink(bool)));
// DONE INITIALIZING BUTTONS // DONE INITIALIZING BUTTONS
...@@ -240,7 +165,7 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions) ...@@ -240,7 +165,7 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
qDebug() << __FILE__ << __LINE__ << "Not enough perspective change actions provided"; qDebug() << __FILE__ << __LINE__ << "Not enough perspective change actions provided";
} }
// Add the "rest" // Add the rest
createUI(); createUI();
} }
......
...@@ -32,6 +32,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -32,6 +32,7 @@ This file is part of the QGROUNDCONTROL project
#include <QProgressBar> #include <QProgressBar>
#include "UASInterface.h" #include "UASInterface.h"
#include "QGCMAVLinkLogPlayer.h" #include "QGCMAVLinkLogPlayer.h"
#include "ui_QGCToolBar.h"
class QGCToolBar : public QToolBar class QGCToolBar : public QToolBar
{ {
...@@ -121,6 +122,8 @@ protected: ...@@ -121,6 +122,8 @@ protected:
QAction* firstAction; QAction* firstAction;
QPushButton *advancedButton; QPushButton *advancedButton;
QButtonGroup *group; QButtonGroup *group;
private:
Ui::QGCToolBar *m_ui;
}; };
#endif // QGCTOOLBAR_H #endif // QGCTOOLBAR_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCToolBar</class>
<widget class="QWidget" name="QGCToolBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>640</width>
<height>66</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="symbolLabel">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../qgroundcontrol.qrc">:/files/images/mavs/unknown.svg</pixmap>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarNameLabel">
<property name="toolTip">
<string>Currently controlled vehicle</string>
</property>
<property name="text">
<string>------</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarSafetyLabel">
<property name="toolTip">
<string>Vehicle safety state</string>
</property>
<property name="text">
<string>SAFE</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarTimeoutLabel">
<property name="toolTip">
<string>System timed out, interval since last message</string>
</property>
<property name="text">
<string>UNCONNECTED</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarModeLabel">
<property name="toolTip">
<string>Vehicle mode</string>
</property>
<property name="text">
<string>------</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarStateLabel">
<property name="toolTip">
<string>Vehicle state</string>
</property>
<property name="text">
<string>------</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="toolBarBatteryBar">
<property name="toolTip">
<string>Battery charge level</string>
</property>
<property name="value">
<number>24</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarBatteryVoltageLabel">
<property name="toolTip">
<string>Battery voltage</string>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>xx.x V</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarStateLabel_2">
<property name="toolTip">
<string>Most recent system message</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarWpLabel">
<property name="toolTip">
<string>Current waypoint</string>
</property>
<property name="text">
<string>WP--</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarDistLabel">
<property name="toolTip">
<string>Distance to current waypoint</string>
</property>
<property name="text">
<string>-- ---- m</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="toolBarMessageLabel">
<property name="toolTip">
<string>Most recent system message</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>24</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="connectButton">
<property name="toolTip">
<string>Connect wireless link to MAV</string>
</property>
<property name="text">
<string>Connect</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../../qgroundcontrol.qrc"/>
</resources>
<connections/>
</ui>
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