Commit 60e50d12 authored by Lorenz Meier's avatar Lorenz Meier

Merge master

parents 282aae6c 5e95b6d2
......@@ -12,8 +12,8 @@
</property>
<property name="minimumSize">
<size>
<width>1024</width>
<height>600</height>
<width>640</width>
<height>400</height>
</size>
</property>
<property name="baseSize">
......
......@@ -39,11 +39,10 @@
WaypointEditableView::WaypointEditableView(Waypoint* wp, QWidget* parent) :
QWidget(parent),
viewMode(QGC_WAYPOINTEDITABLEVIEW_MODE_DEFAULT),
wp(wp),
m_ui(new Ui::WaypointEditableView)
{
m_ui->setupUi(this);
this->wp = wp;
connect(wp, SIGNAL(destroyed(QObject*)), this, SLOT(deleted(QObject*)));
// CUSTOM COMMAND WIDGET
......
......@@ -382,13 +382,13 @@ void WaypointList::changeCurrentWaypoint(quint16 seq)
void WaypointList::currentWaypointEditableChanged(quint16 seq)
{
WPM->setCurrentEditable(seq);
const QList<Waypoint *> &waypoints = WPM->getWaypointEditableList();
const QList<Waypoint *> waypoints = WPM->getWaypointEditableList();
if (seq < waypoints.count())
{
for(int i = 0; i < waypoints.count(); i++)
{
WaypointEditableView* widget = wpEditableViews.find(waypoints[i]).value();
WaypointEditableView* widget = wpEditableViews.value(waypoints[i], NULL);
if (widget) {
if (waypoints[i]->getId() == seq)
......@@ -410,13 +410,13 @@ void WaypointList::currentWaypointViewOnlyChanged(quint16 seq)
// First update the edit list
currentWaypointEditableChanged(seq);
const QList<Waypoint *> &waypoints = WPM->getWaypointViewOnlyList();
const QList<Waypoint *> waypoints = WPM->getWaypointViewOnlyList();
if (seq < waypoints.count())
{
for(int i = 0; i < waypoints.count(); i++)
{
WaypointViewOnlyView* widget = wpViewOnlyViews.find(waypoints[i]).value();
WaypointViewOnlyView* widget = wpViewOnlyViews.value(waypoints[i], NULL);
if (widget) {
if (waypoints[i]->getId() == seq)
......@@ -467,7 +467,7 @@ void WaypointList::waypointViewOnlyListChanged()
}
}
if (i == waypoints.count()) {
WaypointViewOnlyView* widget = wpViewOnlyViews.find(cur).value();
WaypointViewOnlyView* widget = wpViewOnlyViews.value(cur, NULL);
if (widget) {
widget->hide();
viewOnlyListLayout->removeWidget(widget);
......@@ -523,7 +523,7 @@ void WaypointList::waypointEditableListChanged()
}
}
if (i == waypoints.count()) {
WaypointEditableView* widget = wpEditableViews.find(cur).value();
WaypointEditableView* widget = wpEditableViews.value(cur, NULL);
if (widget) {
widget->hide();
......@@ -620,7 +620,7 @@ void WaypointList::on_clearWPListButton_clicked()
emit clearPathclicked();
const QList<Waypoint *> &waypoints = WPM->getWaypointEditableList();
while(!waypoints.isEmpty()) {
WaypointEditableView* widget = wpEditableViews.find(waypoints[0]).value();
WaypointEditableView* widget = wpEditableViews.value(waypoints[0], NULL);
if (widget) {
widget->remove();
}
......@@ -631,14 +631,14 @@ void WaypointList::on_clearWPListButton_clicked()
void WaypointList::clearWPWidget()
{
// Get list
const QList<Waypoint *> &waypoints = WPM->getWaypointEditableList();
const QList<Waypoint *> waypoints = WPM->getWaypointEditableList();
// XXX delete wps as well
// Clear UI elements
while(!waypoints.isEmpty()) {
WaypointEditableView* widget = wpEditableViews.find(waypoints[0]).value();
WaypointEditableView* widget = wpEditableViews.value(waypoints[0], NULL);
if (widget) {
widget->remove();
}
......
......@@ -6,10 +6,10 @@
WaypointViewOnlyView::WaypointViewOnlyView(Waypoint* wp, QWidget *parent) :
QWidget(parent),
wp(wp),
m_ui(new Ui::WaypointViewOnlyView)
{
m_ui->setupUi(this);
this->wp = wp;
updateValues();
connect(m_ui->current, SIGNAL(stateChanged(int)), this, SLOT(changedCurrent(int)));
......@@ -60,6 +60,10 @@ 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.
{
if (!wp) {
return;
}
m_ui->current->blockSignals(true);
if (state == true)
{
......
......@@ -169,6 +169,12 @@ void QGCMapWidget::mouseReleaseEvent(QMouseEvent *event)
{
mousePressPos = event->pos();
mapcontrol::OPMapWidget::mouseReleaseEvent(event);
// If the mouse is released, we can't be dragging
if (firingWaypointChange) {
firingWaypointChange = NULL;
}
qDebug() << "MOUSE RELEASED";
}
QGCMapWidget::~QGCMapWidget()
......@@ -620,10 +626,11 @@ void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint)
WPDelete(waypoint);
// Protect from vicious double update cycle
if (firingWaypointChange == wp) return;
if (firingWaypointChange == wp) {
return;
}
// Not in cycle, block now from entering it
firingWaypointChange = wp;
// // qDebug() << "UPDATING WP FROM MAP";
// Update WP values
internals::PointLatLng pos = waypoint->Coord();
......@@ -632,19 +639,14 @@ void QGCMapWidget::handleMapWaypointEdit(mapcontrol::WayPointItem* waypoint)
wp->blockSignals(true);
wp->setLatitude(pos.Lat());
wp->setLongitude(pos.Lng());
// XXX Magic values
// wp->setAltitude(homeAltitude + 50.0f);
// wp->setAcceptanceRadius(10.0f);
wp->blockSignals(false);
internals::PointLatLng coord = waypoint->Coord();
QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6);
// // qDebug() << "MAP WP COORD (MAP):" << coord_str << __FILE__ << __LINE__;
QString wp_str = QString::number(wp->getLatitude(), 'f', 6) + " " + QString::number(wp->getLongitude(), 'f', 6);
// // qDebug() << "MAP WP COORD (WP):" << wp_str << __FILE__ << __LINE__;
firingWaypointChange = NULL;
// internals::PointLatLng coord = waypoint->Coord();
// QString coord_str = " " + QString::number(coord.Lat(), 'f', 6) + " " + QString::number(coord.Lng(), 'f', 6);
// qDebug() << "MAP WP COORD (MAP):" << coord_str << __FILE__ << __LINE__;
// QString wp_str = QString::number(wp->getLatitude(), 'f', 6) + " " + QString::number(wp->getLongitude(), 'f', 6);
// qDebug() << "MAP WP COORD (WP):" << wp_str << __FILE__ << __LINE__;
emit waypointChanged(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