Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
sailfish-apps
Received
Commits
447df515
Commit
447df515
authored
Jul 09, 2017
by
kempe
Browse files
Refactored Browse page part of
#6
* Divided in .qml and .ui.qml
parent
fbb63f59
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
29 deletions
+126
-29
harbour-received.pro
harbour-received.pro
+3
-2
qml/pages/BrowsePage.qml
qml/pages/BrowsePage.qml
+35
-0
qml/pages/BrowsePageForm.ui.qml
qml/pages/BrowsePageForm.ui.qml
+55
-0
qml/pages/NavigationMenu.qml
qml/pages/NavigationMenu.qml
+1
-1
translations/harbour-received-sv.ts
translations/harbour-received-sv.ts
+21
-18
translations/harbour-received.ts
translations/harbour-received.ts
+11
-8
No files found.
harbour-received.pro
View file @
447df515
...
...
@@ -31,7 +31,6 @@ OTHER_FILES += qml/harbour-received.qml \
qml/components/python/api.py \
qml/components/js/Storage.js \
qml/components/js/Favorites.js \
qml/pages/Browse.qml \
translations/harbour-received-sv.ts \
qml/pages/BrowseByCategory.qml \
qml/components/SleepTimer.qml \
...
...
@@ -67,5 +66,7 @@ DISTFILES += \
qml/components/StationsListContextMenu.qml \
qml/components/CustomSearchField.qml \
qml/pages/Settings2.qml \
qml/components/RecivedUpgrader.qml
qml/components/RecivedUpgrader.qml \
qml/pages/BrowsePageForm.ui.qml \
qml/pages/BrowsePage.qml
qml/pages/BrowsePage.qml
0 → 100644
View file @
447df515
import
QtQuick
2.6
import
"
../components/js/Utils.js
"
as
Utils
BrowsePageForm
{
browseListView.onCurrentIndexChanged
:
{
var
item
=
browseModel
.
get
(
browseListView
.
currentIndex
)
switch
(
item
.
action
)
{
case
"
top100
"
:
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
StationsPage.qml
"
),
{
listType
:
Utils
.
Top100
});
break
;
case
"
recommended
"
:
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
StationsPage.qml
"
),
{
listType
:
Utils
.
Recommended
});
break
;
case
"
localStations
"
:
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
StationsPage.qml
"
),
{
listType
:
Utils
.
Local
});
break
;
default
:
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
BrowseByCategory.qml
"
),
{
category
:
item
.
originalTitle
,
headerTitle
:
item
.
title
});
break
;
}
}
Component.onCompleted
:
{
browseModel
.
append
({
title
:
qsTr
(
"
Local
"
),
action
:
"
localStations
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Top 100
"
),
action
:
"
top100
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Recommended
"
),
action
:
"
recommended
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Genre
"
),
action
:
"
browse
"
,
originalTitle
:
"
genre
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Topic
"
),
action
:
"
browse
"
,
originalTitle
:
"
topic
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Country
"
),
action
:
"
browse
"
,
originalTitle
:
"
country
"
})
browseModel
.
append
({
title
:
qsTr
(
"
City
"
),
action
:
"
browse
"
,
originalTitle
:
"
city
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Language
"
),
action
:
"
browse
"
,
originalTitle
:
"
language
"
})
}
}
qml/pages/Browse.qml
→
qml/pages/Browse
PageForm.ui
.qml
View file @
447df515
...
...
@@ -5,6 +5,11 @@ import "../components/js/Utils.js" as Utils
Page
{
id
:
browsePage
signal
categorySelected
(
int
index
)
property
alias
browseListView
:
browseListView
property
alias
browseModel
:
browseModel
SilicaListView
{
id
:
browseListView
VerticalScrollDecorator
{
flickable
:
browseListView
}
...
...
@@ -22,6 +27,7 @@ Page {
}
}
currentIndex
:
-
1
model
:
ListModel
{
id
:
browseModel
}
...
...
@@ -40,31 +46,10 @@ Page {
anchors.topMargin
:
7
}
onClicked
:
{
if
(
action
===
"
top100
"
)
{
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
StationsPage.qml
"
),
{
listType
:
Utils
.
Top100
});
}
else
if
(
action
===
"
recommended
"
)
{
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
StationsPage.qml
"
),
{
listType
:
Utils
.
Recommended
});
}
else
if
(
action
===
"
localStations
"
)
{
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
StationsPage.qml
"
),
{
listType
:
Utils
.
Local
});
}
else
{
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
BrowseByCategory.qml
"
),
{
category
:
originalTitle
,
headerTitle
:
title
});
}
Connections
{
target
:
listItem
onClicked
:
browseListView
.
currentIndex
=
index
}
}
}
Component.onCompleted
:
{
browseModel
.
append
({
title
:
qsTr
(
"
Local
"
),
action
:
"
localStations
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Top 100
"
),
action
:
"
top100
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Recommended
"
),
action
:
"
recommended
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Genre
"
),
action
:
"
browse
"
,
originalTitle
:
"
genre
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Topic
"
),
action
:
"
browse
"
,
originalTitle
:
"
topic
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Country
"
),
action
:
"
browse
"
,
originalTitle
:
"
country
"
})
browseModel
.
append
({
title
:
qsTr
(
"
City
"
),
action
:
"
browse
"
,
originalTitle
:
"
city
"
})
browseModel
.
append
({
title
:
qsTr
(
"
Language
"
),
action
:
"
browse
"
,
originalTitle
:
"
language
"
})
}
}
qml/pages/NavigationMenu.qml
View file @
447df515
...
...
@@ -4,7 +4,7 @@ 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
browseAction
:
function
()
{
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
Browse
Page
.qml
"
),
{
listType
:
Utils
.
Top100
});
}
property
var
searchAction
:
function
()
{
pageStack
.
push
(
Qt
.
resolvedUrl
(
"
StationsPage.qml
"
),
{
listType
:
Utils
.
Search
});
}
...
...
translations/harbour-received-sv.ts
View file @
447df515
...
...
@@ -2,49 +2,52 @@
<!
DOCTYPE
TS
>
<
TS
version
=
"
2.1
"
>
<
context
>
<
name
>
Browse
<
/name
>
<
name
>
Browse
ByCategory
<
/name
>
<
message
>
<
source
>
Top
100
<
/source
>
<
translation
>
Topp
100
<
/translation
>
<
source
>
Browse
by
<
/source
>
<
translation
>
Bläddra
efter
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
BrowsePage
<
/name
>
<
message
>
<
source
>
Browse
<
/source
>
<
translation
>
Bläddra
<
/translation
>
<
source
>
Local
<
/source
>
<
translation
type
=
"
unfinished
"
>
Lokalt
<
/translation
>
<
/message
>
<
message
>
<
source
>
Top
100
<
/source
>
<
translation
type
=
"
unfinished
"
>
Topp
100
<
/translation
>
<
/message
>
<
message
>
<
source
>
Recommended
<
/source
>
<
translation
>
Rekommenderade
<
/translation
>
<
translation
type
=
"
unfinished
"
>
Rekommenderade
<
/translation
>
<
/message
>
<
message
>
<
source
>
Genre
<
/source
>
<
translation
>
Genre
<
/translation
>
<
translation
type
=
"
unfinished
"
>
Genre
<
/translation
>
<
/message
>
<
message
>
<
source
>
Topic
<
/source
>
<
translation
>
Ämne
<
/translation
>
<
translation
type
=
"
unfinished
"
>
Ämne
<
/translation
>
<
/message
>
<
message
>
<
source
>
Country
<
/source
>
<
translation
>
Land
<
/translation
>
<
translation
type
=
"
unfinished
"
>
Land
<
/translation
>
<
/message
>
<
message
>
<
source
>
City
<
/source
>
<
translation
>
Stad
<
/translation
>
<
translation
type
=
"
unfinished
"
>
Stad
<
/translation
>
<
/message
>
<
message
>
<
source
>
Language
<
/source
>
<
translation
>
Språk
<
/translation
>
<
/message
>
<
message
>
<
source
>
Local
<
/source
>
<
translation
>
Lokalt
<
/translation
>
<
translation
type
=
"
unfinished
"
>
Språk
<
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Browse
ByCategory
<
/name
>
<
name
>
Browse
PageForm
.
ui
<
/name
>
<
message
>
<
source
>
Browse
by
<
/source
>
<
translation
>
Bläddra
efter
<
/translation
>
<
source
>
Browse
<
/source
>
<
translation
type
=
"
unfinished
"
>
Bläddra
<
/translation
>
<
/message
>
<
/context
>
<
context
>
...
...
translations/harbour-received.ts
View file @
447df515
...
...
@@ -2,9 +2,16 @@
<!
DOCTYPE
TS
>
<
TS
version
=
"
2.1
"
>
<
context
>
<
name
>
Browse
<
/name
>
<
name
>
Browse
ByCategory
<
/name
>
<
message
>
<
source
>
Browse
<
/source
>
<
source
>
Browse
by
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
BrowsePage
<
/name
>
<
message
>
<
source
>
Local
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
...
...
@@ -35,15 +42,11 @@
<
source
>
Language
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
message
>
<
source
>
Local
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
<
context
>
<
name
>
Browse
ByCategory
<
/name
>
<
name
>
Browse
PageForm
.
ui
<
/name
>
<
message
>
<
source
>
Browse
by
<
/source
>
<
source
>
Browse
<
/source
>
<
translation
type
=
"
unfinished
"
><
/translation
>
<
/message
>
<
/context
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment