From ce3f8b339792d266f7a43cca08da2b51b4ad71fc Mon Sep 17 00:00:00 2001 From: micu Date: Fri, 24 Feb 2017 16:22:50 +0100 Subject: [PATCH] Create a menu solution for both v-play and SFOS This commit provides the BVApp concept of a NavigationMenu, which can be assigned to an ApplicationWindow. It includes the notion of an initialMenuItem, which is ignored on Sailfish, as this item corresponds to the initialPage, which we do not want to have in the pulley menu again as an item. The initialPage in turn is ignored on v-play. Currently you have to set both values (initialMenuItem, initialPage) manually unfortunately. It should be possible to even generalize this. But it is unclear how far we actually want to take the menu abstraction anyway (or in which direction we want it to move, just consider toggleable menu items for list view and map view, for example). So we leave it like this atm. Even v-play went with a "hacked" (i.e. non declarative, but imperative) solution for the menu of their QtWorldSummit2016 app, when they wanted to do something more sophisticated then the standard NavigationMenu behavior: https://github.com/V-Play/QtWorldSummit2016-V-Play/blob/master/qml/QtWSMainItem.qml#L402 > if(Theme.isAndroid) { > navigation.addNavigationItem(tracksNavItemComponent) > navigation.addNavigationItem(venueNavItemComponent) > ... This commit also turns every menuItem on v-play automatically into an NavigationStack (for consitency with the typical stack based navigation common on Sailfish). BTW: The About page is still in rough state on we-pay ;) // Github issue #67 --- qml/Silica4v-play/ApplicationWindow.qml | 9 +---- qml/Silica4v-play/Button.qml | 6 ++++ qml/Silica4v-play/Page.qml | 3 +- qml/Silica4v-play/Separator.qml | 2 +- qml/Silica4v-play/qmldir | 1 + qml/Silica4v-play/resources-Silica4v-play.qrc | 1 + qml/components-Sailfish/MenuItem.qml | 9 +++++ qml/components-Sailfish/NavigationMenu.qml | 7 ++++ qml/components-Sailfish/Theme.qml | 1 + qml/components-Sailfish/qmldir | 2 ++ .../resources-components-Sailfish.qrc | 2 ++ qml/components-v-play/MenuItem.qml | 11 +++++++ qml/components-v-play/NavigationMenu.qml | 16 +++++++++ qml/components-v-play/Theme.qml | 5 +++ qml/components-v-play/qmldir | 2 ++ .../resources-components-v-play.qrc | 2 ++ qml/harbour-berlin-vegan.qml | 31 +++++++++++++++--- qml/pages/VenueList.qml | 10 +----- qml/pages/about/LicenseViewer.qml | 1 + translations/harbour-berlin-vegan-de.qm | Bin 4836 -> 4749 bytes translations/harbour-berlin-vegan-de.ts | 4 +++ translations/harbour-berlin-vegan-en.qm | Bin 4622 -> 4537 bytes translations/harbour-berlin-vegan-en.ts | 11 +++++-- translations/harbour-berlin-vegan.qm | Bin 0 -> 1991 bytes translations/harbour-berlin-vegan.ts | 22 +++++-------- 25 files changed, 116 insertions(+), 42 deletions(-) create mode 100644 qml/Silica4v-play/Button.qml create mode 100644 qml/components-Sailfish/MenuItem.qml create mode 100644 qml/components-Sailfish/NavigationMenu.qml create mode 100644 qml/components-v-play/MenuItem.qml create mode 100644 qml/components-v-play/NavigationMenu.qml create mode 100644 translations/harbour-berlin-vegan.qm diff --git a/qml/Silica4v-play/ApplicationWindow.qml b/qml/Silica4v-play/ApplicationWindow.qml index 9261301f..0685c065 100644 --- a/qml/Silica4v-play/ApplicationWindow.qml +++ b/qml/Silica4v-play/ApplicationWindow.qml @@ -8,18 +8,11 @@ App { id: app - property var pageStack: navigationStack - property var initialPage property var cover - - NavigationStack { - id: navigationStack - initialPage: app.initialPage - } + property var initialPage Component.onCompleted: { // We need to access the dp() function from the Theme component BVApp.Theme.myApp = app } - } diff --git a/qml/Silica4v-play/Button.qml b/qml/Silica4v-play/Button.qml new file mode 100644 index 00000000..57f73760 --- /dev/null +++ b/qml/Silica4v-play/Button.qml @@ -0,0 +1,6 @@ +import QtQuick 2.7 +import VPlayApps 1.0 + +AppButton { + +} diff --git a/qml/Silica4v-play/Page.qml b/qml/Silica4v-play/Page.qml index 0b82c497..ed72022a 100644 --- a/qml/Silica4v-play/Page.qml +++ b/qml/Silica4v-play/Page.qml @@ -1,9 +1,8 @@ import VPlayApps 1.0 ListPage { + property var pageStack: navigationStack //% "Berlin-Vegan" title: qsTrId("id-berlin-vegan") - } - diff --git a/qml/Silica4v-play/Separator.qml b/qml/Silica4v-play/Separator.qml index 7c804506..b2b6cf1e 100644 --- a/qml/Silica4v-play/Separator.qml +++ b/qml/Silica4v-play/Separator.qml @@ -2,6 +2,6 @@ import QtQuick 2.7 Rectangle { + property color color property var horizontalAlignment - } diff --git a/qml/Silica4v-play/qmldir b/qml/Silica4v-play/qmldir index a21c9315..b9d9739d 100644 --- a/qml/Silica4v-play/qmldir +++ b/qml/Silica4v-play/qmldir @@ -1,6 +1,7 @@ module Sailfish.Silica ApplicationWindow 1.0 ApplicationWindow.qml BusyIndicator 1.0 BusyIndicator.qml +Button 1.0 Button.qml CoverAction 1.0 CoverAction.qml CoverActionList 1.0 CoverActionList.qml CoverBackground 1.0 CoverBackground.qml diff --git a/qml/Silica4v-play/resources-Silica4v-play.qrc b/qml/Silica4v-play/resources-Silica4v-play.qrc index e90bf1b8..2d680884 100644 --- a/qml/Silica4v-play/resources-Silica4v-play.qrc +++ b/qml/Silica4v-play/resources-Silica4v-play.qrc @@ -21,5 +21,6 @@ SilicaListView.qml TruncationMode.qml VerticalScrollDecorator.qml + Button.qml diff --git a/qml/components-Sailfish/MenuItem.qml b/qml/components-Sailfish/MenuItem.qml new file mode 100644 index 00000000..6fc75d80 --- /dev/null +++ b/qml/components-Sailfish/MenuItem.qml @@ -0,0 +1,9 @@ +import Sailfish.Silica 1.0 as Silica +import QtQuick 2.0 + +Silica.MenuItem { + property var pageToVisit + property var icon + + onClicked: pageStack.push(pageToVisit) +} diff --git a/qml/components-Sailfish/NavigationMenu.qml b/qml/components-Sailfish/NavigationMenu.qml new file mode 100644 index 00000000..834d8e5e --- /dev/null +++ b/qml/components-Sailfish/NavigationMenu.qml @@ -0,0 +1,7 @@ +import Sailfish.Silica 1.0 as Silica +import QtQuick 2.2 + +Silica.PullDownMenu { + property var initialMenuItem +} + diff --git a/qml/components-Sailfish/Theme.qml b/qml/components-Sailfish/Theme.qml index ca416ea6..fbb6587d 100644 --- a/qml/components-Sailfish/Theme.qml +++ b/qml/components-Sailfish/Theme.qml @@ -35,6 +35,7 @@ QtObject { readonly property int fontSizeMedium: Silica.Theme.fontSizeMedium readonly property int fontSizeExtraSmall: Silica.Theme.fontSizeExtraSmall readonly property int fontSizeSmall: Silica.Theme.fontSizeSmall + readonly property int fontSizeLarge: Silica.Theme.fontSizeLarge readonly property int iconSizeMedium : Silica.Theme.iconSizeMedium readonly property int iconSizeLarge : Silica.Theme.iconSizeLarge diff --git a/qml/components-Sailfish/qmldir b/qml/components-Sailfish/qmldir index a7963de0..6faf9251 100644 --- a/qml/components-Sailfish/qmldir +++ b/qml/components-Sailfish/qmldir @@ -1,3 +1,5 @@ module BerlinVegan.components IconButton 1.0 IconButton.qml singleton Theme 1.0 Theme.qml +NavigationMenu 1.0 NavigationMenu.qml +MenuItem 1.0 MenuItem.qml diff --git a/qml/components-Sailfish/resources-components-Sailfish.qrc b/qml/components-Sailfish/resources-components-Sailfish.qrc index 1ad1c29c..a1bf74ed 100644 --- a/qml/components-Sailfish/resources-components-Sailfish.qrc +++ b/qml/components-Sailfish/resources-components-Sailfish.qrc @@ -3,5 +3,7 @@ IconButton.qml Theme.qml qmldir + NavigationMenu.qml + MenuItem.qml diff --git a/qml/components-v-play/MenuItem.qml b/qml/components-v-play/MenuItem.qml new file mode 100644 index 00000000..1e072b3f --- /dev/null +++ b/qml/components-v-play/MenuItem.qml @@ -0,0 +1,11 @@ +import QtQuick 2.7 +import VPlayApps 1.0 + +NavigationItem { + id: item + property var pageToVisit + property alias text: item.title + NavigationStack { + initialPage: pageToVisit + } +} diff --git a/qml/components-v-play/NavigationMenu.qml b/qml/components-v-play/NavigationMenu.qml new file mode 100644 index 00000000..72604711 --- /dev/null +++ b/qml/components-v-play/NavigationMenu.qml @@ -0,0 +1,16 @@ +import QtQuick 2.7 +import VPlayApps 1.0 + +Navigation { + property var initialMenuItem + property var flickable + + Component.onCompleted: { + var initObj = + insertNavigationItem(0, Qt.createComponent("MenuItem.qml")) + initObj.icon = initialMenuItem.icon + initObj.pageToVisit = initialMenuItem.pageToVisit + initObj.text = initialMenuItem.text + currentIndex = 0 + } +} diff --git a/qml/components-v-play/Theme.qml b/qml/components-v-play/Theme.qml index 9d0fbbf7..3c88988a 100644 --- a/qml/components-v-play/Theme.qml +++ b/qml/components-v-play/Theme.qml @@ -15,6 +15,10 @@ QtObject { return IconType.home case "location": return IconType.mapmarker + case "list": + return IconType.list + case "about": + return IconType.questioncircle } } @@ -33,6 +37,7 @@ QtObject { property int fontSizeMedium: dp(Theme.listItem.fontSizeText) property int fontSizeSmall: dp(Theme.listItem.fontSizeText) property int fontSizeExtraSmall: dp(Theme.listItem.fontSizeDetailText) + readonly property int fontSizeLarge: dp(Theme.listItem.fontSizeText) readonly property int iconSizeMedium : dp(12) readonly property int iconSizeLarge : dp(12) diff --git a/qml/components-v-play/qmldir b/qml/components-v-play/qmldir index a7963de0..6faf9251 100644 --- a/qml/components-v-play/qmldir +++ b/qml/components-v-play/qmldir @@ -1,3 +1,5 @@ module BerlinVegan.components IconButton 1.0 IconButton.qml singleton Theme 1.0 Theme.qml +NavigationMenu 1.0 NavigationMenu.qml +MenuItem 1.0 MenuItem.qml diff --git a/qml/components-v-play/resources-components-v-play.qrc b/qml/components-v-play/resources-components-v-play.qrc index 1ad1c29c..a1bf74ed 100644 --- a/qml/components-v-play/resources-components-v-play.qrc +++ b/qml/components-v-play/resources-components-v-play.qrc @@ -3,5 +3,7 @@ IconButton.qml Theme.qml qmldir + NavigationMenu.qml + MenuItem.qml diff --git a/qml/harbour-berlin-vegan.qml b/qml/harbour-berlin-vegan.qml index 530da7e2..491084cb 100644 --- a/qml/harbour-berlin-vegan.qml +++ b/qml/harbour-berlin-vegan.qml @@ -30,6 +30,7 @@ import BerlinVegan.components 1.0 as BVApp import "components-generic" import "pages" +import "pages/about" import "cover" ApplicationWindow @@ -104,17 +105,37 @@ ApplicationWindow } } - initialPage: Component { VenueList { + cover: Component { CoverPage { + id: cover jsonModelCollection: gjsonModelCollection positionSource: globalPositionSource - id: listPage } } - cover: Component { CoverPage { - id: cover + initialPage: VenueList { jsonModelCollection: gjsonModelCollection positionSource: globalPositionSource - } } + id: listPage + } + + BVApp.NavigationMenu { + id: myMenu + + flickable: initialPage.flickable + + initialMenuItem: BVApp.MenuItem { + pageToVisit: initialPage + icon: BVApp.Theme.iconBy("list") + //% "List view" + text: qsTrId("id-venue-list") + } + + BVApp.MenuItem { + pageToVisit: AboutBerlinVegan { } + icon: BVApp.Theme.iconBy("about") + //% "About" + text: qsTrId("id-about-venue-list") + } + } } diff --git a/qml/pages/VenueList.qml b/qml/pages/VenueList.qml index e2f445b5..8f5ffb44 100644 --- a/qml/pages/VenueList.qml +++ b/qml/pages/VenueList.qml @@ -39,6 +39,7 @@ Page { property var jsonModelCollection property var positionSource + property alias flickable: listView SilicaListView { id: listView @@ -52,15 +53,6 @@ Page { size: BVApp.Theme.busyIndicatorSizeLarge } - - PullDownMenu { - MenuItem { - //% "About" - text: qsTrId("id-about-venue-list") - onClicked: pageStack.push(Qt.resolvedUrl("about/AboutBerlinVegan.qml")) - } - } - currentIndex: -1 header: SearchField { diff --git a/qml/pages/about/LicenseViewer.qml b/qml/pages/about/LicenseViewer.qml index 97f48a3b..2cf923d7 100644 --- a/qml/pages/about/LicenseViewer.qml +++ b/qml/pages/about/LicenseViewer.qml @@ -29,6 +29,7 @@ import QtQuick 2.2 import Sailfish.Silica 1.0 +import BerlinVegan.components 1.0 as BVApp Page { property string licenseFile: "" diff --git a/translations/harbour-berlin-vegan-de.qm b/translations/harbour-berlin-vegan-de.qm index 74b13cff3db7f3a5f127722d2306b6c45b5876d7..43d1323a8bd4653ca903771b3a89b54b440b4c81 100644 GIT binary patch delta 431 zcmWkqO(;ZR6g_Xg_ukAK?|GDo(D-YJ9Sg+*MgE$}PbnK2gEGmGnQSdI3nMZ;%1TLz zqU6N_`6tR>GMPeC8kVF8rMR=Wo$fj3o_oJ9Y8$srCJpzXFgFBn5}HCIfaHYJY6B7i z==U`MCY^J1&I5wW@YhT}VU>9s*9jk)|6U`1l+BAr0J~=^SqxCWS$O&f;C1#;bqOd= zKIL}`h;QM`51uJ6#8=x$H;wYkF?5;R`Mru)02e}A=?w*J2p-EP^$-?cJ}9V0EY3bA zzEZ50)`%?-$26T5&xv0RhjeJKv3|RVbirufngHZ?<8Fj_<J z3iC^~&k~8*=EE>uAHNf~*>^@mLAiB*mT*sQ-z_1ZDhCGY0P~o9<+hS9s5qYJdOo6T z-I1>PRbOO@me;5YulY3BroNrrQtpf!NQ|R@Ksp}aLN^AHi7qX|<>)(HGOwkHW%{gm mE#;-c4mZ5;k;j7$Dlhe&=z-4^d%Z}dxVtpYV9`AZLxz7uOLNiy delta 508 zcmeBGeWE%+q`rW`Q0*!M10yFx;MHaZ2F}+E3393o3<5V9@=N@Id^<+p}VBmet zVt?o<(3}JoH&viGrwB_@rw0QAi#y925I>3Q70UsKcMJ>+XIW#dE&&Z-Wz7@)3gk1e zu6XtZsIZsKOz9{C1OFs8FV0Os(XDLVlQ#n`)?xeZe;BBK7rWOUBcOZ;yU*@EpoKN; z`|ktA`MTK8oOlAXuy5j5`T9K^w|Gwg4Li*#<5mnbM1a%dDJM|zTCT%4fWF}8<=&Nh z63Ca~i8we9NPF|d@3#c1=jZ7v@MK`%7UMaeDF-z40k7{Ppl?{Scz0h1%JX00FS)-G z=!j|j%id`+Fz~$Ke}C)>P@Qrn1A|}`FgzG!81676O+L@4y?Gm>IE#$}Loh=rLo!1K zLn?y;Ln4q}%#g&81LWl~q<}~ckk{FOSTHk1Hzl(;F)1fiw>UMiC^=*DVO9@oR0C2O bGJzVg8z2BQATView license Lizenz anzeigen + + List view + Listenansicht + About Über diese App diff --git a/translations/harbour-berlin-vegan-en.qm b/translations/harbour-berlin-vegan-en.qm index 7c0540973768aeb763daf7deaa15b20148e7bced..5d42609e5b9a47c6ddf515cb1704e990423ff4c0 100644 GIT binary patch delta 456 zcmeBE*{M81q&|beQ0*!M1H*lWz^ly+44g^~3393o4E*~T@=N>~7&s~!eUle6Ft7?S z{SN}FWA$S$4%iB$YnfYbPX?-A!MvF52m=FiJM&saW}rS5<{MLgGBB`YGT(7I$H2g| zk456o6b1&~=`8k#o&wFA&f=yDl;`kgSp%Z$xx`rxIJ^ToU@>c~)g=Z7zB{aWqF;f0 z2G$kNz5osW$Y!Q=6eym{=Eb=QXz(4j?#Y{h7ALZO_dg7@a4x&o9wVTc4b85ji2fnmhJ#o)-0 z#E{QW%1|=-G^6n5HH?>;Cm&?B*=)m>#i=F4;KPu~P|Q%mpukWDWTi5ca{x6lumLe| WW{PfEYF=roZcb)#$>uryMN9xdEqs>% delta 524 zcmdm~+@~@@q`rW`Q0*!M1H*lWz^ly+44jJ@6691F7zDT(@=N>~7&v}0`X(=CU|^lh z^gjrwj`ciqallp}{g1iz_GAVIE=}geY)2RvnA@4xDl#)L@E0=QnEI1}f#ntR9hY+q z47~O%_J^JV&6QwrQw551TwqD+^Z=^=$g&2+ujiVVrlyNHt((5=qo^k>WVCFh}1L#9OSMFW8CxHf6@I)M(2c(zs#P7ER8nBV4tH2W& z0*83cXUYN9N$~nU0{WCygm?FKpgi9<{*wDEfet*zzwDhRP@f0?`(syt=9XpxgSQ13 zRt#JWj+1vYN^f4mc$wKkhQWm)lcAU)ks*m8har_gfgu=3CNdN;Br{}i097-v0kL3a yif&3~abi+Vs%~*=Vo`F&About + - Berlin-Vegan Berlin-Vegan @@ -219,7 +219,7 @@ Apart from Qt and other wonderful FOSS components of jolla's SailfishOS SDK, this application greatfully makes use of the following third party Free Software projects: - + License: License: @@ -228,8 +228,13 @@ View license View license + + + List view + List view + - + About About diff --git a/translations/harbour-berlin-vegan.qm b/translations/harbour-berlin-vegan.qm new file mode 100644 index 0000000000000000000000000000000000000000..33036a604fd838a59b81a12a6e1cf17cfd968ec4 GIT binary patch literal 1991 zcmaJ>S%?!!7_LkwokTOv46YZ5crfB3^{|QyilB%qUV{e+zR23sT}c2Z#rwj@NqQfiAiTiwF3iEGV+z^;OnIh3W)CQT=`Y{eLz0L@@U1 z>)&?Xm^6NH{hl*_Eg&QllAosDCxq-GtL|?kr0qIcKcSltx06V{0(YM2@dv=W-S%lU zc$qhjT6rAbM>?AxZ70O(bOziDuz%qkn&c3YJLWvx`7d}?=kdaugk)D|$G+cz^I~@1 z`Dd`(m|fHjylq+bpgEm2*|YOs!9K~Yn{x;D+j3&mTii)*-}5){)9wB|`66yT?$Y8B z+z-23wjYK4KkmB~L-_tSzx4DBoYV8mPi;kJwUejS_* zUaqvcwgh)oy2U4e|DwI;Z`769(thdz@Z5$D{bWDRKRfom`VqVX9j`Cl15a}_^%v(8 zeg%XlF8(8VK)qg>Xj=0sjB2hUmN#G~jaO$PVKm}O+jyPEpYJoJcrTB*?zfRTK$HP!)(c%8+m z`3AD0s24@DVfSHbDobe`X^%(B7RO{!j(Ol&ql^Gri4x63vtFBnc2GiI38^1?Jhm}R z8e9ZY##Av+ThkZ@PQ-mCl(m;r09QTHPj%>tK1H?sG6+w!v@_LJrAVnR2UJK~%BK6W zDtKMmXZyo9IJ)ac*a7Pp&F;w>6W9S7$|O!LUdC8D?%R@S`bc!^2AYhOr;|9PR?`WU zq;ZJI#rBg{s%!Z z>NirWNV{0fj=~XC5Oce + - - Berlin-Vegan @@ -220,7 +219,7 @@ - + License: @@ -229,19 +228,14 @@ View license - - - About - - - - - Disable Search + + + List view - - - Enable Search + + + About