Add About Box, restructure main toolbar
authorThomas Perl <m@thp.io>
Wed, 11 Jan 2012 14:54:07 +0000 (15:54 +0100)
committerThomas Perl <m@thp.io>
Wed, 11 Jan 2012 14:54:07 +0000 (15:54 +0100)
gotovienna-qml
images/gotovienna-about-logo.svg [new file with mode: 0644]
qml/AboutBox.qml [new file with mode: 0644]
qml/gotovienna-about-logo.png [new file with mode: 0644]
qml/main.qml

index 4c3491e..fd7b9a5 100755 (executable)
@@ -4,7 +4,7 @@
 
 __author__ = 'kelvan <kelvan@logic.at>'
 __version__ = '0.9.0'
-__website__ = 'https://github.com/kelvan/gotoVienna/'
+__website__ = 'http://tinyurl.com/gotoVienna'
 __license__ = 'GNU General Public License v3 or later'
 
 from datetime import datetime
@@ -23,6 +23,26 @@ import sys
 import threading
 from datetime import time
 
+class AboutInfo(QObject):
+    def __init__(self):
+        QObject.__init__(self)
+
+    @Slot(result=unicode)
+    def getAppName(self):
+        return u'gotoVienna %s' % __version__
+
+    @Slot(result=unicode)
+    def getWebsiteURL(self):
+        return __website__
+
+    @Slot(result=unicode)
+    def getCopyright(self):
+        return 'Copyright 2011, 2012 %s' % __author__
+
+    @Slot(result=unicode)
+    def getLicense(self):
+        return __license__
+
 class GotoViennaListModel(QAbstractListModel):
     def __init__(self, objects=None):
         QAbstractListModel.__init__(self)
@@ -191,12 +211,15 @@ if __name__ == '__main__':
 
     view = QDeclarativeView()
 
+    aboutInfo = AboutInfo()
+
     # instantiate the Python object
     itip = Gui()
 
     # expose the object to QML
     context = view.rootContext()
     context.setContextProperty('itip', itip)
+    context.setContextProperty('aboutInfo', aboutInfo)
 
     if os.path.abspath(__file__).startswith('/usr/bin/'):
         # Assume system-wide installation, QML from /usr/share/
