chore(storybook): unbreak (Device)SyncingViewPage

and make it configurable a bit
This commit is contained in:
Lukáš Tinkl 2023-10-03 13:44:45 +02:00 committed by Lukáš Tinkl
parent a587e504ef
commit f2f954c24b
6 changed files with 142 additions and 80 deletions

View File

@ -1,72 +0,0 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import StatusQ.Core 0.1
import Storybook 1.0
import Models 1.0
import utils 1.0
import shared.views 1.0
SplitView {
id: root
Logs { id: logs }
SplitView {
orientation: Qt.Vertical
SplitView.fillWidth: true
DeviceSyncingView {
devicesModel: ListModel {
ListElement {
name: "Device 1"
deviceType: "osx"
timestamp: 0
isCurrentDevice: false
}
ListElement {
name: "Device 2"
deviceType: "windows"
timestamp: 0
isCurrentDevice: false
}
ListElement {
name: "Device 3"
deviceType: "android"
timestamp: 0
isCurrentDevice: false
}
ListElement {
name: "Device 4"
deviceType: "ios"
timestamp: 0
isCurrentDevice: false
}
ListElement {
name: "Device 5"
deviceType: "desktop"
timestamp: 0
isCurrentDevice: false
}
}
}
LogsAndControlsPanel {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 200
logsView.logText: logs.logText
}
}
Pane {
SplitView.minimumWidth: 300
SplitView.preferredWidth: 300
}
}
// category: Views

View File

@ -0,0 +1,131 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import Storybook 1.0
import mainui 1.0
import utils 1.0
import AppLayouts.Profile.views 1.0
SplitView {
id: root
orientation: Qt.Vertical
Logs { id: logs }
Popups {
popupParent: root
rootStore: QtObject {}
}
SyncingView {
id: syncView
SplitView.fillWidth: true
SplitView.fillHeight: true
contentWidth: 664
isProduction: ctrlIsProduction.checked
advancedStore: QtObject {
readonly property bool isDebugEnabled: ctrlDebugEnabled.checked
}
devicesStore: QtObject {
function generateConnectionStringAndRunSetupSyncingPopup() {
logs.logEvent("devicesStore::generateConnectionStringAndRunSetupSyncingPopup()")
}
function setInstallationName(installationId, name) {
logs.logEvent("devicesStore::setInstallationName", ["installationId", "name"], arguments)
}
readonly property bool isDeviceSetup: ctrlDevicesLoaded.checked
readonly property var devicesModule: QtObject {
readonly property bool devicesLoading: ctrlDevicesLoading.checked
readonly property bool devicesLoadingError: ctrlDevicesLoadingError.checked
}
readonly property var devicesModel: ListModel {
ListElement {
name: "Device 1"
deviceType: "osx"
timestamp: 123456789123
isCurrentDevice: true
enabled: true
installationId: "a"
}
ListElement {
name: "Device 2"
deviceType: "windows"
timestamp: 123456789123
isCurrentDevice: false
enabled: false
installationId: "b"
}
ListElement {
name: "Device 3"
deviceType: "android"
timestamp: 3456541235346346322
isCurrentDevice: false
enabled: true
installationId: "c"
}
ListElement {
name: "Device 4"
deviceType: "ios"
timestamp: 385657923539634639
isCurrentDevice: false
enabled: true
installationId: "d"
}
ListElement {
name: "Device 5"
deviceType: "desktop"
timestamp: 0
isCurrentDevice: false
enabled: true
installationId: "e"
}
}
}
}
LogsAndControlsPanel {
id: logsAndControlsPanel
SplitView.minimumHeight: 100
SplitView.preferredHeight: 270
logsView.logText: logs.logText
ColumnLayout {
RadioButton {
id: ctrlDevicesLoaded
text: "Devices loaded"
checked: true
}
RadioButton {
id: ctrlDevicesLoading
text: "Devices loading"
}
RadioButton {
id: ctrlDevicesLoadingError
text: "Devices loading error"
}
Switch {
id: ctrlDebugEnabled
text: "Debug enabled"
}
Switch {
id: ctrlIsProduction
text: "Is production"
checked: true
}
}
}
}
// category: Views

View File

@ -236,6 +236,7 @@ StatusSectionLayout {
implicitWidth: parent.width
implicitHeight: parent.height
isProduction: production
profileStore: root.store.profileStore
devicesStore: root.store.devicesStore
privacyStore: root.store.privacyStore

View File

@ -19,8 +19,8 @@ import "../stores"
StatusDialog {
id: root
property DevicesStore devicesStore
property AdvancedStore advancedStore
property var devicesStore
property var advancedStore
property var deviceModel
readonly property string deviceName: d.deviceName

View File

@ -27,10 +27,12 @@ import "../../stores"
SettingsContentBase {
id: root
property DevicesStore devicesStore
property var devicesStore
property ProfileStore profileStore
property PrivacyStore privacyStore
property AdvancedStore advancedStore
property var advancedStore
required property bool isProduction
ColumnLayout {
id: layout
@ -247,11 +249,10 @@ SettingsContentBase {
}
StatusButton {
objectName: "setupSyncBackupDataButton"
id: backupBtn
visible: !production
visible: !root.isProduction
Layout.alignment: Qt.AlignHCenter
text: qsTr("Backup Data")
onClicked : {
@ -264,7 +265,7 @@ SettingsContentBase {
id: personalizeDevicePopup
SyncDeviceCustomizationPopup {
anchors.centerIn: parent
destroyOnClose: true
devicesStore: root.devicesStore
advancedStore: root.advancedStore
}
@ -274,7 +275,7 @@ SettingsContentBase {
id: setupSyncingPopup
SetupSyncingPopup {
anchors.centerIn: parent
destroyOnClose: true
devicesStore: root.devicesStore
profileStore: root.profileStore
}

View File

@ -4,3 +4,4 @@ AppearanceView 1.0 AppearanceView.qml
NotificationsView 1.0 NotificationsView.qml
CommunitiesView 1.0 CommunitiesView.qml
BrowserView 1.0 BrowserView.qml
SyncingView 1.0 SyncingView.qml