Added new settings button to set a fake current location ('work' in the first instance).
authorMax Waterman <davidmaxwaterman+maemogit@fastmail.co.uk>
Sun, 28 Mar 2010 01:31:04 +0000 (04:31 +0300)
committerMax Waterman <davidmaxwaterman+maemogit@fastmail.co.uk>
Sun, 28 Mar 2010 01:31:04 +0000 (04:31 +0300)
14 files changed:
zouba/debian/compat
zouba/debian/control
zouba/debian/zouba.debhelper.log
zouba/debian/zouba.tarlist
zouba/debian/zouba/DEBIAN/control
zouba/debian/zouba/DEBIAN/md5sums
zouba/debian/zouba/usr/share/applications/hildon/zouba.desktop
zouba/debian/zouba/usr/share/dbus-1/services/zouba.service [deleted file]
zouba/debian/zouba/usr/share/doc/zouba/changelog.gz
zouba/src/gpscontroller.cpp
zouba/src/gpscontroller.h
zouba/src/main.cpp
zouba/src/ui.cpp
zouba/src/ui.h

index e34babd..650b536 100644 (file)
@@ -8,7 +8,7 @@ Homepage:
 
 Package: zouba
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libqtm-location (>=1.0.0-beta1-maemo4), libqtm-bearer (>=1.0.0-beta1-maemo4), libqt4-maemo5-core (>=4.6.2~git20100212-0maemo1) | libqt4-core (>=4.6.2~git20100212-0maemo1), libqt4-maemo5-gui (>=4.6.2~git20100212-0maemo1) | libqt4-gui (>=4.6.2~git20100212-0maemo1), libqt4-maemo5-xml (>=4.6.2~git20100212-0maemo1) | libqt4-xml (>=4.6.2~git20100212-0maemo1), libqt4-maemo5-network (>=4.6.2~git20100212-0maemo1) | libqt4-network (>=4.6.2~git20100212-0maemo1)
+Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Tells you which bus is next.
  Allows you to easily find how to get the bus home. Uses HSL Journey Planner API <http://developer.reittiopas.fi/pages/en/home.php>. Uses GPS for current location. Uses Qt and QtMobility.
 # XB-Maemo-Icon-26 field contains the application icon file encoded in
index 4597b74..44e74eb 100644 (file)
@@ -365,3 +365,68 @@ dh_installdeb
 dh_gencontrol
 dh_md5sums
 dh_builddeb
+dh_installdirs
+dh_installchangelogs
+dh_installdocs
+dh_installexamples
+dh_installman
+dh_link
+dh_strip
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
+dh_installdirs
+dh_installchangelogs
+dh_installdocs
+dh_installexamples
+dh_installman
+dh_link
+dh_strip
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
+dh_installdirs
+dh_installchangelogs
+dh_installdocs
+dh_installexamples
+dh_installman
+dh_link
+dh_strip
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
+dh_installdirs
+dh_installchangelogs
+dh_installdocs
+dh_installexamples
+dh_installman
+dh_link
+dh_strip
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
+dh_installdirs
+dh_installchangelogs
+dh_installdocs
+dh_installexamples
+dh_installman
+dh_link
+dh_strip
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_gencontrol
+dh_md5sums
+dh_builddeb
index 91806f2..a1dcb65 100644 (file)
@@ -1,8 +1,5 @@
 755 root root . usr  /
 755 root root . usr/share  /
-755 root root . usr/share/dbus-1  /
-755 root root . usr/share/dbus-1/services  /
-644 root root . usr/share/dbus-1/services/zouba.service debian/zouba/usr/share/dbus-1/services/zouba.service
 755 root root . usr/share/doc  /
 755 root root . usr/share/doc/zouba  /
 644 root root . usr/share/doc/zouba/changelog.gz debian/zouba/usr/share/doc/zouba/changelog.gz
index 404b6a6..fe7e8ab 100644 (file)
@@ -1,11 +1,10 @@
 Package: zouba
 Version: 0.2
-Architecture: armel
-Maintainer: Max Waterman <davidmaxwaterman@fastmail.co.uk>
-Installed-Size: 216
-Depends: libqtm-location (>= 1.0.0-beta1-maemo4), libqtm-bearer (>= 1.0.0-beta1-maemo4), libqt4-maemo5-core (>= 4.6.2~git20100212-0maemo1) | libqt4-core (>= 4.6.2~git20100212-0maemo1), libqt4-maemo5-gui (>= 4.6.2~git20100212-0maemo1) | libqt4-gui (>= 4.6.2~git20100212-0maemo1), libqt4-maemo5-xml (>= 4.6.2~git20100212-0maemo1) | libqt4-xml (>= 4.6.2~git20100212-0maemo1), libqt4-maemo5-network (>= 4.6.2~git20100212-0maemo1) | libqt4-network (>= 4.6.2~git20100212-0maemo1)
 Section: user/Other
 Priority: extra
+Architecture: armel
+Installed-Size: 204
+Maintainer: Max Waterman <davidmaxwaterman@fastmail.co.uk>
 Description: Tells you which bus is next.
  Allows you to easily find how to get the bus home. Uses HSL Journey Planner API <http://developer.reittiopas.fi/pages/en/home.php>. Uses GPS for current location. Uses Qt and QtMobility.
 Maemo-Icon-26: 
index 2878d4e..ca3b94b 100644 (file)
@@ -1,7 +1,6 @@
-fd259cf3be69375915fdb925257d2233  usr/share/dbus-1/services/zouba.service
-7582f909f6cf0329729f01e323e6c8a1  usr/share/doc/zouba/changelog.gz
+a3eca1c38f1826c11a407a961358565b  usr/share/doc/zouba/changelog.gz
 5a50138045dfccd50e9ec2f5fd769bcf  usr/share/doc/zouba/README.Debian
 b941bd01bcea49cabfc186309d46fb74  usr/share/doc/zouba/copyright
