diff --git a/CMakeLists.txt b/CMakeLists.txt index 06186993..1762fc39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -set(KF5_MIN_VERSION "5.75.0") +set(KF5_MIN_VERSION "5.86.0") set(QT_MIN_VERSION "5.15.0") find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e1b83d9..330dc83f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -180,6 +180,8 @@ if(ANDROID) error search kt-add-feeds + network-connect + drive-harddisk-symbolic ) else() target_link_libraries(kasts PRIVATE Qt::Widgets Qt::DBus) diff --git a/src/qml/AboutPage.qml b/src/qml/Settings/AboutPage.qml similarity index 100% rename from src/qml/AboutPage.qml rename to src/qml/Settings/AboutPage.qml diff --git a/src/qml/SettingsPage.qml b/src/qml/Settings/GeneralSettingsPage.qml similarity index 55% rename from src/qml/SettingsPage.qml rename to src/qml/Settings/GeneralSettingsPage.qml index c867a94e..d7fbb2d0 100644 --- a/src/qml/SettingsPage.qml +++ b/src/qml/Settings/GeneralSettingsPage.qml @@ -8,14 +8,13 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 as Controls import QtQuick.Layouts 1.14 -import QtQuick.Dialogs 1.3 import org.kde.kirigami 2.12 as Kirigami import org.kde.kasts 1.0 Kirigami.ScrollablePage { - title: i18n("Settings") + title: i18n("General Settings") Kirigami.FormLayout { @@ -99,33 +98,6 @@ Kirigami.ScrollablePage { onToggled: SettingsManager.resetPositionOnPlayed = checked } - Kirigami.Heading { - Kirigami.FormData.isSection: true - text: i18n("Network") - } - - Controls.CheckBox { - id: allowMeteredFeedUpdates - checked: SettingsManager.allowMeteredFeedUpdates - Kirigami.FormData.label: i18n("On metered connections:") - text: i18n("Allow podcast updates") - onToggled: SettingsManager.allowMeteredFeedUpdates = checked - } - - Controls.CheckBox { - id: allowMeteredEpisodeDownloads - checked: SettingsManager.allowMeteredEpisodeDownloads - text: i18n("Allow episode downloads") - onToggled: SettingsManager.allowMeteredEpisodeDownloads = checked - } - - Controls.CheckBox { - id: allowMeteredImageDownloads - checked: SettingsManager.allowMeteredImageDownloads - text: i18n("Allow image downloads") - onToggled: SettingsManager.allowMeteredImageDownloads = checked - } - Kirigami.Heading { Kirigami.FormData.isSection: true text: i18n("Article") @@ -151,68 +123,6 @@ Kirigami.ScrollablePage { onToggled: SettingsManager.articleFontUseSystem = checked } - Kirigami.Heading { - Kirigami.FormData.isSection: true - text: i18n("Storage") - } - - RowLayout { - visible: Qt.platform.os !== "android" // not functional on android - Kirigami.FormData.label: i18n("Storage path:") - - Layout.fillWidth: true - Controls.TextField { - Layout.fillWidth: true - readOnly: true - text: StorageManager.storagePath - enabled: !defaultStoragePath.checked - } - Controls.Button { - icon.name: "document-open-folder" - text: i18n("Select folder...") - enabled: !defaultStoragePath.checked - onClicked: storagePathDialog.open() - } - FileDialog { - id: storagePathDialog - title: i18n("Select Storage Path") - selectFolder: true - folder: "file://" + StorageManager.storagePath - onAccepted: { - StorageManager.setStoragePath(fileUrl); - } - } - } - - Controls.CheckBox { - id: defaultStoragePath - visible: Qt.platform.os !== "android" // not functional on android - checked: SettingsManager.storagePath == "" - text: i18n("Use default path") - onToggled: { - if (checked) { - StorageManager.setStoragePath(""); - } - } - } - - Controls.Label { - Kirigami.FormData.label: i18n("Podcast Downloads:") - text: i18nc("Using of disk space", "Using %1 of disk space", StorageManager.formattedEnclosureDirSize) - } - - RowLayout { - Kirigami.FormData.label: i18n("Image Cache:") - Controls.Label { - text: i18nc("Using of disk space", "Using %1 of disk space", StorageManager.formattedImageDirSize) - } - Controls.Button { - icon.name: "edit-clear-all" - text: i18n("Clear Cache") - onClicked: StorageManager.clearImageCache(); - } - } - Kirigami.Heading { Kirigami.FormData.isSection: true text: i18n("Errors") @@ -221,7 +131,11 @@ Kirigami.ScrollablePage { Controls.Button { icon.name: "error" text: i18n("Show Error Log") - onClicked: errorOverlay.open() + onClicked: settingsErrorOverlay.open() + } + + ErrorListOverlay { + id: settingsErrorOverlay } } } diff --git a/src/qml/Settings/NetworkSettingsPage.qml b/src/qml/Settings/NetworkSettingsPage.qml new file mode 100644 index 00000000..6aedcf7b --- /dev/null +++ b/src/qml/Settings/NetworkSettingsPage.qml @@ -0,0 +1,42 @@ +/** + * SPDX-FileCopyrightText: 2020 Tobias Fella + * SPDX-FileCopyrightText: 2021 Bart De Vries + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick 2.14 +import QtQuick.Controls 2.14 as Controls +import QtQuick.Layouts 1.14 + +import org.kde.kirigami 2.12 as Kirigami + +import org.kde.kasts 1.0 + +Kirigami.ScrollablePage { + title: i18n("Network Settings") + + Kirigami.FormLayout { + Controls.CheckBox { + id: allowMeteredFeedUpdates + checked: SettingsManager.allowMeteredFeedUpdates + Kirigami.FormData.label: i18n("On metered connections:") + text: i18n("Allow podcast updates") + onToggled: SettingsManager.allowMeteredFeedUpdates = checked + } + + Controls.CheckBox { + id: allowMeteredEpisodeDownloads + checked: SettingsManager.allowMeteredEpisodeDownloads + text: i18n("Allow episode downloads") + onToggled: SettingsManager.allowMeteredEpisodeDownloads = checked + } + + Controls.CheckBox { + id: allowMeteredImageDownloads + checked: SettingsManager.allowMeteredImageDownloads + text: i18n("Allow image downloads") + onToggled: SettingsManager.allowMeteredImageDownloads = checked + } + } +} diff --git a/src/qml/Settings/SettingsPage.qml b/src/qml/Settings/SettingsPage.qml new file mode 100644 index 00000000..1834e3c0 --- /dev/null +++ b/src/qml/Settings/SettingsPage.qml @@ -0,0 +1,36 @@ +/** + * SPDX-FileCopyrightText: 2020 Tobias Fella + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick 2.15 +import QtQuick.Controls 2.15 as QQC2 +import QtQuick.Layouts 1.15 + +import org.kde.kirigami 2.18 as Kirigami + +Kirigami.CategorizedSettings { + actions: [ + Kirigami.SettingAction { + text: i18n("General") + icon.name: "kasts" + page: "qrc:/GeneralSettingsPage.qml" + }, + Kirigami.SettingAction { + text: i18n("Storage") + icon.name: "drive-harddisk-symbolic" + page: "qrc:/StorageSettingsPage.qml" + }, + Kirigami.SettingAction { + text: i18n("Network") + icon.name: "network-connect" + page: "qrc:/NetworkSettingsPage.qml" + }, + Kirigami.SettingAction { + text: i18n("About") + icon.name: "help-about-symbolic" + page: "qrc:/AboutPage.qml" + } + ] +} diff --git a/src/qml/Settings/StorageSettingsPage.qml b/src/qml/Settings/StorageSettingsPage.qml new file mode 100644 index 00000000..5bfc646d --- /dev/null +++ b/src/qml/Settings/StorageSettingsPage.qml @@ -0,0 +1,78 @@ +/** + * SPDX-FileCopyrightText: 2020 Tobias Fella + * SPDX-FileCopyrightText: 2021 Bart De Vries + * + * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL + */ + +import QtQuick 2.14 +import QtQuick.Controls 2.14 as Controls +import QtQuick.Layouts 1.14 +import QtQuick.Dialogs 1.3 + +import org.kde.kirigami 2.12 as Kirigami + +import org.kde.kasts 1.0 + +Kirigami.ScrollablePage { + title: i18n("Storage Settings") + + Kirigami.FormLayout { + RowLayout { + visible: Qt.platform.os !== "android" // not functional on android + Kirigami.FormData.label: i18n("Storage path:") + + Layout.fillWidth: true + Controls.TextField { + Layout.fillWidth: true + readOnly: true + text: StorageManager.storagePath + enabled: !defaultStoragePath.checked + } + Controls.Button { + icon.name: "document-open-folder" + text: i18n("Select folder...") + enabled: !defaultStoragePath.checked + onClicked: storagePathDialog.open() + } + FileDialog { + id: storagePathDialog + title: i18n("Select Storage Path") + selectFolder: true + folder: "file://" + StorageManager.storagePath + onAccepted: { + StorageManager.setStoragePath(fileUrl); + } + } + } + + Controls.CheckBox { + id: defaultStoragePath + visible: Qt.platform.os !== "android" // not functional on android + checked: SettingsManager.storagePath == "" + text: i18n("Use default path") + onToggled: { + if (checked) { + StorageManager.setStoragePath(""); + } + } + } + + Controls.Label { + Kirigami.FormData.label: i18n("Podcast Downloads:") + text: i18nc("Using of disk space", "Using %1 of disk space", StorageManager.formattedEnclosureDirSize) + } + + RowLayout { + Kirigami.FormData.label: i18n("Image Cache:") + Controls.Label { + text: i18nc("Using of disk space", "Using %1 of disk space", StorageManager.formattedImageDirSize) + } + Controls.Button { + icon.name: "edit-clear-all" + text: i18n("Clear Cache") + onClicked: StorageManager.clearImageCache(); + } + } + } +} diff --git a/src/qml/main.qml b/src/qml/main.qml index acf01287..1a9fbdf5 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -40,13 +40,13 @@ Kirigami.ApplicationWindow { case "DiscoverPage": return "qrc:/DiscoverPage.qml"; case "FeedListPage": return "qrc:/FeedListPage.qml"; case "DownloadListPage": return "qrc:/DownloadListPage.qml"; - case "SettingsPage": return "qrc:/SettingsPage.qml"; - case "AboutPage": return "qrc:/AboutPage.qml"; + case "SettingsPage": return "qrc:/Settings/SettingsPage.qml"; default: return "qrc:/FeedListPage.qml"; } } function pushPage(page) { pageStack.clear() + pageStack.layers.clear() pageStack.push(getPage(page)) currentPage = page } @@ -141,15 +141,10 @@ Kirigami.ApplicationWindow { iconName: "settings-configure" checked: currentPage == "SettingsPage" onTriggered: { - pushPage("SettingsPage") - } - }, - Kirigami.Action { - text: i18n("About") - iconName: "help-about-symbolic" - checked: currentPage == "AboutPage" - onTriggered: { - pushPage("AboutPage") + root.pageStack.layers.clear() + root.pageStack.pushDialogLayer("qrc:/SettingsPage.qml", {}, { + title: i18n("Settings") + }) } } ] @@ -166,14 +161,6 @@ Kirigami.ApplicationWindow { } } - Component { - id: aboutPage - - Kirigami.AboutPage { - aboutData: _aboutData - } - } - contextDrawer: Kirigami.ContextDrawer { id: contextDrawer // make room at the bottom for miniplayer diff --git a/src/resources.qrc b/src/resources.qrc index 4fb1d54d..0a761ee6 100755 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -6,8 +6,7 @@ qml/EntryListPage.qml qml/FeedListPage.qml qml/EntryPage.qml - qml/SettingsPage.qml - qml/AboutPage.qml + qml/Settings/AboutPage.qml qml/FeedDetailsPage.qml qml/AddFeedSheet.qml qml/FeedListDelegate.qml @@ -29,6 +28,10 @@ qml/ErrorNotification.qml qml/ConnectionCheckAction.qml qml/ChapterListDelegate.qml + qml/Settings/SettingsPage.qml + qml/Settings/GeneralSettingsPage.qml + qml/Settings/NetworkSettingsPage.qml + qml/Settings/StorageSettingsPage.qml qtquickcontrols2.conf ../kasts.svg