mirror of
https://github.com/KDE/kasts.git
synced 2025-02-05 11:48:27 +01:00
NavigationTabButton based sidebar
This commit is contained in:
parent
c30bfbb5a5
commit
7afc43f833
108
src/qml/main.qml
108
src/qml/main.qml
@ -11,7 +11,7 @@ import QtQuick.Layouts 1.14
|
|||||||
import QtGraphicalEffects 1.12
|
import QtGraphicalEffects 1.12
|
||||||
import Qt.labs.settings 1.0
|
import Qt.labs.settings 1.0
|
||||||
|
|
||||||
import org.kde.kirigami 2.14 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
import org.kde.kasts.solidextras 1.0
|
import org.kde.kasts.solidextras 1.0
|
||||||
|
|
||||||
import org.kde.kasts 1.0
|
import org.kde.kasts 1.0
|
||||||
@ -42,7 +42,7 @@ Kirigami.ApplicationWindow {
|
|||||||
return Kirigami.Units.largeSpacing;
|
return Kirigami.Units.largeSpacing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property int originalWidth: Kirigami.Units.gridUnit * 10
|
property int originalWidth: Kirigami.Units.gridUnit * 6
|
||||||
property var lastFeed: ""
|
property var lastFeed: ""
|
||||||
property string currentPage: ""
|
property string currentPage: ""
|
||||||
|
|
||||||
@ -125,81 +125,123 @@ Kirigami.ApplicationWindow {
|
|||||||
Loader {
|
Loader {
|
||||||
id: sidebar
|
id: sidebar
|
||||||
active: !Kirigami.Settings.isMobile || root.isWidescreen
|
active: !Kirigami.Settings.isMobile || root.isWidescreen
|
||||||
sourceComponent: Kirigami.GlobalDrawer {
|
sourceComponent: Kirigami.OverlayDrawer {
|
||||||
modal: false
|
modal: false
|
||||||
isMenu: false
|
|
||||||
collapsible: !Kirigami.Settings.isMobile
|
|
||||||
collapsed: !root.isWidescreen
|
|
||||||
collapseButtonVisible: false
|
|
||||||
width: root.isWidescreen ? root.originalWidth : Layout.implicitWidth
|
width: root.isWidescreen ? root.originalWidth : Layout.implicitWidth
|
||||||
header: Kirigami.AbstractApplicationHeader {}
|
|
||||||
|
|
||||||
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
||||||
Kirigami.Theme.inherit: false
|
Kirigami.Theme.inherit: false
|
||||||
|
|
||||||
actions: [
|
leftPadding: 0
|
||||||
Kirigami.Action {
|
rightPadding: 0
|
||||||
|
topPadding: 0
|
||||||
|
bottomPadding: 0
|
||||||
|
|
||||||
|
contentItem: ColumnLayout {
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Kirigami.AbstractApplicationHeader { Layout.fillWidth: true }
|
||||||
|
|
||||||
|
Controls.ScrollView {
|
||||||
|
id: scrollView
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
|
||||||
|
Controls.ScrollBar.vertical.policy: Controls.ScrollBar.AlwaysOff
|
||||||
|
Controls.ScrollBar.horizontal.policy: Controls.ScrollBar.AlwaysOff
|
||||||
|
contentWidth: -1 // disable horizontal scroll
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
id: column
|
||||||
|
width: scrollView.width
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
|
Kirigami.NavigationTabButton {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
width: column.width - column.Layout.leftMargin - column.Layout.rightMargin
|
||||||
text: i18n("Queue")
|
text: i18n("Queue")
|
||||||
iconName: "source-playlist"
|
icon.name: "source-playlist"
|
||||||
checked: currentPage == "QueuePage"
|
checked: currentPage == "QueuePage"
|
||||||
onTriggered: {
|
onClicked: {
|
||||||
pushPage("QueuePage")
|
pushPage("QueuePage")
|
||||||
SettingsManager.lastOpenedPage = "QueuePage" // for persistency
|
SettingsManager.lastOpenedPage = "QueuePage" // for persistency
|
||||||
SettingsManager.save();
|
SettingsManager.save();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Kirigami.Action {
|
Kirigami.NavigationTabButton {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
width: column.width - column.Layout.leftMargin - column.Layout.rightMargin
|
||||||
text: i18n("Discover")
|
text: i18n("Discover")
|
||||||
iconName: "search"
|
icon.name: "search"
|
||||||
checked: currentPage == "DiscoverPage"
|
checked: currentPage == "DiscoverPage"
|
||||||
onTriggered: {
|
onClicked: {
|
||||||
pushPage("DiscoverPage")
|
pushPage("DiscoverPage")
|
||||||
SettingsManager.lastOpenedPage = "DiscoverPage" // for persistency
|
SettingsManager.lastOpenedPage = "DiscoverPage" // for persistency
|
||||||
SettingsManager.save();
|
SettingsManager.save();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Kirigami.Action {
|
Kirigami.NavigationTabButton {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
width: column.width - column.Layout.leftMargin - column.Layout.rightMargin
|
||||||
text: i18n("Subscriptions")
|
text: i18n("Subscriptions")
|
||||||
iconName: "bookmarks"
|
icon.name: "bookmarks"
|
||||||
checked: currentPage == "FeedListPage"
|
checked: currentPage == "FeedListPage"
|
||||||
onTriggered: {
|
onClicked: {
|
||||||
pushPage("FeedListPage")
|
pushPage("FeedListPage")
|
||||||
SettingsManager.lastOpenedPage = "FeedListPage" // for persistency
|
SettingsManager.lastOpenedPage = "FeedListPage" // for persistency
|
||||||
SettingsManager.save();
|
SettingsManager.save();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Kirigami.Action {
|
Kirigami.NavigationTabButton {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
width: column.width - column.Layout.leftMargin - column.Layout.rightMargin
|
||||||
text: i18n("Episodes")
|
text: i18n("Episodes")
|
||||||
iconName: "rss"
|
icon.name: "rss"
|
||||||
checked: currentPage == "EpisodeListPage"
|
checked: currentPage == "EpisodeListPage"
|
||||||
onTriggered: {
|
onClicked: {
|
||||||
pushPage("EpisodeListPage")
|
pushPage("EpisodeListPage")
|
||||||
SettingsManager.lastOpenedPage = "EpisodeListPage" // for persistency
|
SettingsManager.lastOpenedPage = "EpisodeListPage" // for persistency
|
||||||
SettingsManager.save();
|
SettingsManager.save();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Kirigami.Action {
|
Kirigami.NavigationTabButton {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
width: column.width - column.Layout.leftMargin - column.Layout.rightMargin
|
||||||
text: i18n("Downloads")
|
text: i18n("Downloads")
|
||||||
iconName: "download"
|
icon.name: "download"
|
||||||
checked: currentPage == "DownloadListPage"
|
checked: currentPage == "DownloadListPage"
|
||||||
onTriggered: {
|
onClicked: {
|
||||||
pushPage("DownloadListPage")
|
pushPage("DownloadListPage")
|
||||||
SettingsManager.lastOpenedPage = "DownloadListPage" // for persistency
|
SettingsManager.lastOpenedPage = "DownloadListPage" // for persistency
|
||||||
SettingsManager.save();
|
SettingsManager.save();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Kirigami.Action {
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Kirigami.Separator {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.bottomMargin: Kirigami.Units.smallSpacing
|
||||||
|
Layout.rightMargin: Kirigami.Units.smallSpacing
|
||||||
|
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||||
|
}
|
||||||
|
|
||||||
|
Kirigami.NavigationTabButton {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
width: column.width - column.Layout.leftMargin - column.Layout.rightMargin
|
||||||
|
|
||||||
text: i18n("Settings")
|
text: i18n("Settings")
|
||||||
iconName: "settings-configure"
|
icon.name: "settings-configure"
|
||||||
checked: currentPage == "SettingsPage"
|
checked: currentPage == "SettingsPage"
|
||||||
onTriggered: {
|
onClicked: {
|
||||||
|
checked = false;
|
||||||
root.pageStack.layers.clear()
|
root.pageStack.layers.clear()
|
||||||
root.pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {}, {
|
root.pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {}, {
|
||||||
title: i18n("Settings")
|
title: i18n("Settings")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user