Added altitude display to detail screen. Added option to disable auto rotation.
[jspeed] / src / mainmenu.cpp
index e9bb4f8..e9a8670 100644 (file)
 #include "mainmenu.h"
 #include "themeselector.h"
 #include "unitselector.h"
+#include "poisettings.h"
+#include "speedalarmsettings.h"
 
 MainMenu::MainMenu(QWidget* parent): QDialog(parent), itemCount_(0),
-currentRow_(0), themeSelector_(0), unitSelector_(0), aboutDialog_(0)
+currentRow_(0), themeSelector_(0), unitSelector_(0), poiSettings_(0),
+speedAlarmSettings_(0), aboutDialog_(0)
 {
     layout_ = new QVBoxLayout;
     setLayout(layout_);
@@ -35,8 +38,10 @@ currentRow_(0), themeSelector_(0), unitSelector_(0), aboutDialog_(0)
     setWindowTitle(tr("Menu"));
     addAction(tr("Reset trip"), this, SIGNAL(resetTrip()));
     addAction(tr("Reset all"), this, SLOT(confirmReset()));
-    addAction(tr("Select theme"), this, SLOT(selectTheme()));
-    addAction(tr("Set unit"), this, SLOT(selectUnit()));
+    addAction(tr("Theme"), this, SLOT(selectTheme()));
+    addAction(tr("Options"), this, SLOT(selectUnit()));
+    addAction(tr("Speed camera alerts"), this, SLOT(openPoiAlerts()));
+    addAction(tr("Speed alarm"), this, SLOT(openSpeedAlarm()));
     addAction(tr("Flip screen"), this, SIGNAL(flip()));
     addAction(tr("About"), this, SLOT(showAbout()));
 }
@@ -52,12 +57,33 @@ void MainMenu::selectTheme()
     themeSelector_->show();
 }
 
+void MainMenu::openPoiAlerts()
+{
+    if(!poiSettings_)
+    {
+        poiSettings_ = new PoiSettings(this);
+    }
+
+    poiSettings_->show();
+}
+
+void MainMenu::openSpeedAlarm()
+{
+    if(!speedAlarmSettings_)
+    {
+        speedAlarmSettings_ = new SpeedAlarmSettings(this);
+    }
+
+    speedAlarmSettings_->show();
+}
+
 void MainMenu::selectUnit()
 {
     if(!unitSelector_)
     {
         unitSelector_ = new UnitSelector(this);
         connect(unitSelector_, SIGNAL(unitChanged()), this, SIGNAL(unitChanged()));
+        connect(unitSelector_, SIGNAL(orientationChanged()), this, SIGNAL(orientationChanged()));
     }
 
     unitSelector_->show();
@@ -88,6 +114,8 @@ void MainMenu::showAbout()
 
 void MainMenu::confirmReset()
 {
+    hide();
+
     QMessageBox::StandardButton result =  QMessageBox::question(this, tr("Reset all"),
              tr("Are you sure? All recorded data will be lost."),
              QMessageBox::Yes | QMessageBox::No);