Improve DevtoolsPage

Notably, port away from StackLayout, as it doesn't work well when the individual components have different heights
This commit is contained in:
Tobias Fella
2025-04-14 17:47:16 +02:00
parent 0f704417c6
commit d668d2f2de
3 changed files with 71 additions and 49 deletions

View File

@@ -9,34 +9,32 @@ import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat import org.kde.neochat
FormCard.FormCardPage { FormCard.FormCard {
id: root id: root
FormCard.FormCard { Layout.topMargin: Kirigami.Units.largeSpacing
Layout.topMargin: Kirigami.Units.largeSpacing
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
text: i18nc("@option:check", "Show hidden events in the timeline") text: i18nc("@option:check", "Show hidden events in the timeline")
checked: NeoChatConfig.showAllEvents checked: NeoChatConfig.showAllEvents
onToggled: NeoChatConfig.showAllEvents = checked onToggled: NeoChatConfig.showAllEvents = checked
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: roomAccountDataVisibleCheck id: roomAccountDataVisibleCheck
text: i18nc("@option:check Enable the matrix 'threads' feature", "Always allow device verification") 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") description: i18n("Allow the user to start a verification session with devices that were already verified")
checked: NeoChatConfig.alwaysVerifyDevice checked: NeoChatConfig.alwaysVerifyDevice
onToggled: NeoChatConfig.alwaysVerifyDevice = checked onToggled: NeoChatConfig.alwaysVerifyDevice = checked
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
text: i18nc("@option:check", "Show focus in window header") text: i18nc("@option:check", "Show focus in window header")
checked: NeoChatConfig.windowTitleFocus checked: NeoChatConfig.windowTitleFocus
onToggled: { onToggled: {
NeoChatConfig.windowTitleFocus = checked; NeoChatConfig.windowTitleFocus = checked;
NeoChatConfig.save(); NeoChatConfig.save();
}
} }
} }
} }

View File

@@ -1,21 +1,24 @@
// SPDX-FileCopyrightText: 2022 Tobias Fella <tobias.fella@kde.org> // SPDX-FileCopyrightText: 2022 Tobias Fella <tobias.fella@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
pragma ComponentBehavior: Bound
import QtQuick import QtQuick
import QtQuick.Controls as QQC2 import QtQuick.Controls as QQC2
import QtQuick.Layouts import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.kirigamiaddons.formcard as FormCard import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat import org.kde.neochat
FormCard.FormCardPage { Kirigami.ScrollablePage {
id: root id: root
property NeoChatRoom room property NeoChatRoom room
required property NeoChatConnection connection required property NeoChatConnection connection
title: i18n("Developer Tools") title: i18nc("@title", "Developer Tools")
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
@@ -52,22 +55,45 @@ FormCard.FormCardPage {
} }
} }
StackLayout { Loader {
id: swipeView sourceComponent: switch (tabBar.currentIndex) {
case 0: return debugOptions;
currentIndex: tabBar.currentIndex case 1: return roomData;
case 2: return serverData;
case 3: return accountData;
case 4: return featureFlags;
}
}
Component {
id: debugOptions
DebugOptions {} DebugOptions {}
}
Component {
id: roomData
RoomData { RoomData {
room: root.room room: root.room
connection: root.connection connection: root.connection
} }
}
Component {
id: serverData
ServerData { ServerData {
connection: root.connection connection: root.connection
} }
}
Component {
id: accountData
AccountData { AccountData {
connection: root.connection connection: root.connection
} }
}
Component {
id: featureFlags
FeatureFlagPage {} FeatureFlagPage {}
} }
} }

View File

@@ -9,33 +9,31 @@ import org.kde.kirigamiaddons.formcard as FormCard
import org.kde.neochat import org.kde.neochat
FormCard.FormCardPage { FormCard.FormCard {
id: root id: root
FormCard.FormCard { Layout.topMargin: Kirigami.Units.largeSpacing
Layout.topMargin: Kirigami.Units.largeSpacing
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
id: roomAccountDataVisibleCheck id: roomAccountDataVisibleCheck
text: i18nc("@option:check Enable the matrix 'threads' feature", "Threads") text: i18nc("@option:check Enable the matrix 'threads' feature", "Threads")
checked: NeoChatConfig.threads checked: NeoChatConfig.threads
onToggled: NeoChatConfig.threads = checked onToggled: NeoChatConfig.threads = checked
} }
FormCard.FormCheckDelegate { FormCard.FormCheckDelegate {
text: i18nc("@option:check Enable the matrix 'secret backup' feature", "Secret Backup") text: i18nc("@option:check Enable the matrix 'secret backup' feature", "Secret Backup")
checked: NeoChatConfig.secretBackup checked: NeoChatConfig.secretBackup
onToggled: NeoChatConfig.secretBackup = checked onToggled: NeoChatConfig.secretBackup = checked
} }
FormCard.FormCheckDelegate { 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") 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 checked: NeoChatConfig.phone3PId
onToggled: { onToggled: {
NeoChatConfig.phone3PId = checked NeoChatConfig.phone3PId = checked
NeoChatConfig.save(); NeoChatConfig.save();
}
} }
} }
} }