diff --git a/files/styles/style-dark.css b/files/styles/style-dark.css index e9dec34216411095d8e5395ace037083397c63b2..3534bd57ddfb4e26075abf7e6ca564944c565813 100644 --- a/files/styles/style-dark.css +++ b/files/styles/style-dark.css @@ -259,29 +259,27 @@ QPushButton#controlButton { min-height: 25px; } -QPushButton#deleteButton { +QPushButton#deleteButton, QPushButton#killButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D9002F, stop: 1 #AC0025); } -QPushButton#killButton { - font-weight: bold; - min-height: 30px; - color: #000; - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #ffb917, stop:1 #b37300); - background-clip: border; - border: 1px solid #555; - border-radius: 5px; -} - QPushButton:checked, QToolButton:checked { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #09A2B2, stop: 1 #414B52); } QPushButton:checked#connectButton, QPushButton:checked#controlButton { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #B37300); + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E38000, stop: 1 #945F00); color: #000; } +QPushButton:checked:hover#connectButton, QPushButton:checked:hover#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #B37300); +} + +QPushButton:checked:pressed#connectButton, QPushButton:checked:pressed#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DB7C00, stop: 1 #825400); +} + QPushButton:disabled, QToolButton:disabled { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #232228, stop: 1 #020208); } @@ -294,7 +292,7 @@ QPushButton:hover#connectButton, QPushButton:hover#controlButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #87FF6D, stop: 1 #1FD16D); } -QPushButton:hover#deleteButton { +QPushButton:hover#deleteButton, QPushButton#killButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F20034, stop: 1 #9E0022); } @@ -306,20 +304,10 @@ QPushButton:pressed#connectButton, QPushButton:pressed#controlButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #62B84E, stop: 1 #148A47); } -QPushButton:pressed#deleteButton { +QPushButton:pressed#deleteButton, QPushButton#killButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C9002C, stop: 1 #9C0021); } -QPushButton:pressed#killButton { - font-weight: bold; - min-height: 30px; - color: #000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #bb8500, stop:1 #903000); - background-clip: border; - border: 1px solid #555; - border-radius: 5px; -} - QScrollBar { border: 1px solid #333; } @@ -472,6 +460,25 @@ UASQuickViewItem QLabel#value { font-size: 20pt; } +UASView { + background: #444; + border: 1px solid #AAA; + border-radius: 12px; +} + +UASView QLabel#heartBeatLabel, UASView QLabel#typeLabel { + border: 1px solid #333; + border-radius: 5px; + padding: 2px; +} + +QGCUnconnectedInfoWidget QPushButton#connectButton { + min-height: 150px; + max-height: 275px; + margin: 15px; + padding: 20px; +} + WaypointEditableView, WaypointViewOnlyView { border: 1px solid #777; border-radius: 5px; diff --git a/files/styles/style-light.css b/files/styles/style-light.css index b5b1a8a8378590a76124902895dcd7d032ea1257..33ddbc5d0f1a35e19555903b3c43b36de81ee84d 100644 --- a/files/styles/style-light.css +++ b/files/styles/style-light.css @@ -258,30 +258,28 @@ QPushButton#controlButton { min-height: 25px; } -QPushButton#deleteButton { +QPushButton#deleteButton, QPushButton#killButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D9002F, stop: 1 #AC0025); } -QPushButton#killButton { - font-weight: bold; - min-height: 30px; - color: #000; - background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FFb917, stop: 1 #B37300); - background-clip: border; - border: 1px solid #555; - border-radius: 5px; -} - 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, QPushButton:checked#controlButton { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #B37300); + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E38000, stop: 1 #945F00); color: #000; } +QPushButton:checked:hover#connectButton, QPushButton:checked:hover#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #FF9000, stop: 1 #B37300); +} + +QPushButton:checked:pressed#connectButton, QPushButton:checked:pressed#controlButton { + background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #DB7C00, stop: 1 #825400); +} + QPushButton:disabled, QToolButton:disabled { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #EEE, stop: 1 #CCC); color: #AAA; @@ -295,7 +293,7 @@ QPushButton:hover#connectButton, QPushButton:hover#controlButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #87FF6D, stop: 1 #1FD16D); } -QPushButton:hover#deleteButton { +QPushButton:hover#deleteButton, QPushButton#killButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #F20034, stop: 1 #9E0022); } @@ -307,26 +305,16 @@ QPushButton:pressed#connectButton, QPushButton:pressed#controlButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #62B84E, stop: 1 #148A47); } -QPushButton:pressed#deleteButton { +QPushButton:pressed#deleteButton, QPushButton#killButton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #C9002C, stop: 1 #9C0021); } -QPushButton:pressed#killButton { - font-weight: bold; - min-height: 30px; - color: #000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #bb8500, stop:1 #903000); - background-clip: border; - border: 1px solid #555; - border-radius: 5px; -} - QScrollBar { border: 1px solid #333; } QSeparator { - color: #EEE; + color: #000; } QSlider { @@ -473,6 +461,25 @@ UASQuickViewItem QLabel#value { font-size: 20pt; } +UASView { + background: #D0D0D0; + border: 1px solid #666; + border-radius: 12px; +} + +UASView QLabel#heartBeatLabel, UASView QLabel#typeLabel { + border: 1px solid #333; + border-radius: 5px; + padding: 2px; +} + +QGCUnconnectedInfoWidget QPushButton#connectButton { + min-height: 150px; + max-height: 275px; + margin: 15px; + padding: 20px; +} + WaypointEditableView, WaypointViewOnlyView { border: 1px solid #333; border-radius: 5px; diff --git a/src/ui/UASList.ui b/src/ui/UASList.ui index d7976341b81957d9ab8f458b365f4f5087516058..6e85444fcbbf8cabe0796feea9fafa8a384b23c4 100644 --- a/src/ui/UASList.ui +++ b/src/ui/UASList.ui @@ -19,6 +19,14 @@ Form + + + 6 + + + 3 + + diff --git a/src/ui/UASView.ui b/src/ui/UASView.ui index 3c2269fdebe75f8f510cbfe2306f87c5e53f099d..d7f60ca109daf2c7cf0abb94adbfcacd200df90d 100644 --- a/src/ui/UASView.ui +++ b/src/ui/UASView.ui @@ -7,7 +7,7 @@ 0 0 360 - 121 + 155 @@ -32,859 +32,589 @@ Form - QWidget#colorIcon {} - -QWidget { -background-color: #050508; -color: #DDDDDF; -background-clip: border; -font-size: 11px; -} - -QLabel { -background-color: transparent; -} - -QLabel#nameLabel { - font: bold 16px; - color: #3C7B9E; -} - -QLabel#modeLabel { - font: 12px; -} - -QLabel#stateLabel { - font: 12px; - color: #3C7B9E; -} - -QLabel#navLabel { - font: 12px; -} - -QLabel#positionLabel { - font: 8px; -} - -QLabel#timeElapsedLabel { - font: 8px; -} - -QLabel#groundDistanceLabel { - font: 8px; -} - -QLabel#speedLabel { - font: 8px; -} - -QLabel#timeRemainingLabel { - font: 8px; -} - -QLabel#waypointLabel { - font: 22px; -} - -QGroupBox { - border: 1px solid #4A4A4F; - border-radius: 10px; - padding: 0px 0px 0px 0px; - margin: 0px; -} - - QGroupBox::title { - subcontrol-origin: margin; - subcontrol-position: top center; /* position at the top center */ - margin: 0 3px 0px 3px; - padding: 0 3px 0px 0px; - font: bold 8px; - } - -QGroupBox#heartbeatIcon { - background-color: red; -} - -QToolButton#typeButton { - font-weight: bold; - font-size: 12px; - border: 0px solid #999999; - border-radius: 5px; - min-width:42px; - max-width: 42px; - min-height: 42px; - max-height: 42px; - padding: 0px; - margin: 0px; - background-color: none; -} - -QPushButton { - font-weight: bold; - font-size: 12px; - border: 1px solid #999999; - border-radius: 8px; - min-width: 20px; - max-width: 32px; - min-height: 16px; - max-height: 16px; - padding: 2px; - spacing: 10px; - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #777777, stop: 1 #555555); -} - -QPushButton:pressed { - background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #444444, stop: 1 #555555); -} - -QPushButton#abortButton { - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffee01, stop:1 #ae8f00); -} - -QPushButton:pressed#abortButton { - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bbaa00, stop:1 #a05b00); -} - -QPushButton#killButton { - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffb917, stop:1 #b37300); -} - -QPushButton:pressed#killButton { - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bb8500, stop:1 #903000); -} - - -QProgressBar:horizontal { - border: 1px solid #4A4A4F; - border-radius: 4px; - text-align: center; - padding: 2px; - color: #111111; - background-color: #111118; -} - -QProgressBar:vertical { - border: 1px solid #4A4A4F; - border-radius: 4px; - text-align: center; - font-size: 7px; - padding: 2px; - color: #DDDDDF; - min-width: 16px; - background-color: #111118; -} - -QProgressBar:horizontal { - height: 10px; -} - -QProgressBar:horizontal QLabel { - font-size: 9px; - color: #111111; -} - -QProgressBar:vertical QLabel { - font-size: 7px; -} - -QProgressBar:vertical { - width: 14px; -} - -QProgressBar::chunk { - background-color: #656565; -} - -QProgressBar::chunk#batteryBar { - background-color: green; -} - -QProgressBar::chunk#speedBar { - background-color: yellow; -} - -QProgressBar::chunk#thrustBar { - background-color: orange; -} - -QToolTip { - background-color: #090909; - border: 1px solid #379AC3; - border-radius: 3px; - color: #DDDDDF; -} - -QMenu { - border: 1px solid #379AC3; -background-color: #050508; -color: #DDDDDF; -background-clip: border; -font-size: 11px; -} - -QMenu::separator { - height: 1px; - background: #379AC3; - margin-top: 8px; - margin-bottom: 4px; - margin-left: 5px; - margin-right: 5px; - } + - - - 2 - - - 2 - - - 2 - - - 2 - - - 0 + + + 5 - - - - 0 - 0 - + + + 0 - - - 0 - 0 - - - - - 16777215 - 130 - - - - + + + + 0 + + + + + System type + + + System type + + + System type + + + + + + :/files/images/mavs/unknown.svg + + + + + + + 0 + + + + + Heartbeat + + + + + + + + + + + 18 + 0 + + + + + 18 + 40 + + + + + + + Battery Fuel + + + Battery Fuel + + + 0 + + + false + + + Qt::Vertical + + + + + + + + + + + 2 + + + 0 + + + + + + 50 + false + false + + + + Current Waypoint + + + Current Waypoint + + + --- + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Liftoff / Launch + + + Liftoff / Launch + + + + + + + :/files/images/control/launch.svg:/files/images/control/launch.svg + + + + + + + + 0 + 0 + + + + + 26 + 22 + + + + + 38 + 22 + + + + Emergency land system at closest possible site + + + Emergency land system at closest possible site + + + + + + + :/files/images/actions/media-playback-stop.svg:/files/images/actions/media-playback-stop.svg + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Loiter / Wait at current position + + + Loiter / Wait at current position + + + + + + + :/files/images/actions/media-playback-pause.svg:/files/images/actions/media-playback-pause.svg + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Continue flightplan + + + Continue flightplan + + + + + + + :/files/images/actions/media-playback-start.svg:/files/images/actions/media-playback-start.svg + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Fly straight to landing location + + + Fly straight to landing location + + + + + + + :/files/images/control/land.svg:/files/images/control/land.svg + + + + + + + + 26 + 22 + + + + + 38 + 22 + + + + Kill immediately all onboard power + + + Kill immediately all onboard power + + + + + + + :/files/images/actions/process-stop.svg:/files/images/actions/process-stop.svg + + + + + + + + 38 + 22 + + + + Only in standby mode: Power off system + + + Only in standby mode: Power off system + + + + + + + :/files/images/actions/system-log-out.svg:/files/images/actions/system-log-out.svg + + + + + + + 4 + + + QLayout::SetMinimumSize + + + + + + + + + + + + 16777215 + 16 + + + + + 75 + false + true + + + + System Name + + + System Name + + + UAS001 + + + + + + + + + + 50 + false + false + + + + Remaining flight time + + + Remaining flight time + + + 00:00:00 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 50 + false + false + + + + Uptime + + + Uptime + + + 00:00:00 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + 50 + false + false + + + + Altitude + + + Altitude + + + 00.00 m + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 50 + false + false + + + + Ground Speed + + + Ground Speed + + + 00.0 m/s + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + 16777215 + 12 + + + + + 50 + false + false + + + + STATE + + + + + + + + + + + + 16777215 + 16 + + + + + 50 + false + false + + + + MODE + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 12 + + + + + 16777215 + 12 + + + + + 50 + false + false + + + + Current Position + + + Current Position + + + 00.0 00.0 00.0 m + + + + + + + + + + Current throttle + + + Current throttle + + + 0 + + + throttle %p% + + + + + + + + 50 + false + false + + + + NAV + + + + + + + + + + + Waiting for first status update.. - - - 5 - - - 2 - - - 4 - - - - - - 42 - 42 - - - - - 42 - 42 - - - - - 30 - 30 - - - - System Type - - - System Type - - - ... - - - - :/files/images/mavs/unknown.svg:/files/images/mavs/unknown.svg - - - - 42 - 42 - - - - - - - - - 16777215 - 16 - - - - - -1 - 75 - false - true - - - - System Name - - - System Name - - - UAS001 - - - - - - - - 16777215 - 16 - - - - - -1 - 50 - false - false - - - - MODE - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - -1 - 50 - false - false - - - - Remaining flight time - - - Remaining flight time - - - 00:00:00 - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - -1 - 50 - false - false - - - - Uptime - - - Uptime - - - 00:00:00 - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - -1 - - - - Current throttle - - - Current throttle - - - 0 - - - throttle %p% - - - - - - - - -1 - 50 - false - false - - - - Altitude - - - Altitude - - - 00.00 m - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - -1 - 50 - false - false - - - - Ground Speed - - - Ground Speed - - - 00.0 m/s - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 18 - 0 - - - - - 18 - 40 - - - - Heartbeat - - - Heartbeat - - - - - - - - - - - 18 - 0 - - - - - 18 - 40 - - - - - -1 - - - - Battery Fuel - - - Battery Fuel - - - 0 - - - Qt::Vertical - - - - - - - - -1 - 50 - false - false - - - - Current Waypoint - - - Current Waypoint - - - --- - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - 0 - 12 - - - - - 16777215 - 12 - - - - - -1 - 50 - false - false - - - - Current Position - - - Current Position - - - 00.0 00.0 00.0 m - - - - - - - 4 - - - QLayout::SetMinimumSize - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Liftoff / Launch - - - Liftoff / Launch - - - - - - - :/files/images/control/launch.svg:/files/images/control/launch.svg - - - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Loiter / Wait at current position - - - Loiter / Wait at current position - - - - - - - :/files/images/actions/media-playback-pause.svg:/files/images/actions/media-playback-pause.svg - - - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Continue flightplan - - - Continue flightplan - - - - - - - :/files/images/actions/media-playback-start.svg:/files/images/actions/media-playback-start.svg - - - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Fly straight to landing location - - - Fly straight to landing location - - - - - - - :/files/images/control/land.svg:/files/images/control/land.svg - - - - - - - - 38 - 22 - - - - Only in standby mode: Power off system - - - Only in standby mode: Power off system - - - - - - - :/files/images/actions/system-log-out.svg:/files/images/actions/system-log-out.svg - - - - - - - - 0 - 0 - - - - - 26 - 22 - - - - - 38 - 22 - - - - Emergency land system at closest possible site - - - Emergency land system at closest possible site - - - - - - - :/files/images/actions/media-playback-stop.svg:/files/images/actions/media-playback-stop.svg - - - - - - - - 26 - 22 - - - - - 38 - 22 - - - - Kill immediately all onboard power - - - Kill immediately all onboard power - - - - - - - :/files/images/actions/process-stop.svg:/files/images/actions/process-stop.svg - - - - - - - - - Waiting for first status update.. - - - - - - - - 16777215 - 12 - - - - - -1 - 50 - false - false - - - - STATE - - - - - - - - -1 - 50 - false - false - - - - NAV - - - - - - - Qt::Horizontal - - - - 8 - 20 - - - - - diff --git a/src/ui/uas/QGCUnconnectedInfoWidget.ui b/src/ui/uas/QGCUnconnectedInfoWidget.ui index 6a1ac83bdd8d74822d4fdd4c10cf182f1ac76900..455184200d8aa446ab32550708b4e6741bc62b86 100644 --- a/src/ui/uas/QGCUnconnectedInfoWidget.ui +++ b/src/ui/uas/QGCUnconnectedInfoWidget.ui @@ -6,20 +6,38 @@ 0 0 - 372 - 309 + 174 + 174 + + + 0 + 0 + + Form - + + + 0 + + + 0 + - + + + + 0 + 0 + + - 150 - 150 + 174 + 174 @@ -35,28 +53,7 @@ - -QToolButton { -color: #222222; -background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #80B81D, stop: 1 #306807); -margin: 15px; -padding: 20px; -border-radius: 18px; -min-height: 100px; -border: 2px solid #085B35; -} - -QToolButton:pressed { -background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #306807, stop: 1 #80B81D); -color: #222222; -border-color: #D1892A; -} - -QToolButton:checked { -background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #306807, stop: 1 #80B81D); -color: #222222; -border-color: #D1892A; -} + @@ -71,24 +68,8 @@ border-color: #D1892A; 140 - - Qt::ToolButtonIconOnly - - - - - Qt::Vertical - - - - 20 - 40 - - - - diff --git a/src/ui/uas/UASListWidget.cc b/src/ui/uas/UASListWidget.cc index 26f64a949d2ff33fa188cfc721f4d60e3ded08af..4b1c7f380aeb1ea9f247bcfa2214fade8b36b692 100644 --- a/src/ui/uas/UASListWidget.cc +++ b/src/ui/uas/UASListWidget.cc @@ -48,19 +48,11 @@ This file is part of the PIXHAWK project UASListWidget::UASListWidget(QWidget *parent) : QWidget(parent), m_ui(new Ui::UASList) { m_ui->setupUi(this); - - listLayout = new QVBoxLayout(this); - listLayout->setMargin(0); - listLayout->setSpacing(3); - listLayout->setAlignment(Qt::AlignTop); - this->setLayout(listLayout); - setObjectName("UNMANNED_SYSTEMS_LIST"); + m_ui->verticalLayout->setAlignment(Qt::AlignTop); // Construct initial widget uWidget = new QGCUnconnectedInfoWidget(this); - listLayout->addWidget(uWidget); - - this->setMinimumWidth(262); + m_ui->verticalLayout->addWidget(uWidget); uasViews = QMap(); @@ -98,7 +90,7 @@ void UASListWidget::addUAS(UASInterface* uas) { if (uasViews.isEmpty()) { - listLayout->removeWidget(uWidget); + m_ui->verticalLayout->removeWidget(uWidget); delete uWidget; uWidget = NULL; } @@ -106,7 +98,7 @@ void UASListWidget::addUAS(UASInterface* uas) if (!uasViews.contains(uas)) { uasViews.insert(uas, new UASView(uas, this)); - listLayout->addWidget(uasViews.value(uas)); + m_ui->verticalLayout->addWidget(uasViews.value(uas)); //connect(uas, SIGNAL(destroyed(QObject*)), this, SLOT(removeUAS(QObject*))); } } @@ -121,9 +113,8 @@ void UASListWidget::activeUAS(UASInterface* uas) void UASListWidget::removeUAS(UASInterface* uas) { - Q_UNUSED(uas); + Q_UNUSED(uas); // uasViews.remove(uas); // listLayout->removeWidget(uasViews.value(uas)); // uasViews.value(uas)->deleteLater(); } - diff --git a/src/ui/uas/UASListWidget.h b/src/ui/uas/UASListWidget.h index 45f0c735edf9a7bd00076f2b667c45a2a9c28d15..37aa77a666ef359c820070d869986cd2179e6622 100644 --- a/src/ui/uas/UASListWidget.h +++ b/src/ui/uas/UASListWidget.h @@ -54,7 +54,6 @@ public slots: protected: QMap uasViews; - QVBoxLayout* listLayout; QGCUnconnectedInfoWidget* uWidget; void changeEvent(QEvent *e); diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index 20a742b57b8040656725f450e830fd5e721f9cc8..c4af8643b7c6535722b50e54d9576c617c40136c 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -47,6 +47,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : startTime(0), timeout(false), iconIsRed(true), + disconnected(false), timeRemaining(0), chargeLevel(0), uas(uas), @@ -104,7 +105,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : connect(uas, SIGNAL(navModeChanged(int, int, QString)), this, SLOT(updateNavMode(int, int, QString))); // Setup UAS selection - connect(m_ui->uasViewFrame, SIGNAL(clicked(bool)), this, SLOT(setUASasActive(bool))); + connect(this, SIGNAL(clicked(bool)), this, SLOT(setUASasActive(bool))); // Setup user interaction connect(m_ui->liftoffButton, SIGNAL(clicked()), uas, SLOT(launch())); @@ -139,8 +140,6 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : m_ui->nameLabel->setText(uas->getUASName()); } - setBackgroundColor(); - // Heartbeat fade refreshTimer = new QTimer(this); connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh())); @@ -153,7 +152,13 @@ UASView::UASView(UASInterface* uas, QWidget *parent) : refreshTimer->start(updateInterval); } - // Hide kill and shutdown buttons per default + // Style some elements by default to the UAS' color. + heartbeatColor = uas->getColor(); + QString colorstyle("QLabel { background-color: %1; }"); + m_ui->typeLabel->setStyleSheet(colorstyle.arg(heartbeatColor.name())); + updateActiveUAS(uas, false); + + // Hide kill and shutdown buttons by default m_ui->killButton->hide(); m_ui->shutdownButton->hide(); @@ -193,30 +198,6 @@ void UASView::showStatusText(int uasid, int componentid, int severity, QString t stateDesc = text; } -/** - * Set the background color based on the MAV color. If the MAV is selected as the - * currently actively controlled system, the frame color is highlighted - */ -void UASView::setBackgroundColor() -{ - // UAS color - QColor uasColor = uas->getColor(); - QString colorstyle; - QString borderColor = "#4A4A4F"; - if (isActive) - { - borderColor = "#FA4A4F"; - uasColor = uasColor.darker(475); - } - else - { - uasColor = uasColor.darker(675); - } - colorstyle = colorstyle.sprintf("QGroupBox { border-radius: 12px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X; border: 2px solid %s; }", - uasColor.red(), uasColor.green(), uasColor.blue(), borderColor.toStdString().c_str()); - m_ui->uasViewFrame->setStyleSheet(colorstyle); -} - void UASView::setUASasActive(bool active) { if (active) @@ -230,7 +211,14 @@ void UASView::updateActiveUAS(UASInterface* uas, bool active) if (uas == this->uas) { this->isActive = active; - setBackgroundColor(); + if (active) + { + setStyleSheet("UASView { border-width: 3px}"); + } + else + { + setStyleSheet(QString("UASView { border-color: %1}").arg(heartbeatColor.name())); + } } } @@ -295,11 +283,16 @@ void UASView::hideEvent(QHideEvent* event) void UASView::receiveHeartbeat(UASInterface* uas) { - Q_UNUSED(uas); - heartbeatColor = QColor(20, 200, 20); - QString colorstyle("QGroupBox { border-radius: 5px; padding: 2px; margin: 0px; border: 0px; background-color: %1; }"); - m_ui->heartbeatIcon->setStyleSheet(colorstyle.arg(heartbeatColor.name())); - if (timeout) setBackgroundColor(); + heartbeatColor = uas->getColor(); + QString colorstyle("QLabel { background-color: %1; }"); + m_ui->heartBeatLabel->setStyleSheet(colorstyle.arg(heartbeatColor.name())); + + // If we're returning from a disconnection, recolor things properly. + if (disconnected) + { + updateActiveUAS(this->uas, this->isActive); + disconnected = false; + } timeout = false; } @@ -323,22 +316,22 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType) switch (systemType) { case MAV_TYPE_GENERIC: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/generic.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/generic.svg")); break; case MAV_TYPE_FIXED_WING: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/fixed-wing.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/fixed-wing.svg")); break; case MAV_TYPE_QUADROTOR: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/quadrotor.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/quadrotor.svg")); break; case MAV_TYPE_COAXIAL: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/coaxial.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/coaxial.svg")); break; case MAV_TYPE_HELICOPTER: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/helicopter.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/helicopter.svg")); break; case MAV_TYPE_ANTENNA_TRACKER: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/unknown.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/unknown.svg")); break; case MAV_TYPE_GCS: { // A groundstation is a special system type, update widget @@ -356,44 +349,44 @@ void UASView::setSystemType(UASInterface* uas, unsigned int systemType) m_ui->landButton->hide(); m_ui->shutdownButton->hide(); m_ui->abortButton->hide(); - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/groundstation.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/groundstation.svg")); } break; case MAV_TYPE_AIRSHIP: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/airship.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/airship.svg")); break; case MAV_TYPE_FREE_BALLOON: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/free-balloon.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/free-balloon.svg")); break; case MAV_TYPE_ROCKET: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/rocket.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/rocket.svg")); break; case MAV_TYPE_GROUND_ROVER: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/ground-rover.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/ground-rover.svg")); break; case MAV_TYPE_SURFACE_BOAT: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/surface-boat.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/surface-boat.svg")); break; case MAV_TYPE_SUBMARINE: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/submarine.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/submarine.svg")); break; case MAV_TYPE_HEXAROTOR: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/hexarotor.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/hexarotor.svg")); break; case MAV_TYPE_OCTOROTOR: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/octorotor.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/octorotor.svg")); break; case MAV_TYPE_TRICOPTER: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/tricopter.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/tricopter.svg")); break; case MAV_TYPE_FLAPPING_WING: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/flapping-wing.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/flapping-wing.svg")); break; case MAV_TYPE_KITE: - m_ui->typeButton->setIcon(QIcon(":files/images/mavs/kite.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":files/images/mavs/kite.svg")); break; default: - m_ui->typeButton->setIcon(QIcon(":/files/images/mavs/unknown.svg")); + m_ui->typeLabel->setPixmap(QPixmap(":/files/images/mavs/unknown.svg")); break; } } @@ -677,54 +670,39 @@ void UASView::refresh() } generalUpdateCount++; - QString colorstyle("QGroupBox { border-radius: 5px; padding: 2px; margin: 0px; border: 0px; background-color: %1; }"); - if (timeout) { // CRITICAL CONDITION, NO HEARTBEAT + disconnected = true; - QString borderColor = "#FFFF00"; - if (isActive) - { - borderColor = "#FA4A4F"; - } - + QColor warnColor; if (iconIsRed) { - QColor warnColor(Qt::red); - m_ui->heartbeatIcon->setStyleSheet(colorstyle.arg(warnColor.name())); - QString style = QString("QGroupBox { border-radius: 12px; padding: 0px; margin: 0px; border: 2px solid %1; background-color: %2; }").arg(borderColor, warnColor.name()); - m_ui->uasViewFrame->setStyleSheet(style); + warnColor = Qt::red; } else { - QColor warnColor(Qt::black); - m_ui->heartbeatIcon->setStyleSheet(colorstyle.arg(warnColor.name())); - QString style = QString("QGroupBox { border-radius: 12px; padding: 0px; margin: 0px; border: 2px solid %1; background-color: %2; }").arg(borderColor, warnColor.name()); - m_ui->uasViewFrame->setStyleSheet(style); - + warnColor = Qt::darkRed; refreshTimer->setInterval(errorUpdateInterval); refreshTimer->start(); } + QString style = QString("UASView {background-color: %1;}").arg(warnColor.name()); + this->setStyleSheet(style); iconIsRed = !iconIsRed; } else { + // If we're not in low power mode, add the additional visual effect of + // fading out the color of the heartbeat for this UAS. if (!lowPowerModeEnabled) { - // Fade heartbeat icon - // Make color darker - heartbeatColor = heartbeatColor.darker(210); - - //m_ui->heartbeatIcon->setAutoFillBackground(true); - m_ui->heartbeatIcon->setStyleSheet(colorstyle.arg(heartbeatColor.name())); + heartbeatColor = heartbeatColor.darker(110); + QString colorstyle("QLabel {background-color: %1;}"); + m_ui->heartBeatLabel->setStyleSheet(colorstyle.arg(heartbeatColor.name())); refreshTimer->setInterval(updateInterval); refreshTimer->start(); } } - //setUpdatesEnabled(true); - - //setUpdatesEnabled(false); } void UASView::changeEvent(QEvent *e) @@ -739,3 +717,14 @@ void UASView::changeEvent(QEvent *e) break; } } + +/** + * Implement paintEvent() so that stylesheets work for our custom widget. + */ +void UASView::paintEvent(QPaintEvent *) + { + QStyleOption opt; + opt.init(this); + QPainter p(this); + style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this); + } diff --git a/src/ui/uas/UASView.h b/src/ui/uas/UASView.h index 073bebdeecb0a30cb0e49ecd52d0504ca7fb36ec..edc8bee406da628a5580385e19f38ba671d2c9f8 100644 --- a/src/ui/uas/UASView.h +++ b/src/ui/uas/UASView.h @@ -80,8 +80,6 @@ public slots: void updateActiveUAS(UASInterface* uas, bool active); /** @brief Set the widget into critical mode */ void heartbeatTimeout(bool timeout, unsigned int ms); - /** @brief Set the background color for the widget */ - void setBackgroundColor(); /** @brief Bring up the dialog to rename the system */ void rename(); /** @brief Select airframe for this vehicle */ @@ -100,6 +98,7 @@ protected: quint64 startTime; bool timeout; bool iconIsRed; + bool disconnected; int timeRemaining; float chargeLevel; UASInterface* uas; @@ -146,6 +145,7 @@ protected: private: Ui::UASView *m_ui; + virtual void paintEvent(QPaintEvent *); signals: void uasInFocus(UASInterface* uas);