From ddefe97114b25cd2417599a78587efa6ffa790ad Mon Sep 17 00:00:00 2001 From: lm Date: Sat, 1 Oct 2011 14:58:49 +0200 Subject: [PATCH] Improved visual style of waypoint editing component, freed up space --- src/ui/SerialConfigurationWindow.cc | 18 ++-- src/ui/WaypointEditableView.cc | 3 +- src/ui/WaypointList.cc | 5 +- src/ui/WaypointList.ui | 130 +++++++++++++++++++++------ src/ui/WaypointViewOnlyView.cc | 70 +++++++++++---- src/ui/WaypointViewOnlyView.ui | 135 ++++------------------------ 6 files changed, 187 insertions(+), 174 deletions(-) diff --git a/src/ui/SerialConfigurationWindow.cc b/src/ui/SerialConfigurationWindow.cc index 56134ec92..0d086f5d0 100644 --- a/src/ui/SerialConfigurationWindow.cc +++ b/src/ui/SerialConfigurationWindow.cc @@ -41,14 +41,13 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge { SerialLinkInterface* serialLink = dynamic_cast(link); - if(serialLink != 0) { + if(serialLink != 0) + { serialLink->loadSettings(); this->link = serialLink; // Setup the user interface according to link type ui.setupUi(this); - //this->setVisible(false); - //this->hide(); // Create action to open this menu // Create configuration action for this link @@ -154,10 +153,10 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge // Display the widget this->window()->setWindowTitle(tr("Serial Communication Settings")); - //this->show(); - } else { + } + else + { qDebug() << "Link is NOT a serial link, can't open configuration window"; - } } @@ -220,9 +219,12 @@ void SerialConfigurationWindow::setupPortList() void SerialConfigurationWindow::enableFlowControl(bool flow) { - if(flow) { + if(flow) + { link->setFlowType(1); - } else { + } + else + { link->setFlowType(0); } } diff --git a/src/ui/WaypointEditableView.cc b/src/ui/WaypointEditableView.cc index 686c01ef3..757e789d7 100644 --- a/src/ui/WaypointEditableView.cc +++ b/src/ui/WaypointEditableView.cc @@ -63,7 +63,8 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) : updateValues(); // Check for mission frame - if (wp->getFrame() == MAV_FRAME_MISSION) { + if (wp->getFrame() == MAV_FRAME_MISSION) + { m_ui->comboBox_action->setCurrentIndex(m_ui->comboBox_action->count()-1); } diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc index 237e161be..d837b8705 100644 --- a/src/ui/WaypointList.cc +++ b/src/ui/WaypointList.cc @@ -89,7 +89,7 @@ WaypointList::WaypointList(QWidget *parent, UASInterface* uas) : // REFRESH VIEW TAB - connect(m_ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh())); + connect(m_ui->refreshButton, SIGNAL(clicked()), this, SLOT(refresh())); // SET UAS AFTER ALL SIGNALS/SLOTS ARE CONNECTED @@ -289,7 +289,10 @@ void WaypointList::addCurrentPositionWaypoint() void WaypointList::updateStatusLabel(const QString &string) { + // Status label in write widget m_ui->statusLabel->setText(string); + // Status label in read only widget + m_ui->viewStatusLabel->setText(string); } void WaypointList::changeCurrentWaypoint(quint16 seq) diff --git a/src/ui/WaypointList.ui b/src/ui/WaypointList.ui index 8791277c3..61cf36eb6 100644 --- a/src/ui/WaypointList.ui +++ b/src/ui/WaypointList.ui @@ -20,16 +20,46 @@ Form + + 0 + + + 8 + + + 0 + + + 0 + - 0 + 1 - Tab 1 + Edit Waypoints + + 6 + + + 0 + + + 6 + + + 6 + + + 12 + + + 6 + @@ -40,15 +70,24 @@ 0 0 - 812 - 271 + 834 + 325 0 - + + 4 + + + 8 + + + 4 + + 4 @@ -213,14 +252,48 @@ + + + + The current waypoint transmission status + + + The current waypoint transmission status + + + The current waypoint transmission status + + + Please add first waypoint. + + + - Tab 2 + Onboard Waypoints - + + 6 + + + 0 + + + 6 + + + 6 + + + 12 + + + 6 + + true @@ -230,14 +303,26 @@ 0 0 - 812 - 271 + 834 + 331 true + + 4 + + + 8 + + + 4 + + + 4 + @@ -249,7 +334,7 @@ - + Qt::Horizontal @@ -262,7 +347,7 @@ - + Read all waypoints from the MAV and display in View tab.. @@ -282,26 +367,17 @@ + + + + TextLabel + + + - - - - The current waypoint transmission status - - - The current waypoint transmission status - - - The current waypoint transmission status - - - Please add first waypoint. - - - diff --git a/src/ui/WaypointViewOnlyView.cc b/src/ui/WaypointViewOnlyView.cc index e94f17234..29845a962 100644 --- a/src/ui/WaypointViewOnlyView.cc +++ b/src/ui/WaypointViewOnlyView.cc @@ -26,7 +26,7 @@ void WaypointViewOnlyView::changedAutoContinue(int state) m_ui->autoContinue->blockSignals(false); wp->setAutocontinue(new_value); emit changeAutoContinue(wp->getId(),new_value); - } +} void WaypointViewOnlyView::changedCurrent(int state) { @@ -87,24 +87,61 @@ void WaypointViewOnlyView::updateValues() deleteLater(); return; } - // Deactivate signals from the WP - wp->blockSignals(true); + + // Update style + + QColor backGroundColor = QGC::colorBackground; + + static int lastId = -1; + int currId = wp->getId() % 2; + + if (currId != lastId) + { + + // qDebug() << "COLOR ID: " << currId; + if (currId == 1) + { + backGroundColor = QColor("#252528").lighter(150); + } + else + { + backGroundColor = QColor("#252528").lighter(250); + } + + // Update color based on id + QString groupBoxStyle = QString("QGroupBox {padding: 0px; margin: 0px; border: 0px; background-color: %1; min-height: 12px; }").arg(backGroundColor.name()); + QString labelStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border-color: #EEEEEE; }").arg(backGroundColor.name()); + QString displayBarStyle = QString("QWidget {background-color: %1; color: #DDDDDF; border: none; }").arg(backGroundColor.name()); + QString checkBoxStyle = QString("QCheckBox {background-color: %1; color: #454545; border-color: #EEEEEE; }").arg(backGroundColor.name()); + + m_ui->autoContinue->setStyleSheet(checkBoxStyle); + m_ui->current->setStyleSheet(checkBoxStyle); + m_ui->idLabel->setStyleSheet(labelStyle); + m_ui->displayBar->setStyleSheet(displayBarStyle); + m_ui->groupBox->setStyleSheet(groupBoxStyle); + lastId = currId; + } + // update frame m_ui->idLabel->setText(QString("%1").arg(wp->getId())); if (m_ui->current->isChecked() != wp->getCurrent()) { + m_ui->current->blockSignals(true); m_ui->current->setChecked(wp->getCurrent()); + m_ui->current->blockSignals(false); } if (m_ui->autoContinue->isChecked() != wp->getAutoContinue()) { + m_ui->autoContinue->blockSignals(true); m_ui->autoContinue->setChecked(wp->getAutoContinue()); + m_ui->autoContinue->blockSignals(false); } -switch (wp->getAction()) -{ -case MAV_CMD_NAV_WAYPOINT: + switch (wp->getAction()) + { + case MAV_CMD_NAV_WAYPOINT: { if (wp->getParam1()>0) { @@ -116,17 +153,17 @@ case MAV_CMD_NAV_WAYPOINT: } break; } -case MAV_CMD_NAV_LAND: + case MAV_CMD_NAV_LAND: { m_ui->displayBar->setText(QString("LAND. Go to (%1, %2, %3) and descent; yaw: %4").arg(wp->getX()).arg(wp->getY()).arg(wp->getZ()).arg(wp->getParam4())); break; } -case MAV_CMD_NAV_TAKEOFF: + case MAV_CMD_NAV_TAKEOFF: { m_ui->displayBar->setText(QString("TAKEOFF. Go to (%1, %2, %3); yaw: %4").arg(wp->getX()).arg(wp->getY()).arg(wp->getZ()).arg(wp->getParam4())); break; } -case MAV_CMD_DO_JUMP: + case MAV_CMD_DO_JUMP: { if (wp->getParam2()>0) { @@ -138,35 +175,32 @@ case MAV_CMD_DO_JUMP: } break; } -case MAV_CMD_CONDITION_DELAY: + case MAV_CMD_CONDITION_DELAY: { m_ui->displayBar->setText(QString("Delay: %1 sec").arg(wp->getParam1())); break; } -case 237: //MAV_CMD_DO_START_SEARCH + case 237: //MAV_CMD_DO_START_SEARCH { m_ui->displayBar->setText(QString("Start searching for pattern. Success when got more than %2 detections with confidence %1").arg(wp->getParam1()).arg(wp->getParam2())); break; } -case 238: //MAV_CMD_DO_FINISH_SEARCH + case 238: //MAV_CMD_DO_FINISH_SEARCH { m_ui->displayBar->setText(QString("Check if search was successful. yes -> jump to %1, no -> jump to %2. Jumps left: %3").arg(wp->getParam1()).arg(wp->getParam2()).arg(wp->getParam3())); break; } -case 240: //MAV_CMD_DO_SWEEP + case 240: //MAV_CMD_DO_SWEEP { m_ui->displayBar->setText(QString("Sweep. Corners: (%1,%2) and (%3,%4); z: %5; scan radius: %6").arg(wp->getParam3()).arg(wp->getParam4()).arg(wp->getParam5()).arg(wp->getParam6()).arg(wp->getParam7()).arg(wp->getParam1())); break; } -default: + default: { m_ui->displayBar->setText(QString("Unknown Command ID (%1) : %2, %3, %4, %5, %6, %7, %8").arg(wp->getAction()).arg(wp->getParam1()).arg(wp->getParam2()).arg(wp->getParam3()).arg(wp->getParam4()).arg(wp->getParam5()).arg(wp->getParam6()).arg(wp->getParam7())); break; } -} - - - wp->blockSignals(false); + } } WaypointViewOnlyView::~WaypointViewOnlyView() diff --git a/src/ui/WaypointViewOnlyView.ui b/src/ui/WaypointViewOnlyView.ui index b2c79910e..eb35191b1 100644 --- a/src/ui/WaypointViewOnlyView.ui +++ b/src/ui/WaypointViewOnlyView.ui @@ -7,7 +7,7 @@ 0 0 381 - 55 + 40 @@ -20,124 +20,12 @@ Form - QWidget#colorIcon {} - -QWidget { -background-color: #252528; -color: #DDDDDF; -border-color: #EEEEEE; -background-clip: border; -} - -QCheckBox { -background-color: #252528; -color: #454545; -} - -QGroupBox { - border: 1px solid #EEEEEE; - border-radius: 5px; - padding: 0px 0px 0px 0px; -margin-top: 1ex; /* leave space at the top for the title */ - 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; -} - - QDockWidget { - font: bold; - border: 1px solid #32345E; -} - -QPushButton { - font-weight: bold; - font-size: 12px; - border: 1px solid #999999; - border-radius: 10px; - min-width:22px; - max-width: 36px; - min-height: 16px; - max-height: 16px; - padding: 2px; - 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#landButton { - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffee01, stop:1 #ae8f00) url("ICONDIR/control/emergency-button.png"); -} - -QPushButton:pressed#landButton { - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bbaa00, stop:1 #a05b00) url("ICONDIR/control/emergency-button.png"); -} - -QPushButton#killButton { - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #ffb917, stop:1 #b37300) url("ICONDIR/control/emergency-button.png"); -} - -QPushButton:pressed#killButton { - color: #000000; - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, - stop:0 #bb8500, stop:1 #903000) url("ICONDIR/control/emergency-button.png"); -} - -QProgressBar { - border: 1px solid white; - border-radius: 4px; - text-align: center; - padding: 2px; - color: white; - background-color: #111111; -} - -QProgressBar:horizontal { - height: 12px; -} - -QProgressBar QLabel { - font-size: 8px; -} - -QProgressBar:vertical { - width: 12px; -} - -QProgressBar::chunk { - background-color: #656565; -} - -QProgressBar::chunk#batteryBar { - background-color: green; -} - -QProgressBar::chunk#speedBar { - background-color: yellow; -} - -QProgressBar::chunk#thrustBar { - background-color: orange; -} + + + 0 + 2 @@ -167,13 +55,22 @@ QProgressBar::chunk#thrustBar { false - + + 6 + + 2 - + + 0 + + 2 + + 0 + -- 2.22.0