Added new settings button to set a fake current location ('work' in the first instance).
[ptas] / zouba / src / ui.cpp
index b6a029b..98aac09 100644 (file)
@@ -40,9 +40,12 @@ void Ui::setupUi( QMainWindow *mainWindow )
   QAction *setWorkAddressAction = new QAction("Set work address", this);
   hideMessagesAction   = new QAction("Hide messages", this);
   showMessagesAction   = new QAction("Show messages", this);
+  useFakeGpsAction   = new QAction("Use fake GPS", this);
+  useLiveGpsAction   = new QAction("Use live GPS", this);
   menu->addAction(setHomeAddressAction);
   menu->addAction(setWorkAddressAction);
   menu->addAction(showMessagesAction);
+  menu->addAction(useFakeGpsAction);
 
   connect(
       setHomeAddressAction, SIGNAL(triggered()),
@@ -60,6 +63,14 @@ void Ui::setupUi( QMainWindow *mainWindow )
       showMessagesAction, SIGNAL(triggered()),
       this, SLOT(showMessages())
       );
+  connect(
+      useFakeGpsAction, SIGNAL(triggered()),
+      this, SLOT(useFakeGps())
+      );
+  connect(
+      useLiveGpsAction, SIGNAL(triggered()),
+      this, SLOT(useLiveGps())
+      );
 
   centralWidget = new QWidget( mainWindow );
   mainWindow->setCentralWidget(centralWidget);
@@ -130,6 +141,24 @@ void Ui::showMessages()
   menu->addAction( hideMessagesAction );
 }
 
+void Ui::useFakeGps()
+{
+  // really want a dialog here
+  Locations *locations = Locations::instance();
+  Location *fakeLocation = locations->location( "work" );
+
+  emit fakeGpsPressed( fakeLocation );
+  menu->removeAction( useFakeGpsAction );
+  menu->addAction( useLiveGpsAction );
+}
+
+void Ui::useLiveGps()
+{
+  emit liveGpsPressed();
+  menu->removeAction( useLiveGpsAction );
+  menu->addAction( useFakeGpsAction );
+}
+
 void Ui::setAddress( const QString &label )
 {
   Locations *locations=Locations::instance();