From 4d1a4a201d6f69f8a983c46c518f0242709a2e66 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Thu, 1 Dec 2022 19:15:21 -0500 Subject: [PATCH] Begin adding restart required indicator to settings --- resources/qml/pages/UserSettingsPage.qml | 28 ++++++++++++++++++++++++ src/UserSettingsPage.cpp | 8 +++++++ src/UserSettingsPage.h | 1 + 3 files changed, 37 insertions(+) diff --git a/resources/qml/pages/UserSettingsPage.qml b/resources/qml/pages/UserSettingsPage.qml index becfc612..9389bdde 100644 --- a/resources/qml/pages/UserSettingsPage.qml +++ b/resources/qml/pages/UserSettingsPage.qml @@ -19,6 +19,14 @@ Rectangle { property bool collapsed: width < collapsePoint color: Nheko.colors.window + Platform.MessageDialog { + id: needsRestartDlg + + buttons: Platform.MessageDialog.Ok + text: qsTr("This setting will take effect the next time Nheko is started") + title: qsTr("Restart required") + } + ScrollView { id: scroll @@ -48,6 +56,7 @@ Rectangle { rows: collapsed? 2: 1 required property var model id: r +// onModelChanged: if (model.needsRestart) restartWarning.visible = true; Label { Layout.alignment: Qt.AlignLeft @@ -72,6 +81,25 @@ Rectangle { wrapMode: Text.Wrap } +// Label { +// id: restartWarning + +// Layout.alignment: Qt.AlignLeft +// visible: false//model.needsRestart +// color: Nheko.theme.red +// text: qsTr("Restart required") +// font.italic: true +// ToolTip.text: qsTr("This setting will take effect the next time Nheko is started") + +//// Connections { +//// enabled: model.needsRestart +//// target: r +//// function onModelChanged() { +//// restartWarning.visible = true; +//// } +//// } +// } + DelegateChooser { id: chooser diff --git a/src/UserSettingsPage.cpp b/src/UserSettingsPage.cpp index 7082d4e2..c9b8611a 100644 --- a/src/UserSettingsPage.cpp +++ b/src/UserSettingsPage.cpp @@ -907,6 +907,7 @@ UserSettingsModel::roleNames() const {Values, "values"}, {Good, "good"}, {Enabled, "enabled"}, + {NeedsRestart, "needsRestart"}, }; return roles; @@ -1515,6 +1516,13 @@ UserSettingsModel::data(const QModelIndex &index, int role) const default: return true; } + } else if (role == NeedsRestart) { + switch (index.row()) { + case ExposeDBusApi: + return true; + default: + return false; + } } return {}; diff --git a/src/UserSettingsPage.h b/src/UserSettingsPage.h index 3bd0f833..88950ec6 100644 --- a/src/UserSettingsPage.h +++ b/src/UserSettingsPage.h @@ -523,6 +523,7 @@ public: Values, Good, Enabled, + NeedsRestart, }; UserSettingsModel(QObject *parent = nullptr);