Move Error log from dialog overlay to dedicated settings page

This commit is contained in:
Bart De Vries 2022-12-12 14:43:58 +01:00
parent 8e1b278539
commit 3898471f08
6 changed files with 149 additions and 85 deletions

77
src/qml/ErrorList.qml Normal file
View File

@ -0,0 +1,77 @@
/**
* 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 2.15
import QtQuick.Controls 2.15 as Controls
import QtQuick.Layouts 1.14
import QtGraphicalEffects 1.15
import org.kde.kirigami 2.19 as Kirigami
import org.kde.kasts 1.0
ListView {
id: errorList
reuseItems: true
model: ErrorLogModel
implicitHeight: errorList.count > 0 ? errorList.contentHeight : placeholder.height
Kirigami.PlaceholderMessage {
id: placeholder
height: 3.0 * Kirigami.Units.gridUnit
visible: errorList.count == 0
anchors.centerIn: parent
text: i18n("No Errors Logged")
}
Component {
id: errorListDelegate
Kirigami.SwipeListItem {
// workaround to get rid of "_swipeFilter" errors
alwaysVisibleActions: true
highlighted: false
activeBackgroundColor: 'transparent'
contentItem: RowLayout {
Kirigami.Icon {
source: "data-error"
property int size: Kirigami.Units.iconSizes.medium
Layout.preferredHeight: size
Layout.preferredWidth: size
}
ColumnLayout {
spacing: Kirigami.Units.smallSpacing
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Controls.Label {
text: error.description + " · " + error.date.toLocaleDateString(Qt.locale(), Locale.NarrowFormat) + " · " + error.date.toLocaleTimeString(Qt.locale(), Locale.NarrowFormat)
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: 0.7
}
Controls.Label {
text: error.title
Layout.fillWidth: true
elide: Text.ElideRight
font.weight: Font.Normal
opacity: 1
}
Controls.Label {
text: i18n("Error Code: ") + error.code + (error.message ? " · " + error.message : "")
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: 0.7
}
}
}
}
}
delegate: errorListDelegate
}

View File

@ -1,5 +1,5 @@
/**
* SPDX-FileCopyrightText: 2021 Bart De Vries <bart@mogwai.be>
* 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
*/
@ -20,72 +20,17 @@ Kirigami.Dialog {
showCloseButton: true
title: i18n("Error Log")
title: i18nc("@title", "Error Log")
standardButtons: Kirigami.Dialog.NoButton
customFooterActions: Kirigami.Action {
text: i18n("Clear All Errors")
text: i18nc("@action:button", "Clear All Errors")
iconName: "edit-clear-all"
onTriggered: ErrorLogModel.clearAll()
enabled: errorList.count > 0
}
ListView {
ErrorList {
id: errorList
reuseItems: true
model: ErrorLogModel
Kirigami.PlaceholderMessage {
id: placeholder
visible: errorList.count == 0
anchors.centerIn: parent
text: i18n("No Errors Logged")
}
Component {
id: errorListDelegate
Kirigami.SwipeListItem {
// workaround to get rid of "_swipeFilter" errors
alwaysVisibleActions: true
contentItem: RowLayout {
Kirigami.Icon {
source: "data-error"
property int size: Kirigami.Units.iconSizes.medium
Layout.preferredHeight: size
Layout.preferredWidth: size
}
ColumnLayout {
spacing: Kirigami.Units.smallSpacing
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
Controls.Label {
text: error.description + " · " + error.date.toLocaleDateString(Qt.locale(), Locale.NarrowFormat) + " · " + error.date.toLocaleTimeString(Qt.locale(), Locale.NarrowFormat)
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: 0.7
}
Controls.Label {
text: error.title
Layout.fillWidth: true
elide: Text.ElideRight
font.weight: Font.Normal
opacity: 1
}
Controls.Label {
text: i18n("Error Code: ") + error.code + (error.message ? " · " + error.message : "")
Layout.fillWidth: true
elide: Text.ElideRight
font: Kirigami.Theme.smallFont
opacity: 0.7
}
}
}
}
}
delegate: errorListDelegate
}
}

View File

@ -0,0 +1,60 @@
/**
* SPDX-FileCopyrightText: 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 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.kirigamiaddons.labs.mobileform 0.1 as MobileForm
import org.kde.kasts 1.0
Kirigami.ScrollablePage {
title: i18nc("@title", "Error Log")
leftPadding: 0
rightPadding: 0
topPadding: Kirigami.Units.gridUnit
bottomPadding: Kirigami.Units.gridUnit
Kirigami.Theme.colorSet: Kirigami.Theme.Window
Kirigami.Theme.inherit: false
ColumnLayout {
spacing: 0
MobileForm.FormCard {
Layout.fillWidth: true
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18nc("@title", "Error Log")
}
MobileForm.AbstractFormDelegate {
background: Item {}
contentItem: ErrorList {
id: errorList
}
}
MobileForm.FormDelegateSeparator {}
MobileForm.FormTextDelegate {
trailing: Controls.Button {
icon.name: "edit-clear-all"
text: i18nc("@action:button", "Clear All Errors")
onClicked: ErrorLogModel.clearAll()
enabled: errorList.count > 0
}
}
}
}
}
}

View File

@ -291,31 +291,5 @@ Kirigami.ScrollablePage {
}
}
}
MobileForm.FormCard {
Layout.fillWidth: true
Layout.topMargin: Kirigami.Units.largeSpacing
contentItem: ColumnLayout {
spacing: 0
MobileForm.FormCardHeader {
title: i18n("Errors")
}
MobileForm.FormTextDelegate {
text: i18n("Error log")
trailing: Controls.Button {
icon.name: "error"
text: i18n("Open Log")
onClicked: settingsErrorOverlay.open()
}
}
ErrorListOverlay {
id: settingsErrorOverlay
}
}
}
}
}

View File

@ -32,6 +32,11 @@ Kirigami.CategorizedSettings {
icon.name: "state-sync"
page: "qrc:/SynchronizationSettingsPage.qml"
},
Kirigami.SettingAction {
text: i18n("Error Log")
icon.name: "error"
page: "qrc:/ErrorListPage.qml"
},
Kirigami.SettingAction {
text: i18n("About")
icon.name: "documentinfo"

View File

@ -1,4 +1,5 @@
<!-- SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de> -->
<!-- SPDX-FileCopyrightText: 2021-2022 Bart De Vries <bart@mogwai.be> -->
<!-- SPDX-License-Identifier: CC0-1.0 -->
<RCC>
<qresource prefix="/">
@ -15,6 +16,7 @@
<file alias="QueuePage.qml">qml/QueuePage.qml</file>
<file alias="EpisodeListPage.qml">qml/EpisodeListPage.qml</file>
<file alias="DownloadListPage.qml">qml/DownloadListPage.qml</file>
<file alias="ErrorList.qml">qml/ErrorList.qml</file>
<file alias="ErrorListOverlay.qml">qml/ErrorListOverlay.qml</file>
<file alias="GenericHeader.qml">qml/GenericHeader.qml</file>
<file alias="GenericEntryDelegate.qml">qml/GenericEntryDelegate.qml</file>
@ -33,6 +35,7 @@
<file alias="NetworkSettingsPage.qml">qml/Settings/NetworkSettingsPage.qml</file>
<file alias="StorageSettingsPage.qml">qml/Settings/StorageSettingsPage.qml</file>
<file alias="SynchronizationSettingsPage.qml">qml/Settings/SynchronizationSettingsPage.qml</file>
<file alias="ErrorListPage.qml">qml/Settings/ErrorListPage.qml</file>
<file alias="BottomToolbar.qml">qml/BottomToolbar.qml</file>
<file alias="SleepTimerDialog.qml">qml/SleepTimerDialog.qml</file>
<file>qtquickcontrols2.conf</file>