Extract sync status layout to separate file
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Sun, 14 Jan 2024 18:06:21 +0000 (02:06 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Mon, 19 Feb 2024 14:45:22 +0000 (22:45 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
resources.qrc
src/gui/macOS/ui/FileProviderSettings.qml
src/gui/macOS/ui/FileProviderSyncStatus.qml [new file with mode: 0644]

index 70747c1b936871a2c4d8146d78b53848d8774528..217e9c312b392e3d64139793c9af7eb9e906b934 100644 (file)
@@ -65,5 +65,6 @@
         <file>src/gui/macOS/ui/FileProviderSettings.qml</file>
         <file>src/gui/macOS/ui/FileProviderFileDelegate.qml</file>
         <file>src/gui/macOS/ui/FileProviderEvictionDialog.qml</file>
+        <file>src/gui/macOS/ui/FileProviderSyncStatus.qml</file>
     </qresource>
 </RCC>
index f87ce1e3a3f9c4ccca0c8b69d4253e44d3502ace..f85618d5214e74927e66b63b5717ec16bd73b5c3 100644 (file)
@@ -90,42 +90,8 @@ Page {
 
             active: vfsEnabledCheckBox.checked
             sourceComponent: ColumnLayout {
-                GridLayout {
-                    id: currentSyncGrid
-
-                    readonly property var syncStatus: root.controller.domainSyncStatusForAccount(root.accountUserIdAtHost)
-
-                    EnforcedPlainTextLabel {
-                        Layout.row: 0
-                        Layout.column: 1
-                        Layout.columnSpan: currentSyncGrid.syncStatus.syncing ? 2 : 1
-                        Layout.fillWidth: true
-                        text: currentSyncGrid.syncStatus.syncing ? qsTr("Syncing") : qsTr("All synced!")
-                    }
-
-                    NCBusyIndicator {
-                        id: syncIcon
-
-                        property int size: Style.trayListItemIconSize * 0.6
-
-                        Layout.row: 0
-                        Layout.rowSpan: 2
-                        Layout.column: 0
-                        Layout.preferredWidth: size
-                        Layout.preferredHeight: size
-                        Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
-
-                        imageSource: currentSyncGrid.syncStatus.icon
-                        running: currentSyncGrid.syncStatus.syncing
-                    }
-
-                    ProgressBar {
-                        Layout.row: 1
-                        Layout.column: 1
-                        Layout.fillWidth: true
-                        value: currentSyncGrid.syncStatus.fractionCompleted
-                        visible: currentSyncGrid.syncStatus.syncing
-                    }
+                FileProviderSyncStatus {
+                    syncStatus: root.controller.domainSyncStatusForAccount(root.accountUserIdAtHost)
                 }
 
                 GridLayout {
diff --git a/src/gui/macOS/ui/FileProviderSyncStatus.qml b/src/gui/macOS/ui/FileProviderSyncStatus.qml
new file mode 100644 (file)
index 0000000..9a16358
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2024 by Claudio Cambra <claudio.cambra@nextcloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+import QtQuick 2.15
+import QtQuick.Controls 2.15
+import QtQuick.Layouts 1.15
+
+import Style 1.0
+import "../../filedetails"
+import "../../tray"
+
+import com.nextcloud.desktopclient 1.0
+
+GridLayout {
+    id: root
+
+    required property var syncStatus
+
+    EnforcedPlainTextLabel {
+        Layout.row: 0
+        Layout.column: 1
+        Layout.columnSpan: root.syncStatus.syncing ? 2 : 1
+        Layout.fillWidth: true
+        text: root.syncStatus.syncing ? qsTr("Syncing") : qsTr("All synced!")
+    }
+
+    NCBusyIndicator {
+        id: syncIcon
+
+        property int size: Style.trayListItemIconSize * 0.6
+
+        Layout.row: 0
+        Layout.rowSpan: 2
+        Layout.column: 0
+        Layout.preferredWidth: size
+        Layout.preferredHeight: size
+        Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
+
+        imageSource: root.syncStatus.icon
+        running: root.syncStatus.syncing
+    }
+
+    ProgressBar {
+        Layout.row: 1
+        Layout.column: 1
+        Layout.fillWidth: true
+        value: root.syncStatus.fractionCompleted
+        visible: root.syncStatus.syncing
+    }
+}
\ No newline at end of file