diff --git a/images/gotovienna-about-logo.svg b/images/gotovienna-about-logo.svg
new file mode 100644 (file)
index 0000000..a339892
--- /dev/null
@@ -0,0 +1,411 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:xlink="http://www.w3.org/1999/xlink"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="80"
+   height="80"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.48.1 r9760"
+   sodipodi:docname="gotovienna-about-logo.svg"
+   inkscape:export-filename="/home/thp/src/gotoVienna/qml/gotovienna-about-logo.png"
+   inkscape:export-xdpi="225"
+   inkscape:export-ydpi="225">
+  <defs
+     id="defs4">
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#OVERLAY_5_"
+       id="linearGradient3526"
+       gradientUnits="userSpaceOnUse"
+       x1="39.9995"
+       y1="5.1816001"
+       x2="39.9995"
+       y2="58.801899" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#HIGHLIGHT_5_"
+       id="linearGradient3528"
+       gradientUnits="userSpaceOnUse"
+       x1="39.9995"
+       y1="1.2471"
+       x2="39.9995"
+       y2="78.511101" />
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="11.313708"
+     inkscape:cx="31.467526"
+     inkscape:cy="26.719623"
+     inkscape:document-units="px"
+     inkscape:current-layer="DO_NOT_EDIT_-_HIGHLIGHT"
+     showgrid="false"
+     inkscape:window-width="1920"
+     inkscape:window-height="1146"
+     inkscape:window-x="0"
+     inkscape:window-y="26"
+     inkscape:window-maximized="1"
+     fit-margin-top="0"
+     fit-margin-left="0"
+     fit-margin-right="0"
+     fit-margin-bottom="0"
+     showguides="true"
+     inkscape:guide-bbox="true" />
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(-55.714287,-24.108724)">
+    <g
+       inkscape:groupmode="layer"
+       id="layer2"
+       inkscape:label="Layer">
+      <g
+         id="g3418"
+         transform="translate(55.714287,24.108724)">
+        <g
+           id="DO_NOT_EDIT_-_HIGHLIGHT">
+          <defs
+             id="defs3346">
+            <filter
+               height="78"
+               width="77.953003"
+               y="1"
+               x="1.023"
+               filterUnits="userSpaceOnUse"
+               id="Adobe_OpacityMaskFilter"
+               color-interpolation-filters="sRGB">
+              <feFlood
+                 id="feFlood3349"
+                 result="back" />
+              <feBlend
+                 id="feBlend3351"
+                 mode="normal"
+                 in2="back"
+                 in="SourceGraphic" />
+            </filter>
+          </defs>
+          <mask
+             id="OVERLAY_2_"
+             height="78"
+             width="77.953"
+             y="1"
+             x="1.023"
+             maskUnits="userSpaceOnUse">
+            <g
+               id="g3354"
+               style="filter:url(#Adobe_OpacityMaskFilter)">
+              <defs
+                 id="defs3356">
+                <filter
+                   height="78"
+                   width="77.953003"
+                   y="1"
+                   x="1.023"
+                   filterUnits="userSpaceOnUse"
+                   id="Adobe_OpacityMaskFilter_1_"
+                   color-interpolation-filters="sRGB">
+                  <feFlood
+                     id="feFlood3359"
+                     result="back" />
+                  <feBlend
+                     id="feBlend3361"
+                     mode="normal"
+                     in2="back"
+                     in="SourceGraphic" />
+                </filter>
+              </defs>
+              <mask
+                 id="mask3363"
+                 height="78"
+                 width="77.953"
+                 y="1"
+                 x="1.023"
+                 maskUnits="userSpaceOnUse">
+                <g
+                   id="g3365"
+                   style="filter:url(#Adobe_OpacityMaskFilter_1_)" />
+              </mask>
+              <linearGradient
+                 y2="58.801899"
+                 x2="39.9995"
+                 y1="5.1816001"
+                 x1="39.9995"
+                 gradientUnits="userSpaceOnUse"
+                 id="OVERLAY_3_">
+                <stop
+                   id="stop3368"
+                   style="stop-color:#FFFFFF"
+                   offset="0" />
+                <stop
+                   id="stop3370"
+                   style="stop-color:#D6D6D6"
+                   offset="1" />
+              </linearGradient>
+              <path
+                 d="M 78.977,40 C 78.977,68.893 68.877,79 40,79 11.123,79 1.023,68.893 1.023,40 1.023,11.106 11.123,1 40,1 68.877,1 78.977,11.106 78.977,40 z"
+                 mask="url(#OVERLAY_2_)"
+                 id="OVERLAY_4_"
+                 inkscape:connector-curvature="0"
+                 style="fill:url(#OVERLAY_3_)" />
+            </g>
+          </mask>
+          <linearGradient
+             y2="58.801899"
+             x2="39.9995"
+             y1="5.1816001"
+             x1="39.9995"
+             gradientUnits="userSpaceOnUse"
+             id="OVERLAY_5_">
+            <stop
+               id="stop3374"
+               style="stop-color:#c8c8c8;stop-opacity:1;"
+               offset="0" />
+            <stop
+               id="stop3376"
+               style="stop-color:#575757;stop-opacity:1;"
+               offset="1" />
+          </linearGradient>
+          <path
+             d="M 78.977,40 C 78.977,68.893 68.877,79 40,79 11.123,79 1.023,68.893 1.023,40 1.023,11.106 11.123,1 40,1 68.877,1 78.977,11.106 78.977,40 z"
+             id="OVERLAY_1_"
+             inkscape:connector-curvature="0"
+             style="opacity:1;fill:url(#linearGradient3526)" />
+          <path
+             style="opacity:0.09465021;color:#000000;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+             d="m 39.003999,7.0307796 c -18.89859,0 -34.2187495,14.4046984 -34.2187495,32.1875004 0,6.525043 2.0797,12.583695 5.6249995,17.65625 2.24659,0.263947 4.53399,0.40625 6.875,0.40625 25.314342,0 45.84375,-16.014576 45.84375,-35.75 0,-1.949097 -0.208579,-3.854359 -0.59375,-5.71875 C 56.404484,10.355444 48.108938,7.0307796 39.003999,7.0307796 z"
+             id="path3815"
+             inkscape:connector-curvature="0" />
+          <defs
+             id="defs3379">
+            <filter
+               height="78"
+               width="78"
+               y="1"
+               x="1"
+               filterUnits="userSpaceOnUse"
+               id="Adobe_OpacityMaskFilter_2_"
+               color-interpolation-filters="sRGB">
+              <feFlood
+                 id="feFlood3382"
+                 result="back" />
+              <feBlend
+                 id="feBlend3384"
+                 mode="normal"
+                 in2="back"
+                 in="SourceGraphic" />
+            </filter>
+          </defs>
+          <mask
+             id="HIGHLIGHT_2_"
+             height="78"
+             width="78"
+             y="1"
+             x="1"
+             maskUnits="userSpaceOnUse">
+            <g
+               id="g3387"
+               style="filter:url(#Adobe_OpacityMaskFilter_2_)">
+              <defs
+                 id="defs3389">
+                <filter
+                   height="78"
+                   width="78"
+                   y="1"
+                   x="1"
+                   filterUnits="userSpaceOnUse"
+                   id="Adobe_OpacityMaskFilter_3_"
+                   color-interpolation-filters="sRGB">
+                  <feFlood
+                     id="feFlood3392"
+                     result="back" />
+                  <feBlend
+                     id="feBlend3394"
+                     mode="normal"
+                     in2="back"
+                     in="SourceGraphic" />
+                </filter>
+              </defs>
+              <mask
+                 id="mask3396"
+                 height="78"
+                 width="78"
+                 y="1"
+                 x="1"
+                 maskUnits="userSpaceOnUse">
+                <g
+                   id="g3398"
+                   style="filter:url(#Adobe_OpacityMaskFilter_3_)" />
+              </mask>
+              <linearGradient
+                 y2="78.511101"
+                 x2="39.9995"
+                 y1="1.2471"
+                 x1="39.9995"
+                 gradientUnits="userSpaceOnUse"
+                 id="HIGHLIGHT_3_">
+                <stop
+                   id="stop3401"
+                   style="stop-color:#FFFFFF"
+                   offset="0" />
+                <stop
+                   id="stop3403"
+                   style="stop-color:#000000"
+                   offset="1" />
+              </linearGradient>
+              <path
+                 d="M 39.999,1 C 11.105,1 1,11.106 1,40 1,68.893 11.105,79 39.999,79 68.896,79 79,68.893 79,40 79,11.106 68.896,1 39.999,1 z m 0,77.025 C 11.57,78.025 1.976,68.43 1.976,40 c 0,-28.429 9.595,-38.024 38.023,-38.024 28.43,0 38.024,9.596 38.024,38.024 0,28.43 -9.594,38.025 -38.024,38.025 z"
+                 mask="url(#HIGHLIGHT_2_)"
+                 id="HIGHLIGHT_4_"
+                 inkscape:connector-curvature="0"
+                 style="fill:url(#HIGHLIGHT_3_)" />
+            </g>
+          </mask>
+          <linearGradient
+             y2="78.511101"
+             x2="39.9995"
+             y1="1.2471"
+             x1="39.9995"
+             gradientUnits="userSpaceOnUse"
+             id="HIGHLIGHT_5_">
+            <stop
+               id="stop3407"
+               style="stop-color:#FFFFFF"
+               offset="0" />
+            <stop
+               id="stop3409"
+               style="stop-color:#FFFFFF"
+               offset="1" />
+          </linearGradient>
+          <path
+             d="M 39.999,1 C 11.105,1 1,11.106 1,40 1,68.893 11.105,79 39.999,79 68.896,79 79,68.893 79,40 79,11.106 68.896,1 39.999,1 z m 0,77.025 C 11.57,78.025 1.976,68.43 1.976,40 c 0,-28.429 9.595,-38.024 38.023,-38.024 28.43,0 38.024,9.596 38.024,38.024 0,28.43 -9.594,38.025 -38.024,38.025 z"
+             id="HIGHLIGHT_1_"
+             inkscape:connector-curvature="0"
+             style="opacity:0.25;fill:url(#linearGradient3528)" />
+        </g>
+        <g
+           id="DO_NOT_EDIT_-_BOUNDING_BOX">
+          <rect
+             height="80"
+             width="80"
+             id="BOUNDING_BOX"
+             x="0"
+             y="0"
+             style="fill:none" />
+        </g>
+        <g
+           id="PLACE_YOUR_BACKGROUND_HERE">
+          <g
+             id="INDIVIDUAL_BACKGROUND_1_">
+            <defs
+               id="defs3336">
+              <path
+                 d="M 79,40 C 79,68.893 68.895,79 40,79 11.105,79 1,68.893 1,40 1,11.106 11.105,1 40,1 68.895,1 79,11.106 79,40 z"
+                 id="CLIPPING_PATH__x28_MASK_x29__2_"
+                 inkscape:connector-curvature="0" />
+            </defs>
+            <clipPath
+               id="CLIPPING_PATH__x28_MASK_x29__1_">
+              <use
+                 id="use3340"
+                 overflow="visible"
+                 xlink:href="#CLIPPING_PATH__x28_MASK_x29__2_"
+                 style="overflow:visible"
+                 x="0"
+                 y="0"
+                 width="1"
+                 height="1" />
+            </clipPath>
+            <rect
+               height="80"
+               width="80"
+               clip-path="url(#CLIPPING_PATH__x28_MASK_x29__1_)"
+               id="INVISIVLE_PATH_2_"
+               x="0"
+               y="0"
+               style="fill:none" />
+          </g>
+        </g>
+        <g
+           id="PLACE_YOUR_GLYPH_HERE" />
+        <g
+           id="DO_NOT_EDIT_-_FOCAL_ZONE_GUIDES" />
+      </g>
+    </g>
+    <text
+       xml:space="preserve"
+       style="font-size:24px;font-style:normal;font-weight:normal;line-height:69.99999881%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+       x="61.164482"
+       y="66.636955"
+       id="text2985"
+       sodipodi:linespacing="69.999999%"><tspan
+         sodipodi:role="line"
+         id="tspan2987"
+         x="61.164482"
+         y="66.636955"
+         dy="0 -5.48"
+         dx="0 0"><tspan
+           style="font-size:40px;line-height:69.99999881%;fill:#e30014;fill-opacity:0.94117647"
+           id="tspan2989"
+           dy="5.48"
+           dx="0"
+           rotate="0 0">g</tspan><tspan
+           style="font-size:28px;fill:#ffffff;fill-opacity:1"
+           id="tspan3267">oto</tspan></tspan><tspan
+         sodipodi:role="line"
+         x="61.164482"
+         y="81.240646"
+         dy="0 0 0 0 0 -0.02"
+         dx="0 0 0 0 0 0"
+         id="tspan3005"
+         style="font-size:16px;line-height:69.99999881%">    </tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+       x="84.401787"
+       y="81.042397"
+       id="text3263"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan3265"
+         x="84.401787"
+         y="81.042397"
+         style="font-size:14px;fill:#ffffff;fill-opacity:1">vienna</tspan></text>
+    <text
+       xml:space="preserve"
+       style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
+       x="41.289986"
+       y="81.858124"
+       id="text3269"
+       sodipodi:linespacing="125%"><tspan
+         sodipodi:role="line"
+         id="tspan3271"
+         x="41.289986"
+         y="81.858124" /></text>
+  </g>
+</svg>
diff --git a/qml/AboutBox.qml b/qml/AboutBox.qml
new file mode 100644 (file)
index 0000000..4500937
--- /dev/null
@@ -0,0 +1,66 @@
+
+import QtQuick 1.0
+
+Rectangle {
+    id: aboutBox
+    property string appName: 'MyApp x.y.z'
+    property string websiteURL: 'http://example.org/'
+    property string copyright: ''
+    property string license: ''
+    property string iconFilename: ''
+    width: 480
+    height: 800
+
+    function show() { opacity = 1 }
+
+    color: '#dd000000'
+    opacity: 0
+    Behavior on opacity { PropertyAnimation { } }
+
+    MouseArea {
+        anchors.fill: parent
+        onClicked: aboutBox.opacity = 0
+    }
+
+    Column {
+        anchors.centerIn: parent
+        spacing: 5
+        scale: Math.pow(parent.opacity, 3)
+        width: 440
+
+        Item {
+            height: aboutBoxIcon.sourceSize.height
+            width: parent.width
+
+            Image {
+                id: aboutBoxIcon
+                anchors.centerIn: parent
+                source: aboutBox.iconFilename
+            }
+        }
+
+        Text {
+            color: 'white'
+            font.pixelSize: 30
+            font.bold: true
+            text: aboutBox.appName
+            anchors.horizontalCenter: parent.horizontalCenter
+        }
+
+        Text {
+            color: 'white'
+            text: aboutBox.websiteURL
+            font.pixelSize: 25
+            anchors.horizontalCenter: parent.horizontalCenter
+        }
+
+        Text {
+            color: 'white'
+            font.pixelSize: 17
+            text: '\n' + aboutBox.copyright + '\n' + aboutBox.license
+            anchors.horizontalCenter: parent.horizontalCenter
+            horizontalAlignment: Text.AlignHCenter
+        }
+    }
+}
+
diff --git a/qml/gotovienna-about-logo.png b/qml/gotovienna-about-logo.png
new file mode 100644 (file)
index 0000000..847aee0
Binary files /dev/null and b/qml/gotovienna-about-logo.png differ
index 36c80a2..0b34290 100644 (file)
@@ -6,9 +6,21 @@ PageStackWindow {
     id: appWindow
 
     initialPage: mainPage
+    showToolBar: aboutBox.opacity == 0
 
     MainPage {
         id: mainPage
+
+        AboutBox {
+            id: aboutBox
+            anchors.fill: parent
+
+            appName: aboutInfo.getAppName()
+            websiteURL: aboutInfo.getWebsiteURL()
+            copyright: aboutInfo.getCopyright()
+            license: aboutInfo.getLicense()
+            iconFilename: 'gotovienna-about-logo.png'
+        }
     }
 
     PositionSource {
@@ -20,22 +32,16 @@ PageStackWindow {
 
     ToolBarLayout {
         id: commonTools
-        visible: true
-        /*ToolIcon {
-            platformIconId: "toolbar-view-menu"
-            anchors.right: (parent === undefined) ? undefined : parent.right
-            onClicked: (menu.status == DialogStatus.Closed) ? menu.open() : menu.close()
-        }*/
         ToolIcon {
-              enabled: mainPage.canRefresh
-              platformIconId: enabled ? 'icon-m-toolbar-refresh' : 'icon-m-toolbar-refresh-dimmed'
-              anchors.right: parent.right
-              onClicked: mainPage.refresh()
+            platformIconId: "toolbar-view-menu"
+            anchors.right: parent.right
+            onClicked: menu.open()
         }
 
         ToolIcon {
-              platformIconId: enabled ? 'icon-m-toolbar-refresh' : 'icon-m-toolbar-refresh-dimmed'
-              anchors.right: parent.right
+              visible: mainPage.canRefresh
+              platformIconId: 'icon-m-toolbar-refresh'
+              anchors.centerIn: parent
               onClicked: mainPage.refresh()
         }
 
@@ -44,21 +50,10 @@ PageStackWindow {
             source: 'logo.png'
 
             anchors {
-                bottomMargin: 10
-                bottom: parent.bottom
+                verticalCenter: parent.verticalCenter
                 left: parent.left
                 leftMargin: 10
             }
-
-            MouseArea {
-                anchors.fill: parent
-                onClicked: {
-                    //console.debug(itip.get_nearby_stations(positionSource.position.coordinate.latitude, positionSource.position.coordinate.longitude))
-                    //debugText.text = itip.get_nearby_stations(positionSource.position.coordinate.latitude, positionSource.position.coordinate.longitude)
-                    //itip.load_nearby_departures(positionSource.position.coordinate.latitude, positionSource.position.coordinate.longitude)
-                    mainPage.showNearby()
-                }
-            }
         }
 
         Text {
@@ -76,11 +71,18 @@ PageStackWindow {
         }
     }
 
-    /*Menu {
+    Menu {
         id: menu
-        visualParent: pageStack
+
         MenuLayout {
-            MenuItem { text: "Test"; onClicked: pageStack.push(Qt.resolvedUrl("test.qml")) }
+            MenuItem {
+                text: 'Nearby stations'
+                onClicked: mainPage.showNearby()
+            }
+            MenuItem {
+                text: 'About gotoVienna'
+                onClicked: aboutBox.show()
+            }
         }
-    }*/
+    }
 }