Commit bb6c544c authored by kempe's avatar kempe
Browse files

Refactoring Separate navigation logic as component

parent d366cd38
......@@ -35,7 +35,6 @@ OTHER_FILES += qml/harbour-received.qml \
translations/harbour-received-sv.ts \
qml/pages/Stations.qml \
qml/pages/BrowseByCategory.qml \
qml/components/MenuLabelSmal.qml \
qml/components/SleepTimer.qml \
qml/pages/Settings.qml
......@@ -55,4 +54,7 @@ DISTFILES += \
qml/components/js/Rad.js \
qml/components/DockedAudioPlayer.qml \
qml/components/PlayerControlsForm.ui.qml \
qml/components/DockedAudioPlayerForm.ui.qml
qml/components/DockedAudioPlayerForm.ui.qml \
qml/components/MenuLabelSmal.ui.qml \
qml/pages/NavigationMenuForm.ui.qml \
qml/pages/NavigationMenu.qml
......@@ -10,22 +10,10 @@ Page {
VerticalScrollDecorator { flickable: browseListView }
anchors.fill: parent
PullDownMenu {
id: pulleyMeny
MenuItem {
visible: player.isPlaying() && !player.open
text: qsTr("Show player")
onClicked: {
player.open = true
}
}
MenuItem {
text: qsTr("Search")
onClicked: {
pageStack.replace(Qt.resolvedUrl("Stations.qml"), {listType: Utils.Search});
}
}
}
NavigationMenu {
id: pulleyMeny
hideBrowseAction: true
}
header: Column {
PageHeader {
......
......@@ -14,26 +14,17 @@ Page {
VerticalScrollDecorator { flickable: browseByPageListView }
anchors.fill: parent
PullDownMenu {
id: pulleyMeny
MenuItem {
visible: player.isPlaying() && !player.open
text: qsTr("Show player")
onClicked: {
player.open = true
}
}
MenuItem {
text: qsTr("Search")
onClicked: {
pageStack.replaceAbove(
pageStack.find(function(page) {
return page.firstPage === true}),
Qt.resolvedUrl("Stations.qml"),
{listType: Utils.Search});
}
}
}
NavigationMenu {
id: pulleyMeny
hideBrowseAction: true
searchAction: function() {
pageStack.replaceAbove(
pageStack.find(function(page) {
return page.firstPage === true}),
Qt.resolvedUrl("Stations.qml"),
{listType: Utils.Search});
}
}
header: Column {
PageHeader {
......
......@@ -15,33 +15,8 @@ Page {
VerticalScrollDecorator { flickable: favoritesListView }
anchors.fill: parent
PullDownMenu {
NavigationMenu {
id: pulleyMeny
MenuItem {
text: qsTr("Settings")
onClicked: {
pageStack.push(Qt.resolvedUrl("Settings.qml"));
}
}
MenuItem {
visible: player.isPlaying && !player.open
text: qsTr("Show player")
onClicked: {
player.open = true
}
}
MenuItem {
text: qsTr("Browse")
onClicked: {
pageStack.push(Qt.resolvedUrl("Browse.qml"), {listType: Utils.Top100});
}
}
MenuItem {
text: qsTr("Search")
onClicked: {
pageStack.push(Qt.resolvedUrl("Stations.qml"), {listType: Utils.Search});
}
}
}
header: Column {
......
import QtQuick 2.4
import "../components/js/Utils.js" as Utils
NavigationMenuForm {
property var settingsAction: function() { pageStack.push(Qt.resolvedUrl("Settings.qml")); }
property var showPlayerAction: function() { player.open = true; }
property var browseAction: function() { pageStack.push(Qt.resolvedUrl("Browse.qml"), {listType: Utils.Top100}); }
property var searchAction: function() { pageStack.push(Qt.resolvedUrl("Stations.qml"), {listType: Utils.Search}); }
actionSettings.onClicked: settingsAction()
actionShowPlayer.onClicked: showPlayerAction()
actionBrowse.onClicked: browseAction()
actionSearch.onClicked: searchAction()
}
import QtQuick 2.4
import Sailfish.Silica 1.0
PullDownMenu {
id: pulleyMeny
property alias actionSettings: actionSettings
property alias actionShowPlayer: actionShowPlayer
property alias actionBrowse: actionBrowse
property alias actionSearch: actionSearch
property bool hideSettingsAction: false
property bool hideShowPlayerAction: false
property bool hideBrowseAction: false
property bool hideSearchAction: false
MenuItem {
id: actionSettings
visible: !hideSettingsAction
text: qsTr("Settings")
}
MenuItem {
id: actionShowPlayer
visible: player.isPlaying && !player.open && !hideShowPlayerAction
text: qsTr("Show player")
}
MenuItem {
id: actionBrowse
visible: !hideBrowseAction
text: qsTr("Browse")
}
MenuItem {
id: actionSearch
visible: !hideSearchAction
text: qsTr("Search")
}
}
......@@ -16,37 +16,17 @@ Page {
VerticalScrollDecorator { flickable: stationListView }
anchors.fill: parent
PullDownMenu {
id: pulleyMeny
MenuItem {
visible: player.isPlaying() && !player.open
text: qsTr("Show player")
onClicked: {
player.open = true
}
}
MenuItem {
text: qsTr("Browse")
onClicked: {
pageStack.replaceAbove(
pageStack.find(function(page) {
return page.firstPage === true}),
Qt.resolvedUrl("Browse.qml"));
}
}
MenuItem {
text: qsTr("Search")
visible: listType !== Utils.Search
onClicked: {
pageStack.replaceAbove(
pageStack.find(function(page) {
return page.firstPage === true}),
Qt.resolvedUrl("Stations.qml"),
{listType: Utils.Search});
}
}
}
NavigationMenu {
id: pulleyMeny
hideSearchAction: listType === Utils.Search
searchAction: function() {
pageStack.replaceAbove(
pageStack.find(function(page) {
return page.firstPage === true}),
Qt.resolvedUrl("Stations.qml"),
{listType: Utils.Search});
}
}
header: Column {
PageHeader {
......
......@@ -7,10 +7,6 @@
<source>Top 100</source>
<translation>Topp 100</translation>
</message>
<message>
<source>Search</source>
<translation>Sök</translation>
</message>
<message>
<source>Browse</source>
<translation>Bläddra</translation>
......@@ -43,10 +39,6 @@
<source>Local</source>
<translation>Lokalt</translation>
</message>
<message>
<source>Show player</source>
<translation>Visa spelare</translation>
</message>
</context>
<context>
<name>BrowseByCategory</name>
......@@ -54,14 +46,6 @@
<source>Browse by</source>
<translation>Bläddra efter</translation>
</message>
<message>
<source>Search</source>
<translation>Sök</translation>
</message>
<message>
<source>Show player</source>
<translation>Visa spelare</translation>
</message>
</context>
<context>
<name>DockedAudioPlayerForm.ui</name>
......@@ -80,10 +64,6 @@
</context>
<context>
<name>Favorites</name>
<message>
<source>Search</source>
<translation>Sök</translation>
</message>
<message>
<source>Favorites</source>
<translation>Favoriter</translation>
......@@ -92,25 +72,28 @@
<source>Remove from favorite</source>
<translation>Ta bort från favoriter</translation>
</message>
</context>
<context>
<name>NavigationMenuForm.ui</name>
<message>
<source>Browse</source>
<translation>Bläddra</translation>
<source>Settings</source>
<translation type="unfinished">Inställningar</translation>
</message>
<message>
<source>Show player</source>
<translation>Visa spelare</translation>
<translation type="unfinished">Visa spelare</translation>
</message>
<message>
<source>Settings</source>
<translation>Inställningar</translation>
<source>Browse</source>
<translation type="unfinished">Bläddra</translation>
</message>
</context>
<context>
<name>Stations</name>
<message>
<source>Search</source>
<translation>Sök</translation>
<translation type="unfinished">Sök</translation>
</message>
</context>
<context>
<name>Stations</name>
<message>
<source>Remove from favorite</source>
<translation>Ta bort från favoriter</translation>
......@@ -119,18 +102,10 @@
<source>Add to favorite</source>
<translation>Lägg till i favoriter</translation>
</message>
<message>
<source>Browse</source>
<translation>Bläddra</translation>
</message>
<message>
<source>From</source>
<translation>Från</translation>
</message>
<message>
<source>Show player</source>
<translation>Visa spelare</translation>
</message>
</context>
<context>
<name>Utils</name>
......
......@@ -39,14 +39,6 @@
<source>Local</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show player</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BrowseByCategory</name>
......@@ -54,14 +46,6 @@
<source>Browse by</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show player</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DockedAudioPlayerForm.ui</name>
......@@ -88,29 +72,28 @@
<source>Remove from favorite</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NavigationMenuForm.ui</name>
<message>
<source>Search</source>
<source>Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse</source>
<source>Show player</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show player</source>
<source>Browse</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Settings</source>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Stations</name>
<message>
<source>Search</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Remove from favorite</source>
<translation type="unfinished"></translation>
......@@ -119,18 +102,10 @@
<source>Add to favorite</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Browse</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>From</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Show player</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Utils</name>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment