Commit 6377dab3 authored by Bryant's avatar Bryant

The background color of the mission items is now controlled by stylesheets as...

The background color of the mission items is now controlled by stylesheets as well. This change also fixed restyling the mission lists when a style change occurred.
parent 3d1a54df
...@@ -506,6 +506,14 @@ WaypointEditableView, WaypointViewOnlyView { ...@@ -506,6 +506,14 @@ WaypointEditableView, WaypointViewOnlyView {
margin-bottom: 3px; margin-bottom: 3px;
} }
WaypointEditableView[RowColoring="odd"], WaypointViewOnlyView[RowColoring="odd"] {
background-color: #333;
}
WaypointEditableView[RowColoring="even"], WaypointViewOnlyView[RowColoring="even"] {
background-color: #555;
}
WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget { WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget {
background: none; background: none;
} }
...@@ -506,6 +506,14 @@ WaypointEditableView, WaypointViewOnlyView { ...@@ -506,6 +506,14 @@ WaypointEditableView, WaypointViewOnlyView {
margin-bottom: 3px; margin-bottom: 3px;
} }
WaypointEditableView[RowColoring="odd"], WaypointViewOnlyView[RowColoring="odd"] {
background-color: #999;
}
WaypointEditableView[RowColoring="even"], WaypointViewOnlyView[RowColoring="even"] {
background-color: #CCC;
}
WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget { WaypointEditableView QCheckBox, WaypointEditableView .QWidget, WaypointViewOnlyView QCheckBox, WaypointViewOnlyView .QWidget {
background: none; background: none;
} }
...@@ -61,7 +61,7 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) : ...@@ -61,7 +61,7 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) :
MissionNavTakeoffWidget = NULL; MissionNavTakeoffWidget = NULL;
MissionNavSweepWidget = NULL; MissionNavSweepWidget = NULL;
MissionConditionDelayWidget = NULL; MissionConditionDelayWidget = NULL;
MissionDoJumpWidget = NULL; MissionDoJumpWidget = NULL;
MissionDoStartSearchWidget = NULL; MissionDoStartSearchWidget = NULL;
MissionDoFinishSearchWidget = NULL; MissionDoFinishSearchWidget = NULL;
MissionOtherWidget = NULL; MissionOtherWidget = NULL;
...@@ -78,7 +78,7 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) : ...@@ -78,7 +78,7 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) :
//m_ui->comboBox_action->addItem(tr("NAV: Target"),MAV_CMD_NAV_TARGET); //m_ui->comboBox_action->addItem(tr("NAV: Target"),MAV_CMD_NAV_TARGET);
m_ui->comboBox_action->addItem(tr("IF: Delay over"),MAV_CMD_CONDITION_DELAY); m_ui->comboBox_action->addItem(tr("IF: Delay over"),MAV_CMD_CONDITION_DELAY);
//m_ui->comboBox_action->addItem(tr("IF: Yaw angle is"),MAV_CMD_CONDITION_YAW); //m_ui->comboBox_action->addItem(tr("IF: Yaw angle is"),MAV_CMD_CONDITION_YAW);
m_ui->comboBox_action->addItem(tr("DO: Jump to Index"),MAV_CMD_DO_JUMP); m_ui->comboBox_action->addItem(tr("DO: Jump to Index"),MAV_CMD_DO_JUMP);
#ifdef MAVLINK_ENABLED_PIXHAWK #ifdef MAVLINK_ENABLED_PIXHAWK
m_ui->comboBox_action->addItem(tr("NAV: Sweep"),MAV_CMD_NAV_SWEEP); m_ui->comboBox_action->addItem(tr("NAV: Sweep"),MAV_CMD_NAV_SWEEP);
m_ui->comboBox_action->addItem(tr("Do: Start Search"),MAV_CMD_DO_START_SEARCH); m_ui->comboBox_action->addItem(tr("Do: Start Search"),MAV_CMD_DO_START_SEARCH);
...@@ -141,7 +141,7 @@ void WaypointEditableView::changedAutoContinue(int state) ...@@ -141,7 +141,7 @@ void WaypointEditableView::changedAutoContinue(int state)
} }
void WaypointEditableView::updateActionView(int action) void WaypointEditableView::updateActionView(int action)
{ {
//Hide all //Hide all
if(MissionNavWaypointWidget) MissionNavWaypointWidget->hide(); if(MissionNavWaypointWidget) MissionNavWaypointWidget->hide();
if(MissionNavLoiterUnlimWidget) MissionNavLoiterUnlimWidget->hide(); if(MissionNavLoiterUnlimWidget) MissionNavLoiterUnlimWidget->hide();
...@@ -349,25 +349,25 @@ void WaypointEditableView::changedFrame(int index) ...@@ -349,25 +349,25 @@ void WaypointEditableView::changedFrame(int index)
} }
void WaypointEditableView::changedCurrent(int state) void WaypointEditableView::changedCurrent(int state)
{ {
if (state == 0) if (state == 0)
{ {
if (wp->getCurrent() == true) //User clicked on the waypoint, that is already current if (wp->getCurrent() == true) //User clicked on the waypoint, that is already current
{ {
m_ui->selectedBox->setChecked(true); m_ui->selectedBox->setChecked(true);
m_ui->selectedBox->setCheckState(Qt::Checked); m_ui->selectedBox->setCheckState(Qt::Checked);
} }
else else
{ {
m_ui->selectedBox->setChecked(false); m_ui->selectedBox->setChecked(false);
m_ui->selectedBox->setCheckState(Qt::Unchecked); m_ui->selectedBox->setCheckState(Qt::Unchecked);
} }
} }
else else
{ {
wp->setCurrent(true); wp->setCurrent(true);
emit changeCurrentWaypoint(wp->getId()); //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false emit changeCurrentWaypoint(wp->getId()); //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false
} }
} }
void WaypointEditableView::updateValues() void WaypointEditableView::updateValues()
...@@ -449,7 +449,7 @@ void WaypointEditableView::updateValues() ...@@ -449,7 +449,7 @@ void WaypointEditableView::updateValues()
MAV_FRAME frame = wp->getFrame(); MAV_FRAME frame = wp->getFrame();
int frame_index = m_ui->comboBox_frame->findData(frame); int frame_index = m_ui->comboBox_frame->findData(frame);
if (m_ui->comboBox_frame->currentIndex() != frame_index) { if (m_ui->comboBox_frame->currentIndex() != frame_index) {
m_ui->comboBox_frame->setCurrentIndex(frame_index); m_ui->comboBox_frame->setCurrentIndex(frame_index);
} }
// Update action // Update action
...@@ -492,37 +492,18 @@ void WaypointEditableView::updateValues() ...@@ -492,37 +492,18 @@ void WaypointEditableView::updateValues()
m_ui->idLabel->setText(QString::number(wp->getId())); m_ui->idLabel->setText(QString::number(wp->getId()));
// Style alternating rows of Missions as lighter/darker. // Style alternating rows of Missions as lighter/darker.
QString backGroundColor;
static int lastId = -1; static int lastId = -1;
int currId = wp->getId() % 2; int currId = wp->getId() % 2;
if (currId != lastId) if (currId != lastId)
{ {
if (currId == 1) if (currId == 1)
{ {
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) this->setProperty("RowColoring", "odd");
{
backGroundColor = "#999";
}
else
{
backGroundColor = "#333";
}
} }
else else
{ {
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) this->setProperty("RowColoring", "even");
{
backGroundColor = "#CCC";
}
else
{
backGroundColor = "#555";
}
} }
QString newStyle = QString("WaypointEditableView {background-color: %1}").arg(backGroundColor);
this->setStyleSheet(newStyle);
lastId = currId; lastId = currId;
} }
......
...@@ -17,13 +17,13 @@ WaypointViewOnlyView::WaypointViewOnlyView(Waypoint* wp, QWidget *parent) : ...@@ -17,13 +17,13 @@ WaypointViewOnlyView::WaypointViewOnlyView(Waypoint* wp, QWidget *parent) :
} }
void WaypointViewOnlyView::changedAutoContinue(int state) void WaypointViewOnlyView::changedAutoContinue(int state)
{ {
bool new_value = false; bool new_value = false;
if (state != 0) if (state != 0)
{ {
new_value = true; new_value = true;
} }
wp->setAutocontinue(new_value); wp->setAutocontinue(new_value);
emit changeAutoContinue(wp->getId(),new_value); emit changeAutoContinue(wp->getId(),new_value);
} }
...@@ -32,7 +32,7 @@ void WaypointViewOnlyView::changedCurrent(int state) ...@@ -32,7 +32,7 @@ void WaypointViewOnlyView::changedCurrent(int state)
{ {
Q_UNUSED(state); Q_UNUSED(state);
//qDebug() << "Trof: WaypointViewOnlyView::changedCurrent(" << state << ") ID:" << wp->getId(); //qDebug() << "Trof: WaypointViewOnlyView::changedCurrent(" << state << ") ID:" << wp->getId();
m_ui->current->blockSignals(true); m_ui->current->blockSignals(true);
if (m_ui->current->isChecked() == false) if (m_ui->current->isChecked() == false)
{ {
...@@ -60,7 +60,7 @@ void WaypointViewOnlyView::changedCurrent(int state) ...@@ -60,7 +60,7 @@ void WaypointViewOnlyView::changedCurrent(int state)
void WaypointViewOnlyView::setCurrent(bool state) void WaypointViewOnlyView::setCurrent(bool state)
//This is a slot receiving signals from UASWaypointManager. The state given here is the true representation of what the "current" waypoint on UAV is. //This is a slot receiving signals from UASWaypointManager. The state given here is the true representation of what the "current" waypoint on UAV is.
{ {
m_ui->current->blockSignals(true); m_ui->current->blockSignals(true);
if (state == true) if (state == true)
{ {
wp->setCurrent(true); wp->setCurrent(true);
...@@ -90,33 +90,15 @@ void WaypointViewOnlyView::updateValues() ...@@ -90,33 +90,15 @@ void WaypointViewOnlyView::updateValues()
int currId = wp->getId() % 2; int currId = wp->getId() % 2;
if (currId != lastId) if (currId != lastId)
{ {
QString backGroundColor;
if (currId == 1) if (currId == 1)
{ {
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) this->setProperty("RowColoring", "odd");
{
backGroundColor = "#999";
}
else
{
backGroundColor = "#333";
}
} }
else else
{ {
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT) this->setProperty("RowColoring", "even");
{
backGroundColor = "#CCC";
}
else
{
backGroundColor = "#555";
}
} }
QString newStyle = QString("WaypointViewOnlyView {background-color: %1}").arg(backGroundColor);
this->setStyleSheet(newStyle);
lastId = currId; lastId = currId;
} }
...@@ -160,7 +142,7 @@ void WaypointViewOnlyView::updateValues() ...@@ -160,7 +142,7 @@ void WaypointViewOnlyView::updateValues()
if (m_ui->current->isChecked() != wp->getCurrent()) if (m_ui->current->isChecked() != wp->getCurrent())
{ {
m_ui->current->blockSignals(true); m_ui->current->blockSignals(true);
m_ui->current->setChecked(wp->getCurrent()); m_ui->current->setChecked(wp->getCurrent());
m_ui->current->blockSignals(false); m_ui->current->blockSignals(false);
} }
if (m_ui->autoContinue->isChecked() != wp->getAutoContinue()) if (m_ui->autoContinue->isChecked() != wp->getAutoContinue())
...@@ -310,7 +292,7 @@ void WaypointViewOnlyView::updateValues() ...@@ -310,7 +292,7 @@ void WaypointViewOnlyView::updateValues()
break; break;
} }
case MAV_CMD_NAV_LAND: case MAV_CMD_NAV_LAND:
{ {
switch (wp->getFrame()) switch (wp->getFrame())
{ {
case MAV_FRAME_GLOBAL_RELATIVE_ALT: case MAV_FRAME_GLOBAL_RELATIVE_ALT:
...@@ -329,7 +311,7 @@ void WaypointViewOnlyView::updateValues() ...@@ -329,7 +311,7 @@ void WaypointViewOnlyView::updateValues()
break; break;
} }
case MAV_CMD_NAV_TAKEOFF: case MAV_CMD_NAV_TAKEOFF:
{ {
switch (wp->getFrame()) switch (wp->getFrame())
{ {
case MAV_FRAME_GLOBAL_RELATIVE_ALT: case MAV_FRAME_GLOBAL_RELATIVE_ALT:
......
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