Rework config dialog
Use new KirigamiAddons ConfigurationsView as a replacement for CategorizedSettings. Fix some issues on desktop when running Qt 6.8 and some less recent issues on mobile. Visually this looks the same.
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2020 Tobias Fella <tobias.fella@kde.org>
|
||||
// SPDX-FileCopyrightText: 2021 Carl Schwan <carl@carlschwan.eu>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
|
||||
FormCard.AboutPage {
|
||||
title: i18nc("@title:window", "About NeoChat")
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import org.kde.kirigamiaddons.formcard as FormCard
|
||||
|
||||
FormCard.AboutKDE {
|
||||
title: i18nc("@title:window", "About KDE")
|
||||
}
|
||||
@@ -28,7 +28,7 @@ FormCard.FormCardPage {
|
||||
id: intialAccountTimer
|
||||
interval: 10
|
||||
running: false
|
||||
onTriggered: applicationWindow().pageStack.layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
|
||||
onTriggered: root.QQC2.ApplicationWindow.window.pageStack.layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
|
||||
connection: initialAccount
|
||||
}, {
|
||||
title: i18n("Account editor")
|
||||
@@ -45,7 +45,7 @@ FormCard.FormCardPage {
|
||||
id: accountDelegate
|
||||
required property NeoChatConnection connection
|
||||
Layout.fillWidth: true
|
||||
onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
|
||||
onClicked: root.QQC2.ApplicationWindow.window.pageStack.layers.push(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage'), {
|
||||
connection: accountDelegate.connection
|
||||
}, {
|
||||
title: i18n("Account editor")
|
||||
@@ -87,7 +87,7 @@ FormCard.FormCardPage {
|
||||
QQC2.ToolButton {
|
||||
text: i18n("Logout")
|
||||
icon.name: "im-kick-user"
|
||||
onClicked: confirmLogoutDialogComponent.createObject(applicationWindow().overlay).open()
|
||||
onClicked: confirmLogoutDialogComponent.createObject(root.QQC2.Overlay.overlay).open()
|
||||
}
|
||||
|
||||
Component {
|
||||
@@ -117,7 +117,7 @@ FormCard.FormCardPage {
|
||||
id: addAccountDelegate
|
||||
text: i18n("Add Account")
|
||||
icon.name: "list-add"
|
||||
onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent('org.kde.neochat.login', 'WelcomePage'))
|
||||
onClicked: root.QQC2.ApplicationWindow.window.pageStack.layers.push(Qt.createComponent('org.kde.neochat.login', 'WelcomePage'))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,20 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
|
||||
qt_add_library(settings STATIC)
|
||||
|
||||
set_source_files_properties(
|
||||
RoomSettingsView.qml
|
||||
NeoChatSettingsView.qml
|
||||
PROPERTIES
|
||||
QT_QML_SINGLETON_TYPE TRUE
|
||||
)
|
||||
|
||||
qt_add_qml_module(settings
|
||||
URI org.kde.neochat.settings
|
||||
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src/org/kde/neochat/settings
|
||||
QML_FILES
|
||||
NeoChatSettings.qml
|
||||
RoomSettings.qml
|
||||
About.qml
|
||||
AboutKDE.qml
|
||||
NeoChatSettingsView.qml
|
||||
RoomSettingsView.qml
|
||||
AccountsPage.qml
|
||||
AccountEditorPage.qml
|
||||
AppearanceSettingsPage.qml
|
||||
|
||||
@@ -1,113 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.settings as KirigamiSettings
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
KirigamiSettings.CategorizedSettings {
|
||||
id: root
|
||||
|
||||
property NeoChatConnection connection
|
||||
|
||||
property NeoChatConnection initialAccount
|
||||
|
||||
objectName: "settingsPage"
|
||||
actions: [
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "general"
|
||||
text: i18n("General")
|
||||
icon.name: "org.kde.neochat"
|
||||
page: Qt.resolvedUrl("NeoChatGeneralPage.qml")
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "appearance"
|
||||
text: i18n("Appearance")
|
||||
icon.name: "preferences-desktop-theme-global"
|
||||
page: Qt.resolvedUrl("AppearanceSettingsPage.qml")
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "notifications"
|
||||
text: i18n("Notifications")
|
||||
icon.name: "preferences-desktop-notification"
|
||||
page: Qt.resolvedUrl("GlobalNotificationsPage.qml")
|
||||
initialProperties: {
|
||||
return {
|
||||
connection: root.connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "security"
|
||||
text: i18n("Security")
|
||||
icon.name: "preferences-security"
|
||||
page: Qt.resolvedUrl("NeoChatSecurityPage.qml")
|
||||
initialProperties: {
|
||||
return {
|
||||
connection: root.connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "accounts"
|
||||
text: i18n("Accounts")
|
||||
icon.name: "preferences-system-users"
|
||||
page: Qt.resolvedUrl("AccountsPage.qml")
|
||||
initialProperties: {
|
||||
return {
|
||||
initialAccount: root.initialAccount
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "emoticons"
|
||||
text: i18n("Stickers & Emojis")
|
||||
icon.name: "preferences-desktop-emoticons"
|
||||
page: Qt.resolvedUrl("EmoticonsPage.qml")
|
||||
initialProperties: {
|
||||
return {
|
||||
connection: root.connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "spellChecking"
|
||||
text: i18n("Spell Checking")
|
||||
icon.name: "tools-check-spelling"
|
||||
page: Qt.resolvedUrl("SonnetConfigPage.qml")
|
||||
visible: Qt.platform.os !== "android"
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "networkProxy"
|
||||
text: i18n("Network Proxy")
|
||||
icon.name: "network-connect"
|
||||
page: Qt.resolvedUrl("NetworkProxyPage.qml")
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "devices"
|
||||
text: i18n("Devices")
|
||||
icon.name: "computer"
|
||||
page: Qt.resolvedUrl("DevicesPage.qml")
|
||||
initialProperties: {
|
||||
return {
|
||||
connection: root.connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "aboutNeochat"
|
||||
text: i18n("About NeoChat")
|
||||
icon.name: "help-about"
|
||||
page: Qt.resolvedUrl("About.qml")
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "aboutKDE"
|
||||
text: i18n("About KDE")
|
||||
icon.name: "kde"
|
||||
page: Qt.resolvedUrl("AboutKDE.qml")
|
||||
}
|
||||
]
|
||||
}
|
||||
110
src/settings/NeoChatSettingsView.qml
Normal file
110
src/settings/NeoChatSettingsView.qml
Normal file
@@ -0,0 +1,110 @@
|
||||
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.settings as KirigamiSettings
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
KirigamiSettings.ConfigurationView {
|
||||
id: root
|
||||
|
||||
property NeoChatConnection connection
|
||||
|
||||
objectName: "settingsPage"
|
||||
modules: [
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "general"
|
||||
text: i18n("General")
|
||||
icon.name: "org.kde.neochat"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "NeoChatGeneralPage")
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "appearance"
|
||||
text: i18n("Appearance")
|
||||
icon.name: "preferences-desktop-theme-global"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "AppearanceSettingsPage")
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "notifications"
|
||||
text: i18n("Notifications")
|
||||
icon.name: "preferences-desktop-notification"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "GlobalNotificationsPage")
|
||||
initialProperties: () => {
|
||||
return {
|
||||
connection: root.connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "security"
|
||||
text: i18n("Security")
|
||||
icon.name: "preferences-security"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "NeoChatSecurityPage")
|
||||
initialProperties: () => {
|
||||
return {
|
||||
connection: root.connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "accounts"
|
||||
text: i18n("Accounts")
|
||||
icon.name: "preferences-system-users"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "AccountsPage")
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "emoticons"
|
||||
text: i18n("Stickers & Emojis")
|
||||
icon.name: "preferences-desktop-emoticons"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "EmoticonsPage")
|
||||
initialProperties: () => {
|
||||
return {
|
||||
connection: root.connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "spellChecking"
|
||||
text: i18n("Spell Checking")
|
||||
icon.name: "tools-check-spelling"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "SonnetConfigPage")
|
||||
visible: Qt.platform.os !== "android"
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "networkProxy"
|
||||
text: i18n("Network Proxy")
|
||||
icon.name: "network-connect"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "NetworkProxyPage")
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "devices"
|
||||
text: i18n("Devices")
|
||||
icon.name: "computer"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "DevicesPage")
|
||||
initialProperties: () => {
|
||||
return {
|
||||
connection: root.connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "aboutNeochat"
|
||||
text: i18n("About NeoChat")
|
||||
icon.name: "help-about"
|
||||
page: () => Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutPage")
|
||||
category: i18nc("@title:group", "About")
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "aboutKDE"
|
||||
text: i18n("About KDE")
|
||||
icon.name: "kde"
|
||||
page: () => Qt.createComponent("org.kde.kirigamiaddons.formcard", "AboutKDE")
|
||||
category: i18nc("@title:group", "About")
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
import QtQuick
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.settings as KirigamiSettings
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
KirigamiSettings.CategorizedSettings {
|
||||
id: root
|
||||
|
||||
property NeoChatRoom room
|
||||
required property NeoChatConnection connection
|
||||
|
||||
objectName: "settingsPage"
|
||||
actions: [
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "general"
|
||||
text: i18n("General")
|
||||
icon.name: "settings-configure"
|
||||
page: Qt.resolvedUrl("RoomGeneralPage.qml")
|
||||
initialProperties: {
|
||||
return {
|
||||
room: root.room,
|
||||
connection: root.connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "security"
|
||||
text: i18n("Security")
|
||||
icon.name: "security-low"
|
||||
page: Qt.resolvedUrl("RoomSecurityPage.qml")
|
||||
initialProperties: {
|
||||
return {
|
||||
room: root.room
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "permissions"
|
||||
text: i18n("Permissions")
|
||||
icon.name: "visibility"
|
||||
page: Qt.resolvedUrl("Permissions.qml")
|
||||
initialProperties: {
|
||||
return {
|
||||
room: root.room
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.SettingAction {
|
||||
actionName: "notifications"
|
||||
text: i18n("Notifications")
|
||||
icon.name: "notifications"
|
||||
page: Qt.resolvedUrl("PushNotification.qml")
|
||||
initialProperties: {
|
||||
return {
|
||||
room: root.room
|
||||
};
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
83
src/settings/RoomSettingsView.qml
Normal file
83
src/settings/RoomSettingsView.qml
Normal file
@@ -0,0 +1,83 @@
|
||||
// SPDX-FileCopyrightText: 2021 Carl Schwan <carlschwan@kde.org>
|
||||
// SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import org.kde.kirigami as Kirigami
|
||||
import org.kde.kirigamiaddons.settings as KirigamiSettings
|
||||
import QtQuick.Layouts
|
||||
|
||||
import org.kde.neochat
|
||||
|
||||
KirigamiSettings.ConfigurationView {
|
||||
id: root
|
||||
|
||||
enum Type {
|
||||
Room,
|
||||
Space
|
||||
}
|
||||
|
||||
property NeoChatRoom _room
|
||||
property NeoChatConnection _connection
|
||||
|
||||
function openRoomSettings(room: NeoChatRoom, type: int): void {
|
||||
root._room = room;
|
||||
root._connection = room.connection;
|
||||
if (type === RoomSettingsView.Type.Space) {
|
||||
root.title = i18nc("@title:window", "Space Settings");
|
||||
} else {
|
||||
root.title = i18nc("@title:window", "Room Settings");
|
||||
}
|
||||
open();
|
||||
}
|
||||
|
||||
objectName: "settingsPage"
|
||||
modules: [
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "general"
|
||||
text: i18n("General")
|
||||
icon.name: "settings-configure"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "RoomGeneralPage")
|
||||
initialProperties: () => {
|
||||
return {
|
||||
room: root._room,
|
||||
connection: root._connection
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "security"
|
||||
text: i18n("Security")
|
||||
icon.name: "security-low"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "RoomSecurityPage")
|
||||
initialProperties: () => {
|
||||
return {
|
||||
room: root._room
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "permissions"
|
||||
text: i18n("Permissions")
|
||||
icon.name: "visibility"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "Permissions")
|
||||
initialProperties: () => {
|
||||
return {
|
||||
room: root._room
|
||||
};
|
||||
}
|
||||
},
|
||||
KirigamiSettings.ConfigurationModule {
|
||||
moduleId: "notifications"
|
||||
text: i18n("Notifications")
|
||||
icon.name: "notifications"
|
||||
page: () => Qt.createComponent("org.kde.neochat.settings", "PushNotification")
|
||||
initialProperties: () => {
|
||||
return {
|
||||
room: root._room
|
||||
};
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user