Commit ddefe971 authored by lm's avatar lm

Improved visual style of waypoint editing component, freed up space

parent a92acac1
...@@ -41,14 +41,13 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge ...@@ -41,14 +41,13 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge
{ {
SerialLinkInterface* serialLink = dynamic_cast<SerialLinkInterface*>(link); SerialLinkInterface* serialLink = dynamic_cast<SerialLinkInterface*>(link);
if(serialLink != 0) { if(serialLink != 0)
{
serialLink->loadSettings(); serialLink->loadSettings();
this->link = serialLink; this->link = serialLink;
// Setup the user interface according to link type // Setup the user interface according to link type
ui.setupUi(this); ui.setupUi(this);
//this->setVisible(false);
//this->hide();
// Create action to open this menu // Create action to open this menu
// Create configuration action for this link // Create configuration action for this link
...@@ -154,10 +153,10 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge ...@@ -154,10 +153,10 @@ SerialConfigurationWindow::SerialConfigurationWindow(LinkInterface* link, QWidge
// Display the widget // Display the widget
this->window()->setWindowTitle(tr("Serial Communication Settings")); this->window()->setWindowTitle(tr("Serial Communication Settings"));
//this->show(); }
} else { else
{
qDebug() << "Link is NOT a serial link, can't open configuration window"; qDebug() << "Link is NOT a serial link, can't open configuration window";
} }
} }
...@@ -220,9 +219,12 @@ void SerialConfigurationWindow::setupPortList() ...@@ -220,9 +219,12 @@ void SerialConfigurationWindow::setupPortList()
void SerialConfigurationWindow::enableFlowControl(bool flow) void SerialConfigurationWindow::enableFlowControl(bool flow)
{ {
if(flow) { if(flow)
{
link->setFlowType(1); link->setFlowType(1);
} else { }
else
{
link->setFlowType(0); link->setFlowType(0);
} }
} }
......
...@@ -63,7 +63,8 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) : ...@@ -63,7 +63,8 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) :
updateValues(); updateValues();
// Check for mission frame // 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); m_ui->comboBox_action->setCurrentIndex(m_ui->comboBox_action->count()-1);
} }
......
...@@ -289,7 +289,10 @@ void WaypointList::addCurrentPositionWaypoint() ...@@ -289,7 +289,10 @@ void WaypointList::addCurrentPositionWaypoint()
void WaypointList::updateStatusLabel(const QString &string) void WaypointList::updateStatusLabel(const QString &string)
{ {
// Status label in write widget
m_ui->statusLabel->setText(string); m_ui->statusLabel->setText(string);
// Status label in read only widget
m_ui->viewStatusLabel->setText(string);
} }
void WaypointList::changeCurrentWaypoint(quint16 seq) void WaypointList::changeCurrentWaypoint(quint16 seq)
......
...@@ -20,16 +20,46 @@ ...@@ -20,16 +20,46 @@
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>8</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="editTab"> <widget class="QWidget" name="editTab">
<attribute name="title"> <attribute name="title">
<string>Tab 1</string> <string>Edit Waypoints</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_2"> <layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="horizontalSpacing">
<number>12</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="9"> <item row="0" column="0" colspan="9">
<widget class="QScrollArea" name="scrollArea"> <widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable"> <property name="widgetResizable">
...@@ -40,15 +70,24 @@ ...@@ -40,15 +70,24 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>812</width> <width>834</width>
<height>271</height> <height>325</height>
</rect> </rect>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<property name="margin"> <property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number> <number>4</number>
</property> </property>
<item> <item>
...@@ -213,14 +252,48 @@ ...@@ -213,14 +252,48 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2">
<widget class="QLabel" name="statusLabel">
<property name="toolTip">
<string>The current waypoint transmission status</string>
</property>
<property name="statusTip">
<string>The current waypoint transmission status</string>
</property>
<property name="whatsThis">
<string>The current waypoint transmission status</string>
</property>
<property name="text">
<string>Please add first waypoint.</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="viewTab"> <widget class="QWidget" name="viewTab">
<attribute name="title"> <attribute name="title">
<string>Tab 2</string> <string>Onboard Waypoints</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_3"> <layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2"> <property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<number>6</number>
</property>
<property name="horizontalSpacing">
<number>12</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="3">
<widget class="QScrollArea" name="readOnlyScrollArea"> <widget class="QScrollArea" name="readOnlyScrollArea">
<property name="widgetResizable"> <property name="widgetResizable">
<bool>true</bool> <bool>true</bool>
...@@ -230,14 +303,26 @@ ...@@ -230,14 +303,26 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>812</width> <width>834</width>
<height>271</height> <height>331</height>
</rect> </rect>
</property> </property>
<property name="autoFillBackground"> <property name="autoFillBackground">
<bool>true</bool> <bool>true</bool>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>8</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item> <item>
<widget class="QWidget" name="viewOnlyListWidget" native="true"> <widget class="QWidget" name="viewOnlyListWidget" native="true">
<property name="enabled"> <property name="enabled">
...@@ -249,7 +334,7 @@ ...@@ -249,7 +334,7 @@
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="1">
<spacer name="horizontalSpacer_2"> <spacer name="horizontalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -262,7 +347,7 @@ ...@@ -262,7 +347,7 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="1" column="1"> <item row="1" column="2">
<widget class="QPushButton" name="refreshButton"> <widget class="QPushButton" name="refreshButton">
<property name="toolTip"> <property name="toolTip">
<string>Read all waypoints from the MAV and display in View tab..</string> <string>Read all waypoints from the MAV and display in View tab..</string>
...@@ -282,27 +367,18 @@ ...@@ -282,27 +367,18 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="statusLabel"> <widget class="QLabel" name="viewStatusLabel">
<property name="toolTip">
<string>The current waypoint transmission status</string>
</property>
<property name="statusTip">
<string>The current waypoint transmission status</string>
</property>
<property name="whatsThis">
<string>The current waypoint transmission status</string>
</property>
<property name="text"> <property name="text">
<string>Please add first waypoint.</string> <string>TextLabel</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget>
</widget>
</item>
</layout>
<action name="actionAddWaypoint"> <action name="actionAddWaypoint">
<property name="icon"> <property name="icon">
<iconset resource="../../qgroundcontrol.qrc"> <iconset resource="../../qgroundcontrol.qrc">
......
...@@ -26,7 +26,7 @@ void WaypointViewOnlyView::changedAutoContinue(int state) ...@@ -26,7 +26,7 @@ void WaypointViewOnlyView::changedAutoContinue(int state)
m_ui->autoContinue->blockSignals(false); m_ui->autoContinue->blockSignals(false);
wp->setAutocontinue(new_value); wp->setAutocontinue(new_value);
emit changeAutoContinue(wp->getId(),new_value); emit changeAutoContinue(wp->getId(),new_value);
} }
void WaypointViewOnlyView::changedCurrent(int state) void WaypointViewOnlyView::changedCurrent(int state)
{ {
...@@ -87,24 +87,61 @@ void WaypointViewOnlyView::updateValues() ...@@ -87,24 +87,61 @@ void WaypointViewOnlyView::updateValues()
deleteLater(); deleteLater();
return; 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 // update frame
m_ui->idLabel->setText(QString("%1").arg(wp->getId())); m_ui->idLabel->setText(QString("%1").arg(wp->getId()));
if (m_ui->current->isChecked() != wp->getCurrent()) if (m_ui->current->isChecked() != wp->getCurrent())
{ {
m_ui->current->blockSignals(true);
m_ui->current->setChecked(wp->getCurrent()); m_ui->current->setChecked(wp->getCurrent());
m_ui->current->blockSignals(false);
} }
if (m_ui->autoContinue->isChecked() != wp->getAutoContinue()) if (m_ui->autoContinue->isChecked() != wp->getAutoContinue())
{ {
m_ui->autoContinue->blockSignals(true);
m_ui->autoContinue->setChecked(wp->getAutoContinue()); m_ui->autoContinue->setChecked(wp->getAutoContinue());
m_ui->autoContinue->blockSignals(false);
} }
switch (wp->getAction()) switch (wp->getAction())
{ {
case MAV_CMD_NAV_WAYPOINT: case MAV_CMD_NAV_WAYPOINT:
{ {
if (wp->getParam1()>0) if (wp->getParam1()>0)
{ {
...@@ -116,17 +153,17 @@ case MAV_CMD_NAV_WAYPOINT: ...@@ -116,17 +153,17 @@ case MAV_CMD_NAV_WAYPOINT:
} }
break; 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())); 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; 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())); 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; break;
} }
case MAV_CMD_DO_JUMP: case MAV_CMD_DO_JUMP:
{ {
if (wp->getParam2()>0) if (wp->getParam2()>0)
{ {
...@@ -138,35 +175,32 @@ case MAV_CMD_DO_JUMP: ...@@ -138,35 +175,32 @@ case MAV_CMD_DO_JUMP:
} }
break; break;
} }
case MAV_CMD_CONDITION_DELAY: case MAV_CMD_CONDITION_DELAY:
{ {
m_ui->displayBar->setText(QString("Delay: %1 sec").arg(wp->getParam1())); m_ui->displayBar->setText(QString("Delay: %1 sec").arg(wp->getParam1()));
break; 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())); 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; 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())); 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; 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())); 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; 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())); 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; break;
} }
} }
wp->blockSignals(false);
} }
WaypointViewOnlyView::~WaypointViewOnlyView() WaypointViewOnlyView::~WaypointViewOnlyView()
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>381</width> <width>381</width>
<height>55</height> <height>40</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
...@@ -20,124 +20,12 @@ ...@@ -20,124 +20,12 @@
<string>Form</string> <string>Form</string>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">QWidget#colorIcon {} <string notr="true"/>
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(&quot;ICONDIR/control/emergency-button.png&quot;);
}
QPushButton:pressed#landButton {
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #bbaa00, stop:1 #a05b00) url(&quot;ICONDIR/control/emergency-button.png&quot;);
}
QPushButton#killButton {
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #ffb917, stop:1 #b37300) url(&quot;ICONDIR/control/emergency-button.png&quot;);
}
QPushButton:pressed#killButton {
color: #000000;
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #bb8500, stop:1 #903000) url(&quot;ICONDIR/control/emergency-button.png&quot;);
}
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;
}</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>2</number> <number>2</number>
</property> </property>
...@@ -167,13 +55,22 @@ QProgressBar::chunk#thrustBar { ...@@ -167,13 +55,22 @@ QProgressBar::chunk#thrustBar {
<property name="checkable"> <property name="checkable">
<bool>false</bool> <bool>false</bool>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1,100,1">
<property name="spacing"> <property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>2</number> <number>2</number>
</property> </property>
<property name="margin"> <property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>2</number> <number>2</number>
</property> </property>
<property name="bottomMargin">
<number>0</number>
</property>
<item> <item>
<widget class="QCheckBox" name="current"> <widget class="QCheckBox" name="current">
<property name="toolTip"> <property name="toolTip">
......
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