Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion qml/app/GlobalWidgets.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,15 @@ Item {
id: modelDownloadTimerWidget
z: 9999
anchors.bottom: parent.bottom
anchors.bottomMargin: (Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0) + units.gu(1)
anchors.bottomMargin: ((Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0) + units.gu(1)) + (globalTimerWidget.visible ? (globalTimerWidget.height + units.gu(1)) : 0)
visible: false
showNotification: function (title, message, type) {
notifPopup.open(title, message, type);
}

Behavior on anchors.bottomMargin {
NumberAnimation { duration: 200; easing.type: Easing.OutQuad }
}
}

BackendBridge {
Expand Down
39 changes: 24 additions & 15 deletions qml/components/system/GlobalTimerWidget.qml
Comment thread
AnmollGarg marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ Rectangle {
property bool syncFailed: false
property string syncStatusMessage: ""

// Customization properties for derived widgets
property string syncTitlePrefix: i18n.dtr("ubtms", "Syncing ")
property string defaultSyncTitle: i18n.dtr("ubtms", "Cloud Sync")
property string defaultSyncingSubtitle: i18n.dtr("ubtms", "Synchronizing...")
property string syncSuccessSubtitle: i18n.dtr("ubtms", "All items up to date")
property string defaultSyncFailedText: i18n.dtr("ubtms", "Sync failed")
property string syncIconSource: "../../images/refresh.svg"
property bool rotateIcon: true

// BackendBridge for real-time sync communication (connect to global bridge)
property var backendBridge: null

Expand Down Expand Up @@ -97,10 +106,10 @@ Rectangle {
if (data.payload === true)
completeSyncSuccessfully();
else
failSync("Sync Failed ");
failSync(defaultSyncFailedText);
break;
case "sync_error":
failSync("Failed " + data.payload);
failSync(data.payload ? (defaultSyncFailedText + ": " + data.payload) : defaultSyncFailedText);
break;
}
}
Expand All @@ -113,15 +122,15 @@ Rectangle {
var progressPercent = Math.round(syncProgress * 100);

if (progressPercent < 25) {
syncStatusMessage = "Initializing sync...";
syncStatusMessage = i18n.dtr("ubtms", "Initializing sync...");
} else if (progressPercent < 50) {
syncStatusMessage = "Downloading from server...";
syncStatusMessage = i18n.dtr("ubtms", "Downloading from server...");
} else if (progressPercent < 90) {
syncStatusMessage = "Uploading to server...";
syncStatusMessage = i18n.dtr("ubtms", "Uploading to server...");
} else if (progressPercent < 100) {
syncStatusMessage = "Finalizing sync...";
syncStatusMessage = i18n.dtr("ubtms", "Finalizing sync...");
} else {
syncStatusMessage = "Sync complete!";
syncStatusMessage = syncSuccessSubtitle;
}
}

Expand All @@ -130,7 +139,7 @@ Rectangle {
syncSuccessful = true;
syncFailed = false;
syncProgress = 1.0;
syncStatusMessage = "Sync Complete!";
syncStatusMessage = syncSuccessSubtitle;

// Auto-hide after 3 seconds
autoHideTimer.interval = 3000;
Expand All @@ -141,7 +150,7 @@ Rectangle {
function failSync(errorMessage) {
syncSuccessful = false;
syncFailed = true;
syncStatusMessage = errorMessage || "Sync Failed";
syncStatusMessage = errorMessage || defaultSyncFailedText;

// Auto-hide after 5 seconds
autoHideTimer.interval = 5000;
Expand Down Expand Up @@ -282,12 +291,12 @@ Rectangle {
id: syncIcon
visible: globalTimer.isSyncing && !globalTimer.isTimerRunning && !globalTimer.syncSuccessful && !globalTimer.syncFailed
anchors.fill: parent
source: "../../images/refresh.svg"
source: globalTimer.syncIconSource
fillMode: Image.PreserveAspectFit

RotationAnimation on rotation {
loops: Animation.Infinite
running: globalTimer.visible && globalTimer.isSyncing && !globalTimer.isTimerRunning && !globalTimer.syncSuccessful && !globalTimer.syncFailed
running: globalTimer.rotateIcon && globalTimer.visible && globalTimer.isSyncing && !globalTimer.isTimerRunning && !globalTimer.syncSuccessful && !globalTimer.syncFailed
from: 0
to: 360
duration: 1200
Expand Down Expand Up @@ -335,7 +344,7 @@ Rectangle {
if (globalTimer.isTimerRunning) {
return globalTimer.activeTitle;
} else if (globalTimer.isSyncing) {
return globalTimer.syncAccountName ? ("Syncing " + globalTimer.syncAccountName) : "Cloud Sync";
return globalTimer.syncAccountName ? (globalTimer.syncTitlePrefix + globalTimer.syncAccountName) : globalTimer.defaultSyncTitle;
}
return "";
}
Expand Down Expand Up @@ -381,9 +390,9 @@ Rectangle {
visible: globalTimer.isSyncing && !globalTimer.isTimerRunning
width: parent.width
text: {
if (globalTimer.syncFailed) return globalTimer.syncStatusMessage || "Sync failed";
if (globalTimer.syncSuccessful) return "All items up to date";
return globalTimer.syncStatusMessage || "Synchronizing...";
if (globalTimer.syncFailed) return globalTimer.syncStatusMessage || globalTimer.defaultSyncFailedText;
if (globalTimer.syncSuccessful) return globalTimer.syncSuccessSubtitle;
return globalTimer.syncStatusMessage || globalTimer.defaultSyncingSubtitle;
}
color: globalTimer.syncFailed ? "#DF382C" : (globalTimer.syncSuccessful ? "#38B44A" : "#D0CBC5")
font.pixelSize: units.gu(1.3)
Expand Down
11 changes: 10 additions & 1 deletion qml/components/system/ModelDownloadTimerWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ import Lomiri.Components 1.3
GlobalTimerWidget {
id: downloadWidget
enableTimesheetTimer: false

function handleSyncEvent(data) {
}
syncTitlePrefix: i18n.dtr("ubtms", "Downloading ")
defaultSyncTitle: i18n.dtr("ubtms", "Voice Model Download")
defaultSyncingSubtitle: i18n.dtr("ubtms", "Downloading...")
syncSuccessSubtitle: i18n.dtr("ubtms", "Installation complete!")
defaultSyncFailedText: i18n.dtr("ubtms", "Download failed")
syncIconSource: "../../images/downloadWhite.svg"
rotateIcon: false

// Override completion logic to connect to our specific download events
Component.onCompleted: {
var root = downloadWidget;
Expand Down
5 changes: 5 additions & 0 deletions qml/images/downloadWhite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading