diff --git a/src/devtools/DebugOptions.qml b/src/devtools/DebugOptions.qml index cb61c3222..b16830d3b 100644 --- a/src/devtools/DebugOptions.qml +++ b/src/devtools/DebugOptions.qml @@ -9,34 +9,32 @@ import org.kde.kirigamiaddons.formcard as FormCard import org.kde.neochat -FormCard.FormCardPage { +FormCard.FormCard { id: root - FormCard.FormCard { - Layout.topMargin: Kirigami.Units.largeSpacing + Layout.topMargin: Kirigami.Units.largeSpacing - FormCard.FormCheckDelegate { - text: i18nc("@option:check", "Show hidden events in the timeline") - checked: NeoChatConfig.showAllEvents + FormCard.FormCheckDelegate { + text: i18nc("@option:check", "Show hidden events in the timeline") + checked: NeoChatConfig.showAllEvents - onToggled: NeoChatConfig.showAllEvents = checked - } - FormCard.FormCheckDelegate { - id: roomAccountDataVisibleCheck - text: i18nc("@option:check Enable the matrix 'threads' feature", "Always allow device verification") - description: i18n("Allow the user to start a verification session with devices that were already verified") - checked: NeoChatConfig.alwaysVerifyDevice + onToggled: NeoChatConfig.showAllEvents = checked + } + FormCard.FormCheckDelegate { + id: roomAccountDataVisibleCheck + text: i18nc("@option:check Enable the matrix 'threads' feature", "Always allow device verification") + description: i18n("Allow the user to start a verification session with devices that were already verified") + checked: NeoChatConfig.alwaysVerifyDevice - onToggled: NeoChatConfig.alwaysVerifyDevice = checked - } - FormCard.FormCheckDelegate { - text: i18nc("@option:check", "Show focus in window header") - checked: NeoChatConfig.windowTitleFocus + onToggled: NeoChatConfig.alwaysVerifyDevice = checked + } + FormCard.FormCheckDelegate { + text: i18nc("@option:check", "Show focus in window header") + checked: NeoChatConfig.windowTitleFocus - onToggled: { - NeoChatConfig.windowTitleFocus = checked; - NeoChatConfig.save(); - } + onToggled: { + NeoChatConfig.windowTitleFocus = checked; + NeoChatConfig.save(); } } } diff --git a/src/devtools/DevtoolsPage.qml b/src/devtools/DevtoolsPage.qml index abe393c65..6ef7c0d13 100644 --- a/src/devtools/DevtoolsPage.qml +++ b/src/devtools/DevtoolsPage.qml @@ -1,21 +1,24 @@ // SPDX-FileCopyrightText: 2022 Tobias Fella // SPDX-License-Identifier: GPL-2.0-or-later +pragma ComponentBehavior: Bound + import QtQuick import QtQuick.Controls as QQC2 import QtQuick.Layouts +import org.kde.kirigami as Kirigami import org.kde.kirigamiaddons.formcard as FormCard import org.kde.neochat -FormCard.FormCardPage { +Kirigami.ScrollablePage { id: root property NeoChatRoom room required property NeoChatConnection connection - title: i18n("Developer Tools") + title: i18nc("@title", "Developer Tools") leftPadding: 0 rightPadding: 0 @@ -52,22 +55,45 @@ FormCard.FormCardPage { } } - StackLayout { - id: swipeView - - currentIndex: tabBar.currentIndex + Loader { + sourceComponent: switch (tabBar.currentIndex) { + case 0: return debugOptions; + case 1: return roomData; + case 2: return serverData; + case 3: return accountData; + case 4: return featureFlags; + } + } + Component { + id: debugOptions DebugOptions {} + } + + Component { + id: roomData RoomData { room: root.room connection: root.connection } + } + + Component { + id: serverData ServerData { connection: root.connection } + } + + Component { + id: accountData AccountData { connection: root.connection } + } + + Component { + id: featureFlags FeatureFlagPage {} } } diff --git a/src/devtools/FeatureFlagPage.qml b/src/devtools/FeatureFlagPage.qml index c278bc77c..47c4d994e 100644 --- a/src/devtools/FeatureFlagPage.qml +++ b/src/devtools/FeatureFlagPage.qml @@ -9,33 +9,31 @@ import org.kde.kirigamiaddons.formcard as FormCard import org.kde.neochat -FormCard.FormCardPage { +FormCard.FormCard { id: root - FormCard.FormCard { - Layout.topMargin: Kirigami.Units.largeSpacing + Layout.topMargin: Kirigami.Units.largeSpacing - FormCard.FormCheckDelegate { - id: roomAccountDataVisibleCheck - text: i18nc("@option:check Enable the matrix 'threads' feature", "Threads") - checked: NeoChatConfig.threads + FormCard.FormCheckDelegate { + id: roomAccountDataVisibleCheck + text: i18nc("@option:check Enable the matrix 'threads' feature", "Threads") + checked: NeoChatConfig.threads - onToggled: NeoChatConfig.threads = checked - } - FormCard.FormCheckDelegate { - text: i18nc("@option:check Enable the matrix 'secret backup' feature", "Secret Backup") - checked: NeoChatConfig.secretBackup + onToggled: NeoChatConfig.threads = checked + } + FormCard.FormCheckDelegate { + text: i18nc("@option:check Enable the matrix 'secret backup' feature", "Secret Backup") + checked: NeoChatConfig.secretBackup - onToggled: NeoChatConfig.secretBackup = checked - } - FormCard.FormCheckDelegate { - text: i18nc("@option:check Enable the matrix feature to add a phone number as a third party ID", "Add phone numbers as 3PIDs") - checked: NeoChatConfig.phone3PId + onToggled: NeoChatConfig.secretBackup = checked + } + FormCard.FormCheckDelegate { + text: i18nc("@option:check Enable the matrix feature to add a phone number as a third party ID", "Add phone numbers as 3PIDs") + checked: NeoChatConfig.phone3PId - onToggled: { - NeoChatConfig.phone3PId = checked - NeoChatConfig.save(); - } + onToggled: { + NeoChatConfig.phone3PId = checked + NeoChatConfig.save(); } } }