Skip to content

Integrate QFieldCloud subscription API for storage meter#7260

Open
mohsenD98 wants to merge 7 commits intomasterfrom
storage-meter-integration
Open

Integrate QFieldCloud subscription API for storage meter#7260
mohsenD98 wants to merge 7 commits intomasterfrom
storage-meter-integration

Conversation

@mohsenD98
Copy link
Copy Markdown
Collaborator

🚀 Description

Connect the storage meter bar to the real QFieldCloud subscription API.

Continue #7251

✨ Key Changes

  • QFieldCloudConnection (C++): Added Q_INVOKABLE getSubscriptionInfo(user) method that calls the subscription API endpoint and emits subscriptionInfoReceived(storageUsed, storageTotal) with the parsed byte values
  • QFieldCloudPopup.qml: Call the getSubscriptionInfo() on login, using the current project owner or logged-in username

Demo

image

@mohsenD98 mohsenD98 self-assigned this Apr 3, 2026
@qfield-fairy
Copy link
Copy Markdown
Collaborator

qfield-fairy commented Apr 3, 2026

🍎 MacOS DMG universal builds

Download a MacOS DMG universal build of this PR for testing.
(Built from commit b802d44)

📱 Android builds

Download an Android arm64 build of this PR for testing.
(Built from commit b802d44)

Other Android architectures

🪟 Windows builds

Download a Windows build of this PR for testing.
(Built from commit b802d44)

🐧 Linux AppImage builds

Download a Linux AppImage build of this PR for testing.
(Built from commit f10fc27)

@mohsenD98 mohsenD98 force-pushed the storage-meter-integration branch from 0fc5e07 to cfb62ad Compare April 5, 2026 13:44
@nirvn
Copy link
Copy Markdown
Member

nirvn commented Apr 6, 2026

There's a little bit more work needed before we merge this, talked to @mohsenD98 , progress is being made :)

Comment on lines +134 to +135
connectionSettings.visible = !connectionSettings.visible;
storageMeterBar.visible = !connectionSettings.visible;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the storage meter is not visible, the avatar's alignment is wrong:

Image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same when looking at a cloud project where we do not (yet) have the ability to get storage info:

Image

Comment on lines +738 to +741
if (subscriptionInformation.storageTotal > 0) {
const usedGB = (subscriptionInformation.storageUsed / (1024 * 1024 * 1024)).toFixed(2);
const totalGB = (subscriptionInformation.storageTotal / (1024 * 1024 * 1024)).toFixed(2);
showStorageBar(usedGB, totalGB);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We calculate kb/mb/gb using a conversion factor of 1000, not 1024. Proof:

Image

We need to make sure these values align, otherwise we'll get confused users :)

Also, let's have a slightly cleverer calculation here that allows us to show eg 100mb instead of 0.1gb. Basically, if used storage of total storage < 1gb, lets use mb.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's intended behavior, see GB vs GiB https://en.wikipedia.org/wiki/Byte#Multiple-byte_units

@mohsenD98 mohsenD98 force-pushed the storage-meter-integration branch from 8a3274d to b802d44 Compare April 7, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants