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 {
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 {
background: none;
}
......@@ -506,6 +506,14 @@ WaypointEditableView, WaypointViewOnlyView {
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 {
background: none;
}
......@@ -61,7 +61,7 @@ WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) :
MissionNavTakeoffWidget = NULL;
MissionNavSweepWidget = NULL;
MissionConditionDelayWidget = NULL;
MissionDoJumpWidget = NULL;
MissionDoJumpWidget = NULL;
MissionDoStartSearchWidget = NULL;
MissionDoFinishSearchWidget = NULL;
MissionOtherWidget = NULL;
......@@ -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("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("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
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);
......@@ -141,7 +141,7 @@ void WaypointEditableView::changedAutoContinue(int state)
}
void WaypointEditableView::updateActionView(int action)
{
{
//Hide all
if(MissionNavWaypointWidget) MissionNavWaypointWidget->hide();
if(MissionNavLoiterUnlimWidget) MissionNavLoiterUnlimWidget->hide();
......@@ -349,25 +349,25 @@ void WaypointEditableView::changedFrame(int index)
}
void WaypointEditableView::changedCurrent(int state)
{
{
if (state == 0)
{
if (wp->getCurrent() == true) //User clicked on the waypoint, that is already current
{
{
m_ui->selectedBox->setChecked(true);
m_ui->selectedBox->setCheckState(Qt::Checked);
}
else
{
{
m_ui->selectedBox->setChecked(false);
m_ui->selectedBox->setCheckState(Qt::Unchecked);
m_ui->selectedBox->setCheckState(Qt::Unchecked);
}
}
else
{
{
wp->setCurrent(true);
emit changeCurrentWaypoint(wp->getId()); //the slot changeCurrentWaypoint() in WaypointList sets all other current flags to false
}
}
}
void WaypointEditableView::updateValues()
......@@ -449,7 +449,7 @@ void WaypointEditableView::updateValues()
MAV_FRAME frame = wp->getFrame();
int frame_index = m_ui->comboBox_frame->findData(frame);
if (m_ui->comboBox_frame->currentIndex() != frame_index) {
m_ui->comboBox_frame->setCurrentIndex(frame_index);
m_ui->comboBox_frame->setCurrentIndex(frame_index);
}
// Update action
......@@ -492,37 +492,18 @@ void WaypointEditableView::updateValues()
m_ui->idLabel->setText(QString::number(wp->getId()));
// Style alternating rows of Missions as lighter/darker.
QString backGroundColor;
static int lastId = -1;
int currId = wp->getId() % 2;
if (currId != lastId)
{
if (currId == 1)
{
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT)
{
backGroundColor = "#999";
}
else
{
backGroundColor = "#333";
}
this->setProperty("RowColoring", "odd");
}
else
{
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT)
{
backGroundColor = "#CCC";
}
else
{
backGroundColor = "#555";
}
this->setProperty("RowColoring", "even");
}
QString newStyle = QString("WaypointEditableView {background-color: %1}").arg(backGroundColor);
this->setStyleSheet(newStyle);
lastId = currId;
}
......
......@@ -17,13 +17,13 @@ WaypointViewOnlyView::WaypointViewOnlyView(Waypoint* wp, QWidget *parent) :
}
void WaypointViewOnlyView::changedAutoContinue(int state)
{
{
bool new_value = false;
if (state != 0)
{
new_value = true;
}
wp->setAutocontinue(new_value);
wp->setAutocontinue(new_value);
emit changeAutoContinue(wp->getId(),new_value);
}
......@@ -32,7 +32,7 @@ void WaypointViewOnlyView::changedCurrent(int state)
{
Q_UNUSED(state);
//qDebug() << "Trof: WaypointViewOnlyView::changedCurrent(" << state << ") ID:" << wp->getId();
m_ui->current->blockSignals(true);
m_ui->current->blockSignals(true);
if (m_ui->current->isChecked() == false)
{
......@@ -60,7 +60,7 @@ void WaypointViewOnlyView::changedCurrent(int 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.
{
m_ui->current->blockSignals(true);
m_ui->current->blockSignals(true);
if (state == true)
{
wp->setCurrent(true);
......@@ -90,33 +90,15 @@ void WaypointViewOnlyView::updateValues()
int currId = wp->getId() % 2;
if (currId != lastId)
{
QString backGroundColor;
if (currId == 1)
{
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT)
{
backGroundColor = "#999";
}
else
{
backGroundColor = "#333";
}
this->setProperty("RowColoring", "odd");
}
else
{
if (MainWindow::instance()->getStyle() == MainWindow::QGC_MAINWINDOW_STYLE_LIGHT)
{
backGroundColor = "#CCC";
}
else
{
backGroundColor = "#555";
}
this->setProperty("RowColoring", "even");
}
QString newStyle = QString("WaypointViewOnlyView {background-color: %1}").arg(backGroundColor);
this->setStyleSheet(newStyle);
lastId = currId;
}
......@@ -160,7 +142,7 @@ void WaypointViewOnlyView::updateValues()
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())
......@@ -310,7 +292,7 @@ void WaypointViewOnlyView::updateValues()
break;
}
case MAV_CMD_NAV_LAND:
{
{
switch (wp->getFrame())
{
case MAV_FRAME_GLOBAL_RELATIVE_ALT:
......@@ -329,7 +311,7 @@ void WaypointViewOnlyView::updateValues()
break;
}
case MAV_CMD_NAV_TAKEOFF:
{
{
switch (wp->getFrame())
{
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