Skip to content

Commit

Permalink
Add a general actions grid to the settings qml component to enable us…
Browse files Browse the repository at this point in the history
…ers to manage storage usage

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Oct 11, 2023
1 parent de7df8b commit b196928
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions src/gui/macOS/ui/FileProviderSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,68 @@ Page {
checked: root.controller.vfsEnabledForAccount(root.accountUserIdAtHost)
onClicked: root.controller.setVfsEnabledForAccount(root.accountUserIdAtHost, checked)
}

GridLayout {
id: generalActionsGrid

property real localUsedStorage: root.controller.localStorageUsageGbForAccount(root.accountUserIdAtHost)
property real remoteUsedStorage: root.controller.remoteStorageUsageGbForAccount(root.accountUserIdAtHost)

Layout.fillWidth: true
columns: 3
visible: vfsEnabledCheckBox.checked

Connections {
target: root.controller
function onLocalStorageUsageForAccountChanged(accountUserIdAtHost) {
if (root.accountUserIdAtHost !== accountUserIdAtHost) {
return;
}

generalActionsGrid.localUsedStorage = root.controller.localStorageUsageGbForAccount(root.accountUserIdAtHost);
}

function onRemoteStorageUsageForAccountChanged(accountUserIdAtHost) {
if (root.accountUserIdAtHost !== accountUserIdAtHost) {
return;
}

generalActionsGrid.remoteUsedStorage = root.controller.remoteStorageUsageGbForAccount(root.accountUserIdAtHost);
}
}

EnforcedPlainTextLabel {
Layout.row: 0
Layout.column: 0
Layout.alignment: Layout.AlignLeft | Layout.AlignVCenter
Layout.fillWidth: true
text: qsTr("Local storage use")
font.bold: true
}

EnforcedPlainTextLabel {
Layout.row: 0
Layout.column: 1
Layout.alignment: Layout.AlignRight | Layout.AlignVCenter
text: qsTr("%1 GB of %2 GB remote files synced").arg(generalActionsGrid.localUsedStorage).arg(generalActionsGrid.remoteUsedStorage);
color: Style.ncSecondaryTextColor
horizontalAlignment: Text.AlignRight
}

CustomButton {
Layout.row: 0
Layout.column: 2
Layout.alignment: Layout.AlignRight | Layout.AlignVCenter
text: qsTr("Evict local copies...")
onPressed: root.controller.createEvictionWindowForAccount(root.accountUserIdAtHost)
}

ProgressBar {
Layout.row: 1
Layout.columnSpan: generalActionsGrid.columns
Layout.fillWidth: true
value: generalActionsGrid.localUsedStorage / generalActionsGrid.remoteUsedStorage
}
}
}
}

0 comments on commit b196928

Please sign in to comment.