From: eshe Date: Tue, 27 Jul 2010 08:47:02 +0000 (+0100) Subject: Small optimization to media player. Web page updated. X-Git-Url: http://git.maemo.org/git/?p=jspeed;a=commitdiff_plain;h=f9714dfee601882e7081bce34dc34558412e56ab Small optimization to media player. Web page updated. --- diff --git a/src/mediaplayer.cpp b/src/mediaplayer.cpp index a9c6b6d..6651036 100644 --- a/src/mediaplayer.cpp +++ b/src/mediaplayer.cpp @@ -18,6 +18,7 @@ #include #include +#include #include #include "mediaplayer.h" #include "settings.h" @@ -28,10 +29,10 @@ namespace QString const LOCAL_SOUND_DIR = ":/resources/sounds/"; } -QMediaPlayer MediaPlayer::player_; - bool MediaPlayer::play(QString const& file) { + static QMediaPlayer player; + QMediaContent media(QUrl::fromLocalFile(file)); if(media.isNull()) @@ -39,8 +40,8 @@ bool MediaPlayer::play(QString const& file) return false; } - player_.setMedia(media); - player_.play(); + player.setMedia(media); + player.play(); return true; } diff --git a/src/mediaplayer.h b/src/mediaplayer.h index 2bba0ec..9a8ce7a 100644 --- a/src/mediaplayer.h +++ b/src/mediaplayer.h @@ -22,7 +22,6 @@ #include #include #include -#include class MediaPlayer { @@ -34,9 +33,6 @@ public: static QStringList getFormatPatterns(); static QString getSoundDir(); static QString const& getLocalSoundDir(); - -private: - static QMediaPlayer player_; }; #endif diff --git a/www/css/style.css b/www/css/style.css index ad9005a..7384420 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -196,6 +196,10 @@ a:hover { margin-bottom: 0.8em; } +#main-content ul { + margin-left: 35px; +} + .theme { float: left; width: 268px; @@ -270,12 +274,13 @@ pre.code { margin-bottom: 14px; width: 100%; border: 1px solid #ccc; + font-size: 14px; } .spec th { text-align: left; font-weight: bold; - padding: 6px; + padding: 2px 6px; white-space: nowrap; } @@ -285,7 +290,8 @@ pre.code { } .spec td { - padding: 2px 6px 2px 6px; + padding: 1px 6px 1px 6px; + vertical-align: top; } .spec .color, .spec .color td, .spec .color th { @@ -307,3 +313,17 @@ pre.code { .contents { margin-bottom: 15px; } + +.imageinfo { + border: 1px solid #ccc; + padding: 5px; + float: left; + margin: 10px 15px 30px 0; + text-align: center; +} + +.imageinfo p { + margin: 0 !important; + font-size: 13px; + font-weight: bold; +} \ No newline at end of file diff --git a/www/documentation.html b/www/documentation.html new file mode 100644 index 0000000..98f1d65 --- /dev/null +++ b/www/documentation.html @@ -0,0 +1,101 @@ + + + + + + +jSpeed - Documentation + + + + + + + + + + + + + + + + + +
+ +
+ +

Documentation

+ + +

Speed camera alerts

+ +

Speed cameras are supported in jSpeed. All you need is a poi file containing speed camera locations in ASC format. You can convert almost any poi format to ASC using GPSBabel (screenshot for correct output options) or PoiEdit. Poi files should be located in /home/user/.jspeed/pois/.

+ +

Links to speed camera databases:

+ + +

Sounds

+ +

You can add new sounds to speed camera alerts and speed alarm by moving sound files to /home/user/.jspeed/sounds/. Currently wav, mp3 and aac files are supported.

+ +

Themes

+ +

Theme files are located in /home/user/.speed/themes/. For more information about how to make your own theme, take a look at the theme howto.

+ +
+ +
+ +
+ +
+ +
+ +

Download

+ +

jSpeed can be downloaded from Maemo extras-devel repository.

+ +
+ +
+ +

License

+ +

jSpeed is licensed under the terms of the GNU General Public License.

