From 05bc98cb7da69bae4374ed658b2de5e3899af364 Mon Sep 17 00:00:00 2001
From: Mariano Lizarraga <malife@gmail.com>
Date: Mon, 3 Jan 2011 23:26:58 -0600
Subject: [PATCH] Fixed SLUGS related warnings. Commented the visibilityChanged
 connection (MainWindow.cc 535) because it does not take into account when the
 widget is hidden when changing perspective. Will work on a fix

---
 src/LogCompressor.cc             |  2 ++
 src/ui/MainWindow.cc             | 48 ++++++++++++++++++++--------------------
 src/ui/MapWidget.cc              |  3 ++-
 src/ui/SlugsHilSim.cc            |  9 ++++++--
 src/ui/SlugsPIDControl.cpp       |  1 +
 src/ui/SlugsPadCameraControl.cpp |  1 +
 6 files changed, 37 insertions(+), 27 deletions(-)

diff --git a/src/LogCompressor.cc b/src/LogCompressor.cc
index fd394d9..444b27a 100644
--- a/src/LogCompressor.cc
+++ b/src/LogCompressor.cc
@@ -150,6 +150,7 @@ void LogCompressor::run()
         int offsetLimit = 200;
         quint64 offset;
         quint64 index = -1;
+        // FIXME Lorenz (index is an unsigend int)
         while (index == -1)
         {
             if (lastTimeIndex > offsetLimit)
@@ -161,6 +162,7 @@ void LogCompressor::run()
                 offset = 0;
             }
             quint64 index = times->indexOf(time, offset);
+            // FIXME Lorenz (index is an unsigend int)
             if (index == -1)
             {
                 qDebug() << "INDEX NOT FOUND DURING LOGFILE PROCESSING, RESTARTING SEARCH";
diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc
index d00966c..bb9cad8 100644
--- a/src/ui/MainWindow.cc
+++ b/src/ui/MainWindow.cc
@@ -532,8 +532,8 @@ void MainWindow::addToToolsMenu ( QWidget* widget,
   // connect the action
   connect(tempAction,SIGNAL(triggered()),this, slotName);
 
-  connect(qobject_cast <QDockWidget *>(dockWidgets[tool]),
-          SIGNAL(visibilityChanged(bool)), this, SLOT(updateVisibilitySettings(bool)));
+//  connect(qobject_cast <QDockWidget *>(dockWidgets[tool]),
+//          SIGNAL(visibilityChanged(bool)), this, SLOT(updateVisibilitySettings(bool)));
 
   connect(qobject_cast <QDockWidget *>(dockWidgets[tool]),
           SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), this, SLOT(updateLocationSettings(Qt::DockWidgetArea)));
@@ -559,8 +559,9 @@ void MainWindow::showToolWidget()
     }
     QString chKey = buildMenuKey (SUB_SECTION_CHECKED,static_cast<TOOLS_WIDGET_NAMES>(tool), currentView);
     settings.setValue(chKey,temp->isChecked());
-        settings.sync();
+    settings.sync();
   }
+
 }
 
 
@@ -572,6 +573,8 @@ void MainWindow::showTheWidget (TOOLS_WIDGET_NAMES widget, VIEW_SECTIONS view)
 
     tempVisible =  settings.value(buildMenuKey (SUB_SECTION_CHECKED,widget,view), false).toBool();
 
