diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui
index af18a65..3503841 100644
--- a/src/ui/MainWindow.ui
+++ b/src/ui/MainWindow.ui
@@ -12,8 +12,8 @@
- 1024
- 600
+ 640
+ 400
diff --git a/src/ui/WaypointEditableView.cc b/src/ui/WaypointEditableView.cc
index 8bb0c6c..11b2f78 100644
--- a/src/ui/WaypointEditableView.cc
+++ b/src/ui/WaypointEditableView.cc
@@ -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
diff --git a/src/ui/WaypointList.cc b/src/ui/WaypointList.cc
index f2da662..4cf4b69 100644
--- a/src/ui/WaypointList.cc
+++ b/src/ui/WaypointList.cc
@@ -382,13 +382,13 @@ void WaypointList::changeCurrentWaypoint(quint16 seq)
void WaypointList::currentWaypointEditableChanged(quint16 seq)
{
WPM->setCurrentEditable(seq);
- const QList &waypoints = WPM->getWaypointEditableList();
+ const QList 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 &waypoints = WPM->getWaypointViewOnlyList();
+ const QList 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 &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 &waypoints = WPM->getWaypointEditableList();
+ const QList 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();
}
diff --git a/src/ui/WaypointViewOnlyView.cc b/src/ui/WaypointViewOnlyView.cc
index 8688b3f..32f3b07 100644
--- a/src/ui/WaypointViewOnlyView.cc
+++ b/src/ui/WaypointViewOnlyView.cc
@@ -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)
{
diff --git a/src/ui/map/QGCMapWidget.cc b/src/ui/map/QGCMapWidget.cc
index 4cb9098..5f5ba36 100644
--- a/src/ui/map/QGCMapWidget.cc
+++ b/src/ui/map/QGCMapWidget.cc
@@ -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);
}