+ +
+ + + + + +
+ +
+ + + + diff --git a/www/img/16M.png b/www/img/16M.png new file mode 100644 index 0000000..0597b86 Binary files /dev/null and b/www/img/16M.png differ diff --git a/www/img/256.png b/www/img/256.png new file mode 100644 index 0000000..d851407 Binary files /dev/null and b/www/img/256.png differ diff --git a/www/img/gpsbabel.jpg b/www/img/gpsbabel.jpg new file mode 100644 index 0000000..690034d Binary files /dev/null and b/www/img/gpsbabel.jpg differ diff --git a/www/img/themes/lcd-bike-dark.jpg b/www/img/themes/lcd-bike-dark.jpg new file mode 100644 index 0000000..40bee60 Binary files /dev/null and b/www/img/themes/lcd-bike-dark.jpg differ diff --git a/www/img/themes/lcd-bike-dark_thumb.jpg b/www/img/themes/lcd-bike-dark_thumb.jpg new file mode 100644 index 0000000..24d5839 Binary files /dev/null and b/www/img/themes/lcd-bike-dark_thumb.jpg differ diff --git a/www/img/themes/lcd-bike.jpg b/www/img/themes/lcd-bike.jpg new file mode 100644 index 0000000..2233f67 Binary files /dev/null and b/www/img/themes/lcd-bike.jpg differ diff --git a/www/img/themes/lcd-bike_thumb.jpg b/www/img/themes/lcd-bike_thumb.jpg new file mode 100644 index 0000000..dda4a76 Binary files /dev/null and b/www/img/themes/lcd-bike_thumb.jpg differ diff --git a/www/index.html b/www/index.html index e133a24..c2518be 100644 --- a/www/index.html +++ b/www/index.html @@ -25,6 +25,7 @@ @@ -36,9 +37,9 @@

jSpeed is a free Maemo 5 speedometer application featuring

    +
  • Speed camera support
  • Auto rotation support
  • High customizability using themes
  • -
  • Support for both kilometers and miles
  • Screen flipping feature allowing the speedometer to be reflected on a car’s windshield