+//    qDebug() << buildMenuKey (SUB_SECTION_CHECKED, widget,view) << tempVisible;
+
     // Some widgets are per default visible. Overwrite the settings value if not present.
     if (widget == MainWindow::MENU_UAS_LIST)
     {
@@ -640,27 +643,23 @@ void MainWindow::closeEvent(QCloseEvent *event)
  */
 void MainWindow::updateVisibilitySettings (bool vis)
 {
-    if (!aboutToCloseFlag)
-    {
-
-  QDockWidget* temp = qobject_cast<QDockWidget *>(sender());
-
-        if (temp)
-        {
-  QHashIterator<int, QWidget*> i(dockWidgets);
-            while (i.hasNext())
-            {
-      i.next();
-                if ((static_cast <QDockWidget *>(dockWidgets[i.key()])) == temp)
-                {
-                    QString chKey = buildMenuKey (SUB_SECTION_CHECKED,static_cast<TOOLS_WIDGET_NAMES>(i.key()), currentView);
-        settings.setValue(chKey,vis);
-                    settings.sync();
-        toolsMenuActions[i.key()]->setChecked(vis);
-        break;
-      }
-  }
+    if (!aboutToCloseFlag) {
+
+      QDockWidget* temp = qobject_cast<QDockWidget *>(sender());
+
+      if (temp) {
+        QHashIterator<int, QWidget*> i(dockWidgets);
+        while (i.hasNext()) {
+          i.next();
+          if ((static_cast <QDockWidget *>(dockWidgets[i.key()])) == temp) {
+            QString chKey = buildMenuKey (SUB_SECTION_CHECKED,static_cast<TOOLS_WIDGET_NAMES>(i.key()), currentView);
+            settings.setValue(chKey,vis);
+            settings.sync();
+            toolsMenuActions[i.key()]->setChecked(vis);
+            break;
+          }
         }
+      }
     }
 }
 
@@ -1251,6 +1250,7 @@ void MainWindow::loadMAVLinkView()
 
 void MainWindow::presentView()
 {
+
   qDebug() << "LC";
   showTheCentralWidget(CENTRAL_LINECHART, currentView);
 
@@ -1393,7 +1393,7 @@ void MainWindow::showTheCentralWidget (TOOLS_WIDGET_NAMES centralWidget, VIEW_SE
   QWidget* tempWidget = dockWidgets[centralWidget];
 
   tempVisible =  settings.value(buildMenuKey (SUB_SECTION_CHECKED,centralWidget,view)).toBool();
-  qDebug() << buildMenuKey (SUB_SECTION_CHECKED,centralWidget,view) << tempVisible;
+//  qDebug() << buildMenuKey (SUB_SECTION_CHECKED,centralWidget,view) << tempVisible;
     if (toolsMenuActions[centralWidget])
     {
     toolsMenuActions[centralWidget]->setChecked(tempVisible);
diff --git a/src/ui/MapWidget.cc b/src/ui/MapWidget.cc
index 385f66f..58b133a 100644
--- a/src/ui/MapWidget.cc
+++ b/src/ui/MapWidget.cc
@@ -722,7 +722,8 @@ void MapWidget::changeGlobalWaypointPositionBySpinBox(int index, float lat, floa
 
 void MapWidget::updateCameraPosition(double radio, double bearing, QString dir)
 {
-    // FIXME Mariano
+  Q_UNUSED(bearing);
+  Q_UNUSED(dir);
     //camPoints.clear();
     QPointF currentPos = mc->currentCoordinate();
     //    QPointF actualPos = getPointxBearing_Range(currentPos.y(),currentPos.x(),bearing,distance);
diff --git a/src/ui/SlugsHilSim.cc b/src/ui/SlugsHilSim.cc
index a5c584f..029284a 100644
--- a/src/ui/SlugsHilSim.cc
+++ b/src/ui/SlugsHilSim.cc
@@ -207,6 +207,11 @@ uint16_t SlugsHilSim::getUint16FromDatagram (const QByteArray* datagram, unsigne
 }
 
 void SlugsHilSim::linkSelected(int cbIndex){
-  //hilLink = linksAvailable
-    // FIXME Mariano
+  #ifdef MAVLINK_ENABLED_SLUGS
+    // HIL code to go here...
+    //hilLink = linksAvailable
+    Q_UNUSED(cbIndex);
+  #else
+   Q_UNUSED(cbIndex);
+  #endif
 }
diff --git a/src/ui/SlugsPIDControl.cpp b/src/ui/SlugsPIDControl.cpp
index a6d3f28..dd6b2fc 100644
--- a/src/ui/SlugsPIDControl.cpp
+++ b/src/ui/SlugsPIDControl.cpp
@@ -506,6 +506,7 @@ void SlugsPIDControl::get_Pitch2dT_PID()
 
 void SlugsPIDControl::recibeMensaje(int systemId, const mavlink_action_ack_t& action)
 {
+  Q_UNUSED(systemId);
     ui->recepcion_label->setText(QString::number(action.action) + ":" + QString::number(action.result));
 }
 
diff --git a/src/ui/SlugsPadCameraControl.cpp b/src/ui/SlugsPadCameraControl.cpp
index 24b5790..bee159a 100644
--- a/src/ui/SlugsPadCameraControl.cpp
+++ b/src/ui/SlugsPadCameraControl.cpp
@@ -26,6 +26,7 @@ SlugsPadCameraControl::~SlugsPadCameraControl()
 
 void SlugsPadCameraControl::mouseMoveEvent(QMouseEvent *event)
 {
+  Q_UNUSED(event);
     //emit mouseMoveCoord(event->x(),event->y());
 
     if(dragging)