Commit bf112ef0 authored by Bryant's avatar Bryant

The toolbar now displays much nicer under the light theme. Also colorized the...

The toolbar now displays much nicer under the light theme. Also colorized the connect/disconnect & delete buttons in the communications settings window.
parent 652fce85
......@@ -70,6 +70,47 @@ QDockWidget::title {
height: 14px;
}
QGCToolBar QLabel {
font-size: 10pt;
margin: 3px 2px;
}
QGCToolBar QLabel#symbolLabel {
background-clip: content;
}
QGCToolBar QToolButton#firstAction {
margin-left: 8px;
border-bottom-left-radius: 6px;
border-top-left-radius: 6px;
border-right: none;
}
QGCToolBar QToolButton {
margin: 0;
padding-left: 0;
padding-right: 0;
border-radius: 0;
text-align: left;
}
/* background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFb917, stop:1 #B37300);*/
QGCToolBar QToolButton#advancedButton {
margin-left: 0;
margin-right: 13px;
padding-left: 4px;
padding-right: 8px;
border-radius: 0;
border-bottom-right-radius: 6px;
border-top-right-radius: 6px;
border-left: none;
}
QGCToolBar .QWidget {
margin: 0;
background-color: transparent;
}
QGCToolWidgetItem {
border: 1px solid #666;
border-radius: 3px;
......
......@@ -70,8 +70,55 @@ QDockWidget::title {
height: 14px;
}
QGCToolBar {
min-height: 60px;
QGCToolBar QLabel {
font-size: 10pt;
margin: 3px 2px;
}
QGCToolBar QLabel#symbolLabel {
background-clip: content;
}
QGCToolBar QLabel#toolBarBatteryBar {
color: #008000;
}
QGCToolBar QLabel#toolBarTimeoutLabel {
border-radius: 4px;
padding: 0;
color: #000;
background-color: #FF0037;
}
QGCToolBar QToolButton#firstAction {
margin-left: 8px;
border-bottom-left-radius: 6px;
border-top-left-radius: 6px;
border-right: none;
}
QGCToolBar QToolButton {
margin: 0;
padding-left: 0;
padding-right: 0;
border-radius: 0;
text-align: left;
}
QGCToolBar QToolButton#advancedButton {
margin-left: 0;
margin-right: 13px;
padding-left: 4px;
padding-right: 8px;
border-radius: 0;
border-bottom-right-radius: 6px;
border-top-right-radius: 6px;
border-left: none;
}
QGCToolBar .QWidget {
margin: 0;
background-color: transparent;
}
QGCToolWidgetItem {
......@@ -149,7 +196,11 @@ QMenu {
}
QMenu::item:selected {
background-color: #000;
background-color: #CCC;
}
QMenu::item:checked {
background-color: #B8D3E6;
}
QMenu::separator {
......@@ -158,6 +209,11 @@ QMenu::separator {
margin: 8px 5px 4px 5px;
}
QMenu::icon, QMenu::icon:selected, QMenu::icon:disabled, QMenu::icon:checked {
background: #F00;
border: none;
}
QMenuBar::item:selected {
background-color: #CCC;
}
......@@ -213,7 +269,7 @@ QPushButton, QToolButton {
max-height: 20px;
border: 1px solid #465158;
margin: 1px;
border-radius: 2px;
border-radius: 4px;
padding-left: 8px;
padding-right: 8px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #BBB, stop: 1 #777);
......@@ -239,16 +295,31 @@ QPushButton#killButton {
border-radius: 5px;
}
QPushButton#connectButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #73D95D, stop: 1 #18A154);
}
QPushButton#deleteButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF0037, stop: 1 #AC0025);
}
QPushButton:checked, QToolButton:checked {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #444, stop: 1 #888);
color: #FFF;
}
QPushButton:checked#connectButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #B37300);
color: #000;
}
QPushButton:checked#controlButton {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #b76f11, stop: 1 #e1a718);
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #09A2B2, stop: 1 #414B52);
}
QPushButton:disabled, QToolButton:disabled {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEE, stop: 1 #CCC);
color: #AAA;
}
QPushButton:hover, QToolButton:hover {
......@@ -269,22 +340,6 @@ QPushButton:pressed#killButton {
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 {
border: 1px solid #333;
}
......@@ -412,43 +467,6 @@ QToolBar {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #CCC, stop: 1 #888);
}
QToolButton#symbolButton {
margin-left: 10px;
background-color: #050508;
color: #DDD;
background-clip: border;
}
QLabel#toolBarTimeoutLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px;
border-radius: 4px;
}
QLabel#toolBarBatteryVoltageLabel {
margin: 0 0 0 4px; font: 14px;
}
QLabel#toolBarWpLabel { margin: 3px 2px; font: 18px; color: #ACEBFE; }
QLabel#toolBarMessageLabel { margin: 3px 2px; font: 14px; color: #ACEBFE; }
QPushButton#connectButton {min-height: 20px; color: #222; 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: #222; border-color: #D1892A}
QLabel#toolBarSafetyLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: #14C814; }
QLabel#toolBarModeLabel { margin: 3px 2px; font: 14px; color: #ACEBFE; }
QLabel#toolBarStateLabel { margin: 3px 2px; font: 14px; color: #FEC654; }
QToolButton#firstAction { min-width: 60px; color: #222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); margin-left: 8px; margin-right: 0px; padding-left: 4px; padding-right: 8px; 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#firstAction { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDD; }
QGCToolBar QToolButton { min-width: 60px; color: #222; 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; }
QGCToolBar QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDD; }
QPushButton#advancedButton { min-width: 60px; font-weight: bold; text-align: left; color: #222; 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: 4px; 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#advancedButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDD; }
QGCToolBar QMenu { font-weight: bold; min-width: 70px; color: #222; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #A2A3A4, stop: 1 #B6B7B8); border: 1px solid #484848; }
QGCToolBar QMenu::item:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #555555, stop: 1 #787878); color: #DDD; }
QGCToolBar .QWidget {
margin: 0px;
background-color: transparent;
min-height: 24px;
background-color: #F00;
}
QToolTip {
background-color: #F6F6F6;
border:0 solid #379AC3;
......
......@@ -14,7 +14,16 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2" rowstretch="1,1,1,100,100,1">
<property name="margin">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<item row="0" column="0">
......@@ -84,7 +93,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......@@ -97,8 +115,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>393</width>
<height>76</height>
<width>391</width>
<height>85</height>
</rect>
</property>
</widget>
......@@ -116,7 +134,16 @@
<property name="spacing">
<number>0</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
......@@ -129,8 +156,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>393</width>
<height>76</height>
<width>391</width>
<height>84</height>
</rect>
</property>
</widget>
......@@ -166,7 +193,7 @@
<string>Connect</string>
</property>
<property name="checkable">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>
......
......@@ -64,11 +64,11 @@ void QGCToolBar::heartbeatTimeout(bool timeout, unsigned int ms)
// Alternate colors to increase visibility
if ((ms / 1000) % 2 == 0)
{
toolBarTimeoutLabel->setStyleSheet(QString("QLabel {color: %1; background-color: %2;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name()));
toolBarTimeoutLabel->setStyleSheet(QString("QLabel {color: #000; background-color: #FF0037;}"));
}
else
{
toolBarTimeoutLabel->setStyleSheet(QString("QLabel {color: %1; background-color: %2;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.dark(250).name()));
toolBarTimeoutLabel->setStyleSheet(QString("QLabel {color: #FFF; background-color: #6B0017;}"));
}
toolBarTimeoutLabel->setText(tr("CONNECTION LOST: %1 s").arg((ms / 1000.0f), 2, 'f', 1, ' '));
}
......@@ -98,8 +98,8 @@ void QGCToolBar::createUI()
toolBarTimeoutLabel = new QLabel("UNCONNECTED", this);
toolBarTimeoutLabel->setToolTip(tr("System timed out, interval since last message"));
toolBarTimeoutLabel->setStyleSheet(QString("QLabel {color: %1; background-color: %2;}").arg(QGC::colorDarkWhite.name()).arg(QGC::colorMagenta.name()));
toolBarTimeoutLabel->setAlignment(Qt::AlignCenter);
toolBarTimeoutLabel->setObjectName("toolBarTimeoutLabel");
addWidget(toolBarTimeoutLabel);
toolBarSafetyLabel = new QLabel("SAFE", this);
......@@ -128,7 +128,7 @@ void QGCToolBar::createUI()
addWidget(toolBarBatteryBar);
toolBarBatteryVoltageLabel = new QLabel("xx.x V");
toolBarBatteryVoltageLabel->setStyleSheet(QString("QLabel {color: %1; }").arg(QColor(Qt::green).name()));
toolBarBatteryVoltageLabel->setObjectName("toolBarBatteryVoltageLabel");
toolBarBatteryVoltageLabel->setToolTip(tr("Battery voltage"));
toolBarBatteryVoltageLabel->setAlignment(Qt::AlignCenter);
addWidget(toolBarBatteryVoltageLabel);
......@@ -152,6 +152,7 @@ void QGCToolBar::createUI()
addWidget(spacer);
connectButton = new QPushButton(tr("Connect"), this);
connectButton->setObjectName("connectButton");
connectButton->setToolTip(tr("Connect wireless link to MAV"));
connectButton->setCheckable(true);
addWidget(connectButton);
......@@ -189,8 +190,8 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
group = new QButtonGroup(this);
group->setExclusive(true);
// Add the first button.
QToolButton *first = new QToolButton(this);
// Add first button
first->setIcon(actions.first()->icon());
first->setText(actions.first()->text());
first->setToolTip(actions.first()->toolTip());
......@@ -202,11 +203,10 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
addWidget(first);
group->addButton(first);
// Add all the middle buttons.
for (int i = 1; i < actions.count(); i++)
{
// Add last button
QToolButton *btn = new QToolButton(this);
// Add first button
btn->setIcon(actions.at(i)->icon());
btn->setText(actions.at(i)->text());
btn->setToolTip(actions.at(i)->toolTip());
......@@ -219,13 +219,13 @@ void QGCToolBar::setPerspectiveChangeActions(const QList<QAction*> &actions)
}
// Add last button
advancedButton = new QPushButton(this);
// Add first button
advancedButton = new QToolButton(this);
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->setObjectName("advancedButton");
advancedButton->setPopupMode(QToolButton::InstantPopup);
addWidget(advancedButton);
group->addButton(advancedButton);
} else {
......@@ -307,11 +307,10 @@ void QGCToolBar::setActiveUAS(UASInterface* active)
systemName = mav->getUASName();
systemArmed = mav->isArmed();
toolBarNameLabel->setText(mav->getUASName());
toolBarNameLabel->setStyleSheet(QString("QLabel { font: bold 16px; color: %1; }").arg(mav->getColor().name()));
symbolLabel->setStyleSheet(QString("QWidget { background-color: %1; color: #DDDDDF; background-clip: border; } QToolButton { font-weight: bold; font-size: 14px; border: 0px solid #484848; border-radius: 5px; min-width:22px; max-width: 22px; min-height: 22px; max-height: 22px; padding: 0px; margin: 0px 4px 0px 20px; background-color: none; }").arg(mav->getColor().name()));
toolBarNameLabel->setStyleSheet(QString("QLabel {color: %1;}").arg(mav->getColor().name()));
symbolLabel->setStyleSheet(QString("QWidget {background-color: %1;}").arg(mav->getColor().name()));
toolBarModeLabel->setText(mav->getShortMode());
toolBarStateLabel->setText(mav->getShortState());
toolBarTimeoutLabel->setStyleSheet(QString(""));
toolBarTimeoutLabel->setText("");
toolBarDistLabel->setText("");
setSystemType(mav, mav->getSystemType());
......@@ -355,14 +354,15 @@ void QGCToolBar::updateView()
toolBarMessageLabel->setText(tr("%1").arg(""));
}
// Display the system armed state with a red-on-yellow background if armed or green text if safe.
if (systemArmed)
{
toolBarSafetyLabel->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::colorRed.name()).arg(QGC::colorYellow.name()));
toolBarSafetyLabel->setStyleSheet(QString("QLabel {color: %1; background-color: %2;}").arg(QGC::colorRed.name()).arg(QGC::colorYellow.name()));
toolBarSafetyLabel->setText(tr("ARMED"));
}
else
{
toolBarSafetyLabel->setStyleSheet("QLabel { margin: 3px 2px; padding: 2px; padding-left: 4px; padding-right: 4px; font: 14px; color: #14C814; }");
toolBarSafetyLabel->setStyleSheet("QLabel {color: #14C814;}");
toolBarSafetyLabel->setText(tr("SAFE"));
}
......@@ -429,66 +429,67 @@ void QGCToolBar::updateName(const QString& name)
void QGCToolBar::setSystemType(UASInterface* uas, unsigned int systemType)
{
Q_UNUSED(uas);
// Set matching icon
QPixmap newPixmap;
switch (systemType) {
case MAV_TYPE_GENERIC:
symbolLabel->setPixmap(QPixmap(":/files/images/mavs/generic.svg"));
newPixmap = QPixmap(":/files/images/mavs/generic.svg");
break;
case MAV_TYPE_FIXED_WING:
symbolLabel->setPixmap(QPixmap(":/files/images/mavs/fixed-wing.svg"));
newPixmap = QPixmap(":/files/images/mavs/fixed-wing.svg");
break;
case MAV_TYPE_QUADROTOR:
symbolLabel->setPixmap(QPixmap(":/files/images/mavs/quadrotor.svg"));
newPixmap = QPixmap(":/files/images/mavs/quadrotor.svg");
break;
case MAV_TYPE_COAXIAL:
symbolLabel->setPixmap(QPixmap(":/files/images/mavs/coaxial.svg"));
newPixmap = QPixmap(":/files/images/mavs/coaxial.svg");
break;
case MAV_TYPE_HELICOPTER:
symbolLabel->setPixmap(QPixmap(":/files/images/mavs/helicopter.svg"));
newPixmap = QPixmap(":/files/images/mavs/helicopter.svg");
break;
case MAV_TYPE_ANTENNA_TRACKER:
symbolLabel->setPixmap(QPixmap(":/files/images/mavs/antenna-tracker.svg"));
newPixmap = QPixmap(":/files/images/mavs/antenna-tracker.svg");
break;
case MAV_TYPE_GCS:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/groundstation.svg"));
newPixmap = QPixmap(":files/images/mavs/groundstation.svg");
break;
case MAV_TYPE_AIRSHIP:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/airship.svg"));
newPixmap = QPixmap(":files/images/mavs/airship.svg");
break;
case MAV_TYPE_FREE_BALLOON:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/free-balloon.svg"));
newPixmap = QPixmap(":files/images/mavs/free-balloon.svg");
break;
case MAV_TYPE_ROCKET:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/rocket.svg"));
newPixmap = QPixmap(":files/images/mavs/rocket.svg");
break;
case MAV_TYPE_GROUND_ROVER:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/ground-rover.svg"));
newPixmap = QPixmap(":files/images/mavs/ground-rover.svg");
break;
case MAV_TYPE_SURFACE_BOAT:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/surface-boat.svg"));
newPixmap = QPixmap(":files/images/mavs/surface-boat.svg");
break;
case MAV_TYPE_SUBMARINE:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/submarine.svg"));
newPixmap = QPixmap(":files/images/mavs/submarine.svg");
break;
case MAV_TYPE_HEXAROTOR:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/hexarotor.svg"));
newPixmap = QPixmap(":files/images/mavs/hexarotor.svg");
break;
case MAV_TYPE_OCTOROTOR:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/octorotor.svg"));
newPixmap = QPixmap(":files/images/mavs/octorotor.svg");
break;
case MAV_TYPE_TRICOPTER:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/tricopter.svg"));
newPixmap = QPixmap(":files/images/mavs/tricopter.svg");
break;
case MAV_TYPE_FLAPPING_WING:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/flapping-wing.svg"));
newPixmap = QPixmap(":files/images/mavs/flapping-wing.svg");
break;
case MAV_TYPE_KITE:
symbolLabel->setPixmap(QPixmap(":files/images/mavs/kite.svg"));
newPixmap = QPixmap(":files/images/mavs/kite.svg");
break;
default:
symbolLabel->setPixmap(QPixmap(":/files/images/mavs/unknown.svg"));
newPixmap = QPixmap(":/files/images/mavs/unknown.svg");
break;
}
symbolLabel->setPixmap(newPixmap.scaledToHeight(24));
}
void QGCToolBar::receiveTextMessage(int uasid, int componentid, int severity, QString text)
......
......@@ -119,7 +119,7 @@ protected:
bool systemArmed;
LinkInterface* currentLink;
QAction* firstAction;
QPushButton *advancedButton;
QToolButton *advancedButton;
QButtonGroup *group;
};
......
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