git-svn-id: file:///svnroot/speedometer/trunk@44 df364472-da61-43ef-8a67-511c89aa921b
authorwellu <wellu@wellu.org>
Wed, 8 Oct 2008 17:16:37 +0000 (17:16 +0000)
committerwellu <wellu@wellu.org>
Wed, 8 Oct 2008 17:16:37 +0000 (17:16 +0000)
12 files changed:
Makefile
callbacks.c
data/fs.png [new file with mode: 0644]
data/kmh.png [new file with mode: 0644]
data/mph.png [new file with mode: 0644]
data/ms.png [new file with mode: 0644]
data/units.xcf [new file with mode: 0644]
debian/changelog
debian/control
debian/rules
ui.c
ui.h

index cd7d4a9..c41164f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -27,11 +27,15 @@ install: all
        install -D data/speedometer.service $(DESTDIR)/usr/share/dbus-1/services/speedometer.service
        install -d $(DESTDIR)/usr/share/speedometer/
        install data/*.png $(DESTDIR)/usr/share/speedometer/
+       install -D data/speedometer-64.png $(DESTDIR)/usr/share/icons/hicolor/scalable/hildon/speedometer.png
 
 uninstall:
        rm -rf $(DESTDIR)/usr/share/speedometer
        rm -f $(DESTDIR)/bin/speedometer
        rm -f $(DESTDIR)/usr/share/applications/hildon/speedometer.desktop
        rm -f $(DESTDIR)/usr/share/dbus-1/services/speedometer.service
-       
+
+deb:
+       dpkg-buildpackage -rfakeroot -b
+
 
index 704f102..0cf0792 100644 (file)
@@ -91,7 +91,8 @@ gboolean top_event_box_button_press(GtkWidget* widget, GdkEventButton* event, gp
 gboolean middle_event_box_button_press(GtkWidget* widget, GdkEventButton* event, gpointer data) {
        gdouble x = event->x;
        g_print("Middle event box pressed at: %f\n", x);
-       g_print("TODO: change multiplier\n");
+       g_print("Changing conversion unit\n");
+       change_unit();
        return TRUE;
 }
 
diff --git a/data/fs.png b/data/fs.png
new file mode 100644 (file)
index 0000000..03e64c1
Binary files /dev/null and b/data/fs.png differ
diff --git a/data/kmh.png b/data/kmh.png
new file mode 100644 (file)
index 0000000..795547f
Binary files /dev/null and b/data/kmh.png differ
diff --git a/data/mph.png b/data/mph.png
new file mode 100644 (file)
index 0000000..0267895
Binary files /dev/null and b/data/mph.png differ
diff --git a/data/ms.png b/data/ms.png
new file mode 100644 (file)
index 0000000..3254766
Binary files /dev/null and b/data/ms.png differ
diff --git a/data/units.xcf b/data/units.xcf
new file mode 100644 (file)
index 0000000..d3222a5
Binary files /dev/null and b/data/units.xcf differ
index 541ad99..e20af31 100644 (file)
@@ -1,3 +1,11 @@
+speedometer (0.5) unstable; urgency=low
+
+  * Added graphics for showing current unit (e.g km/h).
+  * Conversion table implemented.
+  * Removed changelogs from the package.
+
+ -- Wellu Mäkinen <wellu@wellu.org>  Tue,  7 Oct 2008 21:42:57 +0300
+
 speedometer (0.4) unstable; urgency=low
 
   * Simplified interpret_speed_from_gps a lot.
index 98df437..b8919e3 100644 (file)
@@ -8,7 +8,24 @@ Standards-Version: 3.7.2
 Package: speedometer
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: Speedometer shows current speed on the screen.
- Speedometer shows your current speed in various units
- on the device screen. Speed is taken from GPS connection.
-
+Description: Shows your current speed on the screen using GPS.
+ Speedometer is an application that shows your current
+ speed on the screen in different units. Supported units are
+ km/h, mph, m/s and f/s. Application is using the whole screen
+ area available to maximize the size of the units. Mount it to
+ your car, boat or bicycle and you'll get as accurate speed 
+ as possible.
+XB-Maemo-Icon-26:
+ iVBORw0KGgoAAAANSUhEUgAAABoAAAAaCAYAAACpSkzOAAAAAXNSR0IArs4c
+ 6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0
+ SU1FB9gKCA4kFSsWLOsAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJ
+ TVBXgQ4XAAABjElEQVRIx+2WvarCMBiGX+WgdhYHoeDP0MUbcEsoXXRyELyc
+ 0MFN/NlcvIDiJYgmuQJ3XRQ6agsKrt8ZxMI5WukBKxzwhQzJk+Qh5IdkpJTk
+ ui4AgDGGV0ZrDQAQQgCcc+Kck5SSXh0pJd3mR1qS37IsYwycc6QVzjkYY8ji
+ TfmIPqJ40Xw+R6PRQD6fR7PZxHq9jlgQBHAcB4VCAY7jIAzDRCxW5HkewjBE
+ t9tFr9eLmBAClmUhCAJYlnV9WhKwW4fYW306ncgwjKheq9Vou90SEdFms6F6
+ vZ6ICSHo6R6Nx2N0Op2o7vs+KpUKAKBarcL3/UQMAL7iJLPZDJ7nQUqZ3qmb
+ TCYYDAZYLBYolUpRu2ma2O/3AIDdbgfTNBOxh6J+v4/pdIrVaoVyufyDtdtt
+ DIdDXC4XjEYjtFqtROzhYQBwV87nMxERHQ4Hsm2bcrkc2bZNx+MxGveMCSHo
+ bo+urscpFotYLpd/Zp+37p+ItNZQSqUmUEpBa31dkeu6qciUUrj9GTPv+kB+
+ A/Cv7s/4BhwSAAAAAElFTkSuQmCC
index 1335ffb..56f0d35 100755 (executable)
@@ -68,9 +68,9 @@ binary-indep: build install
 binary-arch: build install
        dh_testdir
        dh_testroot
-       dh_installchangelogs 
-       dh_installdocs
-       dh_installexamples
+#      dh_installchangelogs 
+#      dh_installdocs
+#      dh_installexamples
 #      dh_install
 #      dh_installmenu
 #      dh_installdebconf       
@@ -82,7 +82,7 @@ binary-arch: build install
 #      dh_installinit
 #      dh_installcron
 #      dh_installinfo
-       dh_installman
+#      dh_installman
        dh_link
        dh_strip
        dh_compress
diff --git a/ui.c b/ui.c
index d5394c7..70a7cfe 100644 (file)
--- a/ui.c
+++ b/ui.c
  * Base unit is m/s thus the first multiplier is
  * one. Units are in following order:
  *
- * m/s, km/h, mph
+ * m/s, km/h, mph, f/s, knot
  */
