Move globaldrawer into own file
This commit is contained in:
parent
6fb08350cb
commit
6dbe0fd921
139
src/qml/KastsGlobalDrawer.qml
Normal file
139
src/qml/KastsGlobalDrawer.qml
Normal file
@ -0,0 +1,139 @@
|
||||
// SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-FileCopyrightText: 2021-2022 Bart De Vries <bart@mogwai.be>
|
||||
// SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
import org.kde.kasts
|
||||
|
||||
Kirigami.OverlayDrawer {
|
||||
id: root
|
||||
modal: false
|
||||
closePolicy: QQC2.Popup.NoAutoClose
|
||||
edge: Qt.application.layoutDirection === Qt.RightToLeft ? Qt.RightEdge : Qt.LeftEdge
|
||||
|
||||
readonly property real pinnedWidth: Kirigami.Units.gridUnit * 3
|
||||
readonly property real widescreenBigWidth: Kirigami.Units.gridUnit * 10
|
||||
readonly property int buttonDisplayMode: kastsMainWindow.isWidescreen ? Kirigami.NavigationTabButton.TextBesideIcon : Kirigami.NavigationTabButton.IconOnly
|
||||
|
||||
width: showGlobalDrawer ? (kastsMainWindow.isWidescreen ? widescreenBigWidth : pinnedWidth) : 0
|
||||
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
||||
Kirigami.Theme.inherit: false
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
|
||||
contentItem: Loader {
|
||||
id: sidebarColumn
|
||||
active: showGlobalDrawer
|
||||
|
||||
sourceComponent: ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
QQC2.ToolBar {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: pageStack.globalToolBar.preferredHeight
|
||||
|
||||
leftPadding: Kirigami.Units.smallSpacing
|
||||
rightPadding: Kirigami.Units.smallSpacing
|
||||
topPadding: Kirigami.Units.smallSpacing
|
||||
bottomPadding: Kirigami.Units.smallSpacing
|
||||
|
||||
contentItem: GlobalSearchField {}
|
||||
}
|
||||
|
||||
QQC2.ScrollView {
|
||||
id: scrollView
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
|
||||
QQC2.ScrollBar.vertical.policy: QQC2.ScrollBar.AlwaysOff
|
||||
QQC2.ScrollBar.horizontal.policy: QQC2.ScrollBar.AlwaysOff
|
||||
contentWidth: -1 // disable horizontal scroll
|
||||
|
||||
ColumnLayout {
|
||||
id: column
|
||||
width: scrollView.width
|
||||
spacing: 0
|
||||
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: root.buttonDisplayMode
|
||||
text: i18n("Queue")
|
||||
icon.name: "source-playlist"
|
||||
checked: currentPage == "QueuePage"
|
||||
onClicked: {
|
||||
pushPage("QueuePage")
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: root.buttonDisplayMode
|
||||
text: i18n("Discover")
|
||||
icon.name: "search"
|
||||
checked: currentPage == "DiscoverPage"
|
||||
onClicked: {
|
||||
pushPage("DiscoverPage")
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: root.buttonDisplayMode
|
||||
text: i18n("Subscriptions")
|
||||
icon.name: "bookmarks"
|
||||
checked: currentPage == "FeedListPage"
|
||||
onClicked: {
|
||||
pushPage("FeedListPage")
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: root.buttonDisplayMode
|
||||
text: i18n("Episodes")
|
||||
icon.name: "rss"
|
||||
checked: currentPage == "EpisodeListPage"
|
||||
onClicked: {
|
||||
pushPage("EpisodeListPage")
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: root.buttonDisplayMode
|
||||
text: i18n("Downloads")
|
||||
icon.name: "download"
|
||||
checked: currentPage == "DownloadListPage"
|
||||
onClicked: {
|
||||
pushPage("DownloadListPage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
Layout.fillWidth: true
|
||||
Layout.rightMargin: Kirigami.Units.smallSpacing
|
||||
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||
}
|
||||
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: root.buttonDisplayMode
|
||||
|
||||
text: i18n("Settings")
|
||||
icon.name: "settings-configure"
|
||||
checked: currentPage == "SettingsPage"
|
||||
onClicked: {
|
||||
checked = false;
|
||||
pushPage("SettingsPage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
126
src/qml/main.qml
126
src/qml/main.qml
@ -136,132 +136,8 @@ Kirigami.ApplicationWindow {
|
||||
|
||||
globalDrawer: showGlobalDrawer ? myGlobalDrawer : null
|
||||
|
||||
property Kirigami.OverlayDrawer myGlobalDrawer: Kirigami.OverlayDrawer {
|
||||
id: drawer
|
||||
modal: false
|
||||
closePolicy: Controls.Popup.NoAutoClose
|
||||
edge: Qt.application.layoutDirection === Qt.RightToLeft ? Qt.RightEdge : Qt.LeftEdge
|
||||
property Kirigami.OverlayDrawer myGlobalDrawer: KastsGlobalDrawer {
|
||||
|
||||
readonly property real pinnedWidth: Kirigami.Units.gridUnit * 3
|
||||
readonly property real widescreenBigWidth: Kirigami.Units.gridUnit * 10
|
||||
readonly property int buttonDisplayMode: kastsMainWindow.isWidescreen ? Kirigami.NavigationTabButton.TextBesideIcon : Kirigami.NavigationTabButton.IconOnly
|
||||
|
||||
width: showGlobalDrawer ? (kastsMainWindow.isWidescreen ? widescreenBigWidth : pinnedWidth) : 0
|
||||
|
||||
Kirigami.Theme.colorSet: Kirigami.Theme.Window
|
||||
Kirigami.Theme.inherit: false
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
|
||||
contentItem: Loader {
|
||||
id: sidebarColumn
|
||||
active: showGlobalDrawer
|
||||
|
||||
sourceComponent: ColumnLayout {
|
||||
spacing: 0
|
||||
|
||||
Controls.ToolBar {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: pageStack.globalToolBar.preferredHeight
|
||||
|
||||
leftPadding: Kirigami.Units.smallSpacing
|
||||
rightPadding: Kirigami.Units.smallSpacing
|
||||
topPadding: Kirigami.Units.smallSpacing
|
||||
bottomPadding: Kirigami.Units.smallSpacing
|
||||
|
||||
contentItem: GlobalSearchField {}
|
||||
}
|
||||
|
||||
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
|
||||
display: drawer.buttonDisplayMode
|
||||
text: i18n("Queue")
|
||||
icon.name: "source-playlist"
|
||||
checked: currentPage == "QueuePage"
|
||||
onClicked: {
|
||||
pushPage("QueuePage")
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: drawer.buttonDisplayMode
|
||||
text: i18n("Discover")
|
||||
icon.name: "search"
|
||||
checked: currentPage == "DiscoverPage"
|
||||
onClicked: {
|
||||
pushPage("DiscoverPage")
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: drawer.buttonDisplayMode
|
||||
text: i18n("Subscriptions")
|
||||
icon.name: "bookmarks"
|
||||
checked: currentPage == "FeedListPage"
|
||||
onClicked: {
|
||||
pushPage("FeedListPage")
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: drawer.buttonDisplayMode
|
||||
text: i18n("Episodes")
|
||||
icon.name: "rss"
|
||||
checked: currentPage == "EpisodeListPage"
|
||||
onClicked: {
|
||||
pushPage("EpisodeListPage")
|
||||
}
|
||||
}
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: drawer.buttonDisplayMode
|
||||
text: i18n("Downloads")
|
||||
icon.name: "download"
|
||||
checked: currentPage == "DownloadListPage"
|
||||
onClicked: {
|
||||
pushPage("DownloadListPage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Separator {
|
||||
Layout.fillWidth: true
|
||||
Layout.rightMargin: Kirigami.Units.smallSpacing
|
||||
Layout.leftMargin: Kirigami.Units.smallSpacing
|
||||
}
|
||||
|
||||
Kirigami.NavigationTabButton {
|
||||
Layout.fillWidth: true
|
||||
display: drawer.buttonDisplayMode
|
||||
|
||||
text: i18n("Settings")
|
||||
icon.name: "settings-configure"
|
||||
checked: currentPage == "SettingsPage"
|
||||
onClicked: {
|
||||
checked = false;
|
||||
pushPage("SettingsPage")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Implement slots for MPRIS2 signals
|
||||
|
@ -45,6 +45,7 @@
|
||||
<file alias="GlobalSearchField.qml">qml/GlobalSearchField.qml</file>
|
||||
<file alias="SearchBar.qml">qml/SearchBar.qml</file>
|
||||
<file alias="FilterInlineMessage.qml">qml/FilterInlineMessage.qml</file>
|
||||
<file alias="KastsGlobalDrawer.qml">qml/KastsGlobalDrawer.qml</file>
|
||||
<file alias="logo.svg">../kasts.svg</file>
|
||||
<file alias="kasts-tray-light.svg">../icons/kasts-tray-light.svg</file>
|
||||
<file alias="kasts-tray-dark.svg">../icons/kasts-tray-dark.svg</file>
|
||||
|
Loading…
x
Reference in New Issue
Block a user