-f327a6f11a43e47223c6bebe5434fd81  usr/share/applications/hildon/zouba.desktop
+f0facd09bdb3ff735ea73938db3c774c  usr/share/applications/hildon/zouba.desktop
 85cbb61cacdd967b3e62a6ba0f84f0b2  usr/share/icons/hicolor/64x64/apps/zouba.png
 f9869b1dbe0a28a220a48ebad6ae8fd0  usr/bin/zouba
index 801ca65..57545da 100644 (file)
@@ -9,4 +9,3 @@ X-HildonDesk-ShowInToolbar=true
 X-Window-Icon=zouba
 X-Window-Icon-Dimmed=zouba
 X-Osso-Type=application/x-executable
-X-Osso-Service=com.nokia.zouba
diff --git a/zouba/debian/zouba/usr/share/dbus-1/services/zouba.service b/zouba/debian/zouba/usr/share/dbus-1/services/zouba.service
deleted file mode 100644 (file)
index 60c65cf..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=com.nokia.zouba
-Exec=/usr/bin/zouba
index 2d5fc20..8525599 100644 (file)
Binary files a/zouba/debian/zouba/usr/share/doc/zouba/changelog.gz and b/zouba/debian/zouba/usr/share/doc/zouba/changelog.gz differ
index 33ba7e6..3ca8847 100644 (file)
@@ -9,7 +9,8 @@ QTM_USE_NAMESPACE
 
 GpsController::GpsController() :
   m_location( QGeoPositionInfoSource::createDefaultSource(this) ),
-  currentLocation(0)
+  m_currentLocation(0),
+  m_useFakeLocation(false)
 {
   connect( 
       m_location, SIGNAL( positionUpdated( QGeoPositionInfo ) ),
@@ -23,19 +24,35 @@ GpsController::~GpsController()
 {
   delete m_location;
   m_location = 0;
-  delete currentLocation;
-  currentLocation = 0;
+  delete m_currentLocation;
+  m_currentLocation = 0;
 }
 
 void GpsController::updateLocation( QGeoPositionInfo positionInfo )
 {
-  delete currentLocation;
-  currentLocation = new Location( positionInfo );
+  delete m_currentLocation;
+  m_currentLocation = new Location( positionInfo );
 }
 
 void GpsController::getGps()
 {
-  if ( currentLocation != 0 ) {
-    emit locationChanged( currentLocation );
+  if ( m_currentLocation != 0 ) {
+    emit locationChanged( m_currentLocation );
   }
 }
+
+void GpsController::useLiveGps()
+{
+  m_location->startUpdates();
+  m_useFakeLocation=false;
+  m_currentLocation=0;
+}
+
+void GpsController::useFakeGps( Location *fakeLocation )
+{
+  m_location->stopUpdates();
+  m_useFakeLocation=true;
+  delete m_currentLocation;
+  m_currentLocation = new Location( *fakeLocation );
+  emit locationChanged( m_currentLocation );
+}
index 336d85c..14d58ff 100644 (file)
@@ -21,13 +21,16 @@ public:
 public Q_SLOTS:
   void updateLocation( QGeoPositionInfo positionInfo );
   void getGps();
+  void useFakeGps( Location *fakeLocation );
+  void useLiveGps();
 
 Q_SIGNALS:
   void locationChanged( Location *newLocation );
 
 private:
   QGeoPositionInfoSource *m_location;
-  Location *currentLocation;
+  Location               *m_currentLocation;
+  bool                    m_useFakeLocation;
 };
 
 #endif // GPSCONTROLLER_H
index 3af3f48..5361a10 100644 (file)
@@ -19,10 +19,10 @@ int main(int argc, char *argv[] )
   QApplication app(argc, argv);
 
   QMainWindow *mainWindow = new QMainWindow;
-  Ui ui;
-  ui.setupUi(mainWindow);
+  Ui *ui = new Ui;;
+  ui->setupUi(mainWindow);
 
-  UiController  *uiController  = new UiController( &ui );
+  UiController  *uiController  = new UiController( ui );
   Route         *route         = new Route();
   GpsController *gpsController = new GpsController();
 
@@ -46,6 +46,16 @@ int main(int argc, char *argv[] )
       gpsController, SLOT( getGps() )
     );
 
+  QObject::connect(
+      ui, SIGNAL( fakeGpsPressed( Location* ) ),
+      gpsController, SLOT( useFakeGps( Location* ) )
+    );
+
+  QObject::connect(
+      ui, SIGNAL( liveGpsPressed() ),
+      gpsController, SLOT( useLiveGps() )
+    );
+
   mainWindow->show();
 
   return app.exec();
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();
index 3bbca75..787eb63 100644 (file)
@@ -12,6 +12,7 @@ class QHBoxLayout;
 class QVBoxLayout;
 class QMenu;
 class QAction;
+class Location;
 
 class Ui : public QObject
 {
@@ -46,16 +47,22 @@ public:
   QMenu       *menu;
   QAction     *hideMessagesAction;
   QAction     *showMessagesAction;
+  QAction     *useFakeGpsAction;
+  QAction     *useLiveGpsAction;
 
 Q_SIGNALS:
   void homeAddressChanged( QString address );
   void workAddressChanged( QString address );
+  void fakeGpsPressed( Location * );
+  void liveGpsPressed();
 
 private Q_SLOTS:
   void setHomeAddress();
   void setWorkAddress();
   void hideMessages();
   void showMessages();
+  void useFakeGps();
+  void useLiveGps();
 
 private:
   void setAddress( const QString &label );