-gdouble conversion[] = { 1, 3.6, 2.237 };
+gdouble conversion[] = { 1, 3.6, 2.237, 3.281, 1.944 };
+guint unit = 1;
+#define UNIT_COUNT 4
+// TODO: wrap this mess up somewhere
+// TODO: knot graphics are missing
 
-static GdkPixbuf* big_graphics[10];                    // contains all the big graphics
-static GdkPixbuf* small_graphics[10];  // contains small graphics
-static GtkWidget* digits[5];           //
+static GdkPixbuf* big_graphics[14];
+static GdkPixbuf* small_graphics[14];
+static GtkWidget* digits[5];
+static GtkWidget* unit_graphic;
 
 #define IMAGE_PATH "/usr/share/speedometer/%d.png"
 
@@ -66,7 +71,7 @@ void load_graphics() {
         * and store the pixbufs to the array. Pixbufs are
         * correct size to be used in the big digits.
         */
-       while(i < 10) {
+       while(i < 14) {
                char* path = g_malloc(30);
                g_sprintf(path, IMAGE_PATH, i);
                g_print(path);
@@ -82,8 +87,8 @@ void load_graphics() {
 
                small_graphics[i] = gdk_pixbuf_scale_simple(
                                big_graphics[i],
-                               60,
-                               60,
+                               150,
+                               150,
                                GDK_INTERP_BILINEAR);
 
                i++;
@@ -97,6 +102,8 @@ void set_digits_to_zero() {
        digits[2] = gtk_image_new_from_pixbuf(big_graphics[0]);
        digits[3] = gtk_image_new_from_pixbuf(small_graphics[0]);
        digits[4] = gtk_image_new_from_pixbuf(small_graphics[0]);
+       // TODO: load this from GConf
+       unit_graphic = gtk_image_new_from_pixbuf(small_graphics[11]);
 }
 
 static void set_nth_digit(guint n, guint value) {
@@ -167,6 +174,7 @@ void create_ui(AppData* appdata) {
        gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(digits[2]), FALSE, FALSE, 0);
 
        // add small digits to another hbox
+       gtk_box_pack_start(GTK_BOX(bhbox), GTK_WIDGET(unit_graphic), FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(bhbox), GTK_WIDGET(digits[3]), FALSE, FALSE, 0);
        gtk_box_pack_start(GTK_BOX(bhbox), GTK_WIDGET(digits[4]), FALSE, FALSE, 0);
 
@@ -192,17 +200,29 @@ void create_ui(AppData* appdata) {
        gtk_widget_show_all(GTK_WIDGET(appdata->window));
 }
 
+void change_unit() {
+       unit++;
+
+       if(unit >= UNIT_COUNT) {
+               unit = 0;
+       }
+       g_print("Unit used in conversion: %f\n", conversion[unit]);
+
+       GdkPixbuf* buf = small_graphics[10 + unit];
+       gtk_image_set_from_pixbuf(GTK_IMAGE(unit_graphic), buf);
+}
+
 void interpret_and_set_speed(gdouble speed) {
        g_assert(!isnan(speed));
 
        /* speed is in m/s so let's convert
         * it to the unit that we are using
         */
-       speed *= conversion[1];
+       speed *= conversion[unit];
 
        /* Convert float to a 6 digits (including dot) wide
         * string with leading zeros. After conversion
-        * the speed might look like:
+        * the speed looks like:
         *
         * 009.20 (9,20 km/h) or
         * 010.90 (10,90 km/h) or
diff --git a/ui.h b/ui.h
index 7d5114f..a9a4207 100644 (file)
--- a/ui.h
+++ b/ui.h
@@ -33,6 +33,9 @@ void create_ui(AppData* appdata);
 // signal handlers
 void connect_signals(AppData* appdata);
 
+// changes the conversion unit and sets new graphics according
+void change_unit();
+
 // converts and sets the speed on display
 void interpret_and_set_speed(gdouble speed);