Create a QML module for settings

This commit is contained in:
James Graham
2024-03-26 13:23:43 +00:00
parent f772906324
commit ff5853a850
38 changed files with 66 additions and 48 deletions

View File

@@ -194,11 +194,6 @@ qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
qml/InviteUserPage.qml
qml/ImageEditorPage.qml
qml/WelcomePage.qml
qml/General.qml
qml/RoomSecurity.qml
qml/PushNotification.qml
qml/Categories.qml
qml/Permissions.qml
qml/NeochatMaximizeComponent.qml
qml/FancyEffectsContainer.qml
qml/TypingPane.qml
@@ -245,25 +240,6 @@ qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
qml/FileDelegateContextMenu.qml
qml/MessageSourceSheet.qml
qml/ReportSheet.qml
qml/SettingsPage.qml
qml/ThemeRadioButton.qml
qml/ColorScheme.qml
qml/GeneralSettingsPage.qml
qml/EmoticonsPage.qml
qml/EmoticonEditorPage.qml
qml/EmoticonFormCard.qml
qml/GlobalNotificationsPage.qml
qml/NotificationRuleItem.qml
qml/AppearanceSettingsPage.qml
qml/AccountsPage.qml
qml/AccountEditorPage.qml
qml/DevicesPage.qml
qml/DeviceDelegate.qml
qml/DevicesCard.qml
qml/About.qml
qml/AboutKDE.qml
qml/SonnetConfigPage.qml
qml/NetworkProxyPage.qml
qml/DevtoolsPage.qml
qml/ConfirmEncryptionDialog.qml
qml/RemoveSheet.qml
@@ -292,7 +268,6 @@ qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
qml/SpaceHierarchyDelegate.qml
qml/RemoveChildDialog.qml
qml/SelectParentDialog.qml
qml/Security.qml
qml/QrCodeMaximizeComponent.qml
qml/SelectSpacesDialog.qml
qml/AttachDialog.qml
@@ -306,7 +281,6 @@ qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
qml/DelegateContextMenu.qml
qml/ShareDialog.qml
qml/FeatureFlagPage.qml
qml/IgnoredUsersDialog.qml
qml/AccountData.qml
qml/StateKeys.qml
qml/UnlockSSSSDialog.qml
@@ -315,6 +289,7 @@ qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN
qml/glowdot.png
)
add_subdirectory(settings)
add_subdirectory(timeline)
if(UNIX)
@@ -407,7 +382,7 @@ if (NOT ANDROID AND NOT WIN32 AND NOT APPLE)
endif()
target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/models ${CMAKE_CURRENT_SOURCE_DIR}/enums)
target_link_libraries(neochat PRIVATE timelineplugin)
target_link_libraries(neochat PRIVATE settingsplugin timelineplugin)
target_link_libraries(neochat PUBLIC
Qt::Core
Qt::Quick

View File

@@ -228,6 +228,7 @@ int main(int argc, char *argv[])
KDBusService service(KDBusService::Unique);
#endif
Q_IMPORT_QML_PLUGIN(org_kde_neochat_settingsPlugin)
Q_IMPORT_QML_PLUGIN(org_kde_neochat_timelinePlugin)
qml_register_types_org_kde_neochat();

View File

@@ -8,6 +8,7 @@ import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.neochat
import org.kde.neochat.settings
import org.kde.neochat.config
QQC2.Menu {
@@ -20,7 +21,7 @@ QQC2.Menu {
QQC2.MenuItem {
text: i18n("Edit this account")
icon.name: "document-edit"
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'AccountEditorPage.qml'), {
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage.qml'), {
connection: root.connection
}, {
title: i18n("Account editor")
@@ -29,7 +30,7 @@ QQC2.Menu {
QQC2.MenuItem {
text: i18n("Notification settings")
icon.name: "notifications"
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), {
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings.qml'), {
defaultPage: "notifications",
connection: root.connection
}, {
@@ -41,7 +42,7 @@ QQC2.Menu {
QQC2.MenuItem {
text: i18n("Devices")
icon.name: "computer-symbolic"
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), {
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings.qml'), {
defaultPage: "devices",
connection: root.connection
}, {

View File

@@ -11,6 +11,7 @@ import org.kde.kirigamiaddons.components as KirigamiComponents
import org.kde.kirigamiaddons.delegates as Delegates
import org.kde.neochat
import org.kde.neochat.settings
/**
* Context menu when clicking on a room in the room list
@@ -121,7 +122,7 @@ Loader {
QQC2.MenuItem {
text: i18n("Room Settings")
icon.name: "configure"
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), {
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings.qml'), {
room: room,
connection: connection
}, {
@@ -195,7 +196,7 @@ Loader {
QQC2.ToolButton {
icon.name: 'settings-configure'
onClicked: {
QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), {
QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings.qml'), {
room: room,
connection: root.connection
}, {

View File

@@ -8,6 +8,7 @@ import QtQuick.Window
import QtQuick.Layouts
import org.kde.neochat
import org.kde.neochat.settings
import org.kde.neochat.config
import org.kde.neochat.accounts
@@ -28,7 +29,7 @@ Labs.MenuBar {
text: i18nc("menu", "Configure NeoChat...")
shortcut: StandardKey.Preferences
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), {
onTriggered: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings.qml'), {
connection: root.connection
}, {
title: i18n("Configure"),

View File

@@ -10,6 +10,7 @@ import org.kde.kirigami as Kirigami
import org.kde.kitemmodels
import org.kde.neochat
import org.kde.neochat.settings
import org.kde.neochat.config
Kirigami.OverlayDrawer {
@@ -102,7 +103,7 @@ Kirigami.OverlayDrawer {
text: i18n("Room settings")
display: QQC2.AbstractButton.IconOnly
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), {
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings.qml'), {
room: room,
connection: root.connection
}, {

View File

@@ -8,6 +8,7 @@ import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.neochat
import org.kde.neochat.settings
Kirigami.Page {
id: root
@@ -70,7 +71,7 @@ Kirigami.Page {
text: i18nc("@button", "Space settings")
icon.name: "settings-configure"
display: QQC2.AbstractButton.IconOnly
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), {
onClicked: applicationWindow().pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings.qml'), {
room: root.currentRoom,
connection: root.currentRoom.connection
}, {

View File

@@ -11,6 +11,7 @@ import org.kde.kirigamiaddons.components as KirigamiComponents
import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat
import org.kde.neochat.settings
/**
* Context menu when clicking on a room in the room list
@@ -45,7 +46,7 @@ Loader {
QQC2.MenuItem {
text: i18nc("'Space' is a matrix space", "Space Settings")
icon.name: 'settings-configure'
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), {
onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings.qml'), {
room: room,
connection: connection
}, {
@@ -130,7 +131,7 @@ Loader {
FormCard.FormButtonDelegate {
text: i18nc("'Space' is a matrix space", "Space Settings")
icon.name: 'settings-configure'
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'Categories.qml'), {
onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'RoomSettings.qml'), {
room: room,
connection: connection
}, {

View File

@@ -9,6 +9,7 @@ import org.kde.kirigamiaddons.labs.components as KirigamiComponents
import org.kde.kirigamiaddons.delegates as Delegates
import org.kde.neochat
import org.kde.neochat.settings
import org.kde.neochat.config
import org.kde.neochat.accounts
@@ -51,7 +52,7 @@ RowLayout {
if (button == Qt.RightButton) {
accountMenu.open();
} else {
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'AccountEditorPage.qml'), {
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'AccountEditorPage.qml'), {
connection: root.connection
}, {
title: i18n("Account editor")
@@ -136,7 +137,7 @@ RowLayout {
}
QQC2.ToolButton {
icon.name: "settings-configure"
onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), {
onClicked: pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings.qml'), {
connection: root.connection
}, {
title: i18n("Configure"),

View File

@@ -9,6 +9,7 @@ import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat
import org.kde.neochat.settings
import org.kde.neochat.accounts
FormCard.FormCardPage {
@@ -216,7 +217,7 @@ FormCard.FormCardPage {
FormCard.FormButtonDelegate {
text: i18nc("@action:button", "Open proxy settings")
icon.name: "settings-configure"
onClicked: pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat", "NetworkProxyPage.qml"), {}, {
onClicked: pageStack.pushDialogLayer(Qt.createComponent("org.kde.neochat.settings", "NetworkProxyPage.qml"), {}, {
title: i18nc("@title:window", "Proxy Settings")
});
}

View File

@@ -8,6 +8,7 @@ import QtQuick.Controls as QQC2
import org.kde.kirigami as Kirigami
import org.kde.neochat
import org.kde.neochat.settings
import org.kde.neochat.config
import org.kde.neochat.accounts
@@ -447,7 +448,7 @@ Kirigami.ApplicationWindow {
Shortcut {
sequence: "Ctrl+Shift+,"
onActivated: {
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat', 'SettingsPage.qml'), {
pageStack.pushDialogLayer(Qt.createComponent('org.kde.neochat.settings', 'NeoChatSettings.qml'), {
connection: root.connection
}, {
title: i18n("Configure"),

View File

@@ -29,7 +29,7 @@ FormCard.FormCardPage {
id: accountDelegate
required property NeoChatConnection connection
Layout.fillWidth: true
onClicked: applicationWindow().pageStack.layers.push(Qt.createComponent('org.kde.neochat', 'AccountEditorPage.qml'), {
onClicked: applicationWindow().pageStack.layers.push('AccountEditorPage.qml', {
connection: accountDelegate.connection
}, {
title: i18n("Account editor")

View File

@@ -221,7 +221,7 @@ FormCard.FormCardPage {
Loader {
id: colorSchemeDelegate
visible: item !== null
sourceComponent: Qt.createComponent('org.kde.neochat', 'ColorScheme.qml')
sourceComponent: Qt.createComponent('org.kde.neochat.settings', 'ColorScheme.qml')
Layout.fillWidth: true
}
}

View File

@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: 2024 James Graham <james.h.graham@protonmail.com>
# SPDX-License-Identifier: BSD-2-Clause
qt_add_library(settings STATIC)
qt_add_qml_module(settings
URI org.kde.neochat.settings
QML_FILES
NeoChatSettings.qml
RoomSettings.qml
About.qml
AboutKDE.qml
AccountsPage.qml
AccountEditorPage.qml
AppearanceSettingsPage.qml
DevicesPage.qml
EmoticonsPage.qml
EmoticonEditorPage.qml
GlobalNotificationsPage.qml
NeoChatGeneralPage.qml
NeoChatSecurityPage.qml
NetworkProxyPage.qml
Permissions.qml
PushNotification.qml
RoomGeneralPage.qml
RoomSecurityPage.qml
SonnetConfigPage.qml
ColorScheme.qml
DevicesCard.qml
DeviceDelegate.qml
EmoticonFormCard.qml
IgnoredUsersDialog.qml
NotificationRuleItem.qml
ThemeRadioButton.qml
)

View File

@@ -19,7 +19,7 @@ KirigamiSettings.CategorizedSettings {
actionName: "general"
text: i18n("General")
icon.name: "org.kde.neochat"
page: Qt.resolvedUrl("GeneralSettingsPage.qml")
page: Qt.resolvedUrl("NeoChatGeneralPage.qml")
},
KirigamiSettings.SettingAction {
actionName: "appearance"
@@ -42,7 +42,7 @@ KirigamiSettings.CategorizedSettings {
actionName: "security"
text: i18n("Security")
icon.name: "preferences-security"
page: Qt.resolvedUrl("Security.qml")
page: Qt.resolvedUrl("NeoChatSecurityPage.qml")
initialProperties: {
return {
connection: root.connection

View File

@@ -7,7 +7,6 @@ import QtQuick.Layouts
import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat
import org.kde.neochat.config
FormCard.FormCardPage {

View File

@@ -20,7 +20,7 @@ KirigamiSettings.CategorizedSettings {
actionName: "general"
text: i18n("General")
icon.name: "settings-configure"
page: Qt.resolvedUrl("General.qml")
page: Qt.resolvedUrl("RoomGeneralPage.qml")
initialProperties: {
return {
room: root.room,
@@ -32,7 +32,7 @@ KirigamiSettings.CategorizedSettings {
actionName: "security"
text: i18n("Security")
icon.name: "security-low"
page: Qt.resolvedUrl("RoomSecurity.qml")
page: Qt.resolvedUrl("RoomSecurityPage.qml")
initialProperties: {
return {
room: root.room