2017-06-07 08:56:42 +03:00
|
|
|
import QtQuick 2.0
|
|
|
|
import Sailfish.Silica 1.0
|
2018-05-24 12:14:02 +03:00
|
|
|
import QtGraphicalEffects 1.0
|
2017-06-07 08:56:42 +03:00
|
|
|
|
2020-05-29 21:05:05 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
SilicaGridView {
|
2020-06-03 08:34:33 +03:00
|
|
|
id: gridView
|
|
|
|
|
|
|
|
property bool isPortrait: false
|
2020-05-29 21:05:05 +03:00
|
|
|
signal slideshowShow(int vIndex)
|
|
|
|
signal slideshowIndexChanged(int vIndex)
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
onSlideshowIndexChanged: {
|
|
|
|
navigateTo(vIndex)
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
ListModel {
|
|
|
|
id: listModel
|
|
|
|
ListElement {
|
2018-05-24 16:00:10 +03:00
|
|
|
icon: "image://theme/icon-m-home"
|
2018-05-24 12:14:02 +03:00
|
|
|
slug: "home"
|
|
|
|
name: "Home"
|
2017-06-07 08:56:42 +03:00
|
|
|
active: true
|
|
|
|
unread: false
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
ListElement {
|
2020-01-25 00:02:59 +03:00
|
|
|
icon: "image://theme/icon-m-alarm"
|
|
|
|
slug: "notifications"
|
|
|
|
name: "Notifications"
|
2017-06-07 08:56:42 +03:00
|
|
|
active: false
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
ListElement {
|
2020-01-16 18:31:13 +03:00
|
|
|
icon: "image://theme/icon-m-whereami"
|
2018-05-24 12:14:02 +03:00
|
|
|
slug: "local"
|
|
|
|
name: "Local"
|
2017-06-07 08:56:42 +03:00
|
|
|
active: false
|
2018-05-24 12:14:02 +03:00
|
|
|
unread: false
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
ListElement {
|
2020-01-25 00:02:59 +03:00
|
|
|
icon: "image://theme/icon-m-website"
|
|
|
|
slug: "federated"
|
|
|
|
name: "Federated"
|
2018-05-24 12:14:02 +03:00
|
|
|
active: false
|
2020-01-25 00:02:59 +03:00
|
|
|
unread: false
|
2018-05-24 12:14:02 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2018-05-24 12:14:02 +03:00
|
|
|
ListElement {
|
2018-05-24 16:00:10 +03:00
|
|
|
icon: "image://theme/icon-m-search"
|
2017-06-07 08:56:42 +03:00
|
|
|
slug: "search"
|
|
|
|
name: "Search"
|
|
|
|
active: false
|
|
|
|
unread: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
model: listModel
|
|
|
|
currentIndex: -1
|
2017-06-07 17:09:41 +03:00
|
|
|
cellWidth: isPortrait ? gridView.width : gridView.width / model.count
|
|
|
|
cellHeight: isPortrait ? gridView.height/model.count : gridView.height
|
2020-06-03 08:34:33 +03:00
|
|
|
anchors.fill: parent
|
2017-06-07 08:56:42 +03:00
|
|
|
delegate: BackgroundItem {
|
|
|
|
id: rectangle
|
2020-06-03 08:34:33 +03:00
|
|
|
clip: true
|
2017-06-07 08:56:42 +03:00
|
|
|
width: gridView.cellWidth
|
|
|
|
height: gridView.cellHeight
|
|
|
|
GridView.onAdd: AddAnimation {
|
|
|
|
target: rectangle
|
|
|
|
}
|
|
|
|
GridView.onRemove: RemoveAnimation {
|
|
|
|
target: rectangle
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
GlassItem {
|
|
|
|
id: effect
|
|
|
|
visible: !isPortrait && unread
|
|
|
|
dimmed: true
|
|
|
|
color: Theme.highlightColor
|
2020-06-03 08:34:33 +03:00
|
|
|
width: Theme.itemSizeMedium
|
|
|
|
height: Theme.itemSizeMedium
|
|
|
|
anchors {
|
|
|
|
bottom: parent.bottom
|
|
|
|
bottomMargin: -height/2
|
|
|
|
horizontalCenter: parent.horizontalCenter
|
|
|
|
}
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
GlassItem {
|
|
|
|
id: effect2
|
|
|
|
visible: isPortrait && unread
|
|
|
|
dimmed: false
|
|
|
|
color: Theme.highlightColor
|
2020-06-03 08:34:33 +03:00
|
|
|
width: Theme.itemSizeMedium
|
|
|
|
height: Theme.itemSizeMedium
|
|
|
|
anchors {
|
|
|
|
right: parent.right
|
|
|
|
rightMargin: -height/2
|
|
|
|
verticalCenter: parent.verticalCenter
|
|
|
|
}
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
OpacityRampEffect {
|
|
|
|
sourceItem: label
|
|
|
|
offset: 0.5
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2018-05-24 12:14:02 +03:00
|
|
|
ColorOverlay {
|
2020-06-03 08:34:33 +03:00
|
|
|
source: image
|
|
|
|
color: (highlighted ? Theme.highlightColor : (model.active ? Theme.primaryColor : Theme.secondaryHighlightColor))
|
|
|
|
anchors.fill: image
|
|
|
|
}
|
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Image {
|
|
|
|
id: image
|
2020-06-03 08:34:33 +03:00
|
|
|
visible: false
|
|
|
|
source: model.icon // +'?'+ (highlighted ? Theme.highlightColor : (model.active ? Theme.primaryColor : Theme.secondaryHighlightColor))
|
2018-05-24 16:00:10 +03:00
|
|
|
sourceSize.width: Theme.iconSizeMedium
|
|
|
|
sourceSize.height: Theme.iconSizeMedium
|
2017-06-07 08:56:42 +03:00
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
2017-06-07 17:09:41 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
Text {
|
|
|
|
visible: false
|
2018-05-24 12:14:02 +03:00
|
|
|
text: model.name
|
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall/2
|
2017-06-07 08:56:42 +03:00
|
|
|
color: (highlighted
|
|
|
|
? Theme.highlightColor
|
|
|
|
: (model.active ? Theme.primaryColor : Theme.secondaryHighlightColor))
|
2020-06-03 08:34:33 +03:00
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
anchors {
|
|
|
|
left: parent.left
|
|
|
|
right: parent.right
|
|
|
|
bottom: parent.bottom
|
|
|
|
bottomMargin: Theme.paddingSmall
|
|
|
|
}
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
Label {
|
|
|
|
id: label
|
|
|
|
visible: false
|
|
|
|
color: (highlighted ? Theme.highlightColor : Theme.secondaryHighlightColor)
|
|
|
|
text: {
|
|
|
|
return model.name.toUpperCase();
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
font.pixelSize: Theme.fontSizeExtraSmall
|
|
|
|
font.family: Theme.fontFamilyHeading
|
|
|
|
width: parent.width
|
|
|
|
horizontalAlignment : Text.AlignHCenter
|
|
|
|
anchors.bottom: parent.bottom
|
2017-06-07 08:56:42 +03:00
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
onClicked: {
|
|
|
|
slideshowShow(index)
|
|
|
|
console.log(index)
|
|
|
|
navigateTo(model.slug)
|
|
|
|
effect.state = "right"
|
|
|
|
}
|
|
|
|
}
|
2020-06-03 08:34:33 +03:00
|
|
|
|
2017-06-07 08:56:42 +03:00
|
|
|
function navigateTo(slug){
|
|
|
|
for(var i = 0; i < listModel.count; i++){
|
|
|
|
if (listModel.get(i).slug === slug || i===slug)
|
|
|
|
listModel.setProperty(i, 'active', true);
|
|
|
|
else
|
|
|
|
listModel.setProperty(i, 'active', false);
|
|
|
|
}
|
|
|
|
console.log(slug)
|
|
|
|
}
|
|
|
|
|
|
|
|
VerticalScrollDecorator {}
|
|
|
|
}
|