Commit 3805b4cc authored by pixhawk's avatar pixhawk

Fixed changing "current" bugs. Should now work as intended.

parent c3ff739f
......@@ -173,7 +173,7 @@ void UASWaypointManager::handleWaypoint(quint8 systemId, quint8 compId, mavlink_
protocol_timer.stop();
emit readGlobalWPFromUAS(false);
if (currentWaypointEditable) emit currentWaypointChanged(currentWaypointEditable->getId());
//if (currentWaypointEditable) emit currentWaypointChanged(currentWaypointEditable->getId());
emit updateStatusString("done.");
// // qDebug() << "got all waypoints from ID " << systemId;
......@@ -283,19 +283,6 @@ int UASWaypointManager::setCurrentWaypoint(quint16 seq)
if (seq < waypointsViewOnly.size()) {
if(current_state == WP_IDLE) {
/*
//update local main storage
for(int i = 0; i < waypointsViewOnly.size(); i++) {
if (waypointsViewOnly[i]->getId() == seq) {
waypointsViewOnly[i]->setCurrent(true);
//currentWaypointEditable = waypoints[i];
} else {
waypointsViewOnly[i]->setCurrent(false);
}
}
*/
//send change to UAS - important to note: if the transmission fails, we have inconsistencies
protocol_timer.start(PROTOCOL_TIMEOUT_MS);
current_retries = PROTOCOL_MAX_RETRIES;
......
......@@ -359,27 +359,30 @@ void WaypointEditableView::changedFrame(int index)
void WaypointEditableView::changedCurrent(int state)
{
m_ui->selectedBox->blockSignals(true);
//m_ui->selectedBox->blockSignals(true);
if (state == 0)
{
if (wp->getCurrent() == true) //User clicked on the waypoint, that is already current
{
qDebug() << "Editable " << wp->getId() << " changedCurrent: State 0, current true" ;
m_ui->selectedBox->setChecked(true);
m_ui->selectedBox->setCheckState(Qt::Checked);
}
else
{
qDebug() << "Editable " << wp->getId() << " changedCurrent: State 0, current false";
m_ui->selectedBox->setChecked(false);
m_ui->selectedBox->setCheckState(Qt::Unchecked);
wp->setCurrent(false);
//wp->setCurrent(false);
}
}
else
{
qDebug() << "Editable " << wp->getId() << " changedCurrent: State 2";
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
}
m_ui->selectedBox->blockSignals(false);
//m_ui->selectedBox->blockSignals(false);
}
void WaypointEditableView::updateValues()
......
......@@ -306,8 +306,12 @@ void WaypointList::changeCurrentWaypoint(quint16 seq)
void WaypointList::currentWaypointEditableChanged(quint16 seq)
{
qDebug() << "WaypointList::currentWaypointEditableChanged";
if (uas)
{
uas->getWaypointManager()->setCurrentEditable(seq);
/*
const QVector<Waypoint *> &waypoints = uas->getWaypointManager()->getWaypointEditableList();
if (seq < waypoints.size())
......@@ -326,7 +330,9 @@ void WaypointList::currentWaypointEditableChanged(quint16 seq)
}
}
}
*/
}
}
void WaypointList::currentWaypointViewOnlyChanged(quint16 seq)
......@@ -458,8 +464,8 @@ void WaypointList::waypointEditableListChanged()
connect(wpview, SIGNAL(moveDownWaypoint(Waypoint*)), this, SLOT(moveDown(Waypoint*)));
connect(wpview, SIGNAL(moveUpWaypoint(Waypoint*)), this, SLOT(moveUp(Waypoint*)));
connect(wpview, SIGNAL(removeWaypoint(Waypoint*)), this, SLOT(removeWaypoint(Waypoint*)));
//connect(wpview, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16))); commented, because unused
connect(wpview, SIGNAL(changeCurrentWaypoint(quint16)), this, SLOT(changeCurrentWaypointEditable(quint16)));
//connect(wpview, SIGNAL(currentWaypointChanged(quint16)), this, SLOT(currentWaypointChanged(quint16)));
connect(wpview, SIGNAL(changeCurrentWaypoint(quint16)), this, SLOT(currentWaypointEditableChanged(quint16)));
editableListLayout->insertWidget(i, wpview);
}
WaypointEditableView *wpv = wpEditableViews.value(wp);
......
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