diff --git a/www/theme-howto.html b/www/theme-howto.html index 6120e57..d988069 100644 --- a/www/theme-howto.html +++ b/www/theme-howto.html @@ -23,6 +23,7 @@ @@ -56,6 +57,9 @@ Tag: pointer
  • + Tag: compass +
  • +
  • Tag: text
  • @@ -64,7 +68,9 @@

    jSpeed theme files (ie. default.jspeed) are just regular zip-files renamed to .jspeed. The path for theme files is /home/user/.jspeed/themes.

    -

    Each of these zip-files contains at least one file called theme.xml, which contains all the information required to draw the theme. Theme file may also contain image files and fonts required for the theme. A simple theme.xml could look like this:

    +

    Each of these zip-files contains at least one file called theme.xml, which contains all the information required to draw the theme. Theme file may also contain image files and fonts required for the theme.

    + +

    A simple theme.xml could look like this:

     <theme>
    @@ -228,6 +234,10 @@
     	Defines the z-index of an element. An element with bigger zpos gets painted over an element with smaller zpos.
     	
    <zpos>5</xpos>
    + + visiblewhen + Defines when element should be visible. Possible values are always (default), poivisible (show only when there is a poi (ie. speed camera) in view) and speedexceeded (show only when speed threshold is exceeded and speed alarm is enabled). + effect Defines an effect to used with the element. See effects for more details. @@ -239,7 +249,7 @@

    Effects

    -

    Each element can contain one effect which is used every time the element is painted or updated.

    +

    Each element can contain one effect which is used every time the element is painted or updated. Note: There are some bugs in effect redrawing in Qt especially on 24-bit png-images.

    @@ -270,8 +280,7 @@ <yoffset>0</yoffset> <radius>35</radius> <color>#a5efff</color> -</effect> - +</effect> @@ -285,6 +294,17 @@ </effect> + + + + +
    flicker + interval: sets the flickering interval of an element in milliseconds.
    +
    +
    <effect name="flicker">
    +	<interval>500</interval>
    +</effect>
    +

    Tag: rectangle

    @@ -361,9 +381,35 @@
    +

    Another example, shows a flickering speed camera warning image when there is a speed camera in view.

    + +
    +<image>
    +	<src>speedcamera.png</src>
    +	<xpos>15</xpos>
    +	<ypos>50</ypos>
    +	<visiblewhen>poisivible</visiblewhen>
    +	<effect name="flicker">
    +		<interval>400</interval>
    +	</effect>
    +</image>
    +
    + +

    Images in theme files should be saved in 256 colors because the dithering in Qt/Maemo is not very good. You can do that in example in IrfanView by selecting Image -> Decrease color depth. Just make sure that "Use Floyd-Steinberg dithering" is selected. Although 256 colors may not sound much, it is enough for most of the images. Here's the difference between gradient at 16.7 million colors and 256 colors on the N900's screen:

    + +
    +16.7 Million colors +

    16.7 million colors

    +
    + +
    +256 colors +

    256 colors

    +
    + -

    Tag: pointer

    +

    Tag: pointer

    Draws a pointer which moves according to current speed. Can be used to draw analog speedometers. The image file should be placed in the same .jspeed file as theme.xml. The xpos and ypos of a pointer are specified as the rotation point of the pointer on screen (usually somewhere in the middle of the screen).

    @@ -428,6 +474,47 @@ +

    Tag: compass

    + +

    Draws a compass which is always rotated so that the top of the compass image points to north. The xpos and ypos of a pointer are specified as the rotation point of the compass on screen (usually somewhere in the middle of the screen).

    + + + + + + + + + + + + + + + + + + + + + + +
    OptionDefinitionExample
    srcThe image file used to draw the compass.
    <src>pointer.png</src>
    xrotationpointThe compass rotates around the point defined with xrotationpoint and yrotationpoint. It is usually located inside the compass image.
    <xrotationpoint>200</xrotationpoint>
    yrotationpointThe compass rotates around the point defined with xrotationpoint and yrotationpoint. It is usually located inside the compass image.
    <yrotationpoint>12</yrotationpoint>
    + +

    Example:

    + +
    +<compass>
    +	<src>pointer.png</src>
    +	<xpos>400</xpos>
    +	<ypos>320</ypos>
    +	<xrotationpoint>100</xrotationpoint>
    +	<yrotationpoint>100</yrotationpoint>
    +</compass>
    +
    + + +

    Tag: text

    Draws a text block on the screen.

    @@ -450,12 +537,16 @@ {SPEEDUNIT}: Speed unit (km/h or mph).
    {TIME}: Current time, formatted according to timeformat tag.
    {DATE}: Current date, formatted according to dateformat tag.
    + {POIDISTANCE}: Distance to the nearest poi (ie. speed camera). Empty if there is no poi in view
    + {ANGLE}: Angle of current direction in degrees. 0 means north.
    + {LATITUDE}: Current latitude.
    + {LONGITUDE}: Current longitude.
    <data>{SPEED}</data>
    format - Special fields trip, total, speed, maxspeed and avgspeed will be printed according to this format. This field should be in prinf format. + Special fields trip, total, speed, maxspeed, avgspeed, poidistance, angle, latitude and longitude will be printed according to this format. This field should be in prinf format.
    <format>%.1f</format>
    diff --git a/www/themes.html b/www/themes.html index 792d4bc..f255d61 100644 --- a/www/themes.html +++ b/www/themes.html @@ -23,6 +23,7 @@ @@ -61,6 +62,19 @@ +
    +
    lcd-bike
    +lcd-bike +Download +
    + +
    +
    lcd-bike dark
    +lcd-bike dark +Download +
    + +
    diff --git a/www/themes/bike_lcd.jspeed b/www/themes/bike_lcd.jspeed new file mode 100644 index 0000000..f9b13fd Binary files /dev/null and b/www/themes/bike_lcd.jspeed differ diff --git a/www/themes/bike_lcd_dark.jspeed b/www/themes/bike_lcd_dark.jspeed new file mode 100644 index 0000000..b7fddeb Binary files /dev/null and b/www/themes/bike_lcd_dark.jspeed differ