diff --git a/resources.qrc b/resources.qrc
index fdd4bcf570e63..f170f119d77bb 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -49,6 +49,7 @@
src/gui/tray/EditFileLocallyLoadingDialog.qml
src/gui/tray/NCBusyIndicator.qml
src/gui/tray/NCToolTip.qml
+ src/gui/tray/NCProgressBar.qml
src/gui/tray/EnforcedPlainTextLabel.qml
theme/Style/Style.qml
theme/Style/qmldir
diff --git a/src/gui/tray/NCProgressBar.qml b/src/gui/tray/NCProgressBar.qml
new file mode 100644
index 0000000000000..920d19ad26f9b
--- /dev/null
+++ b/src/gui/tray/NCProgressBar.qml
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2021 by Oleksandr Zolotov
+ *
+ * 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 Style 1.0
+
+ProgressBar {
+ id: control
+
+ background: Rectangle {
+ implicitWidth: Style.progressBarWidth
+ implicitHeight: Style.progressBarBackgroundHeight
+ radius: Style.progressBarRadius
+ color: Style.progressBarBackgroundColor
+ border.color: Style.progressBarBackgroundBorderColor
+ border.width: Style.progressBarBackgroundBorderWidth
+ }
+
+ contentItem: Item {
+ implicitWidth: Style.progressBarWidth
+ implicitHeight: Style.progressBarContentHeight
+
+ Rectangle {
+ width: control.visualPosition * parent.width
+ height: parent.height
+ radius: Style.progressBarRadius
+ color: Style.progressBarContentColor
+ border.color: Style.progressBarContentBorderColor
+ border.width: Style.progressBarContentBorderWidth
+ }
+ }
+}
diff --git a/src/gui/tray/SyncStatus.qml b/src/gui/tray/SyncStatus.qml
index d593ad97d171a..bbec0e4eac0d9 100644
--- a/src/gui/tray/SyncStatus.qml
+++ b/src/gui/tray/SyncStatus.qml
@@ -66,32 +66,8 @@ RowLayout {
active: syncStatus.syncing && syncStatus.totalFiles > 0
visible: active
- sourceComponent: ProgressBar {
+ sourceComponent: NCProgressBar {
id: syncProgressBar
-
- // TODO: Rather than setting all these palette colours manually,
- // create a custom style and do it for all components globally.
- //
- // Additionally, we need to override the entire palette when we
- // set one palette property, as otherwise we default back to the
- // theme palette -- not the parent palette
- palette {
- text: Style.ncTextColor
- windowText: Style.ncTextColor
- buttonText: Style.ncTextColor
- brightText: Style.ncTextBrightColor
- highlight: Style.lightHover
- highlightedText: Style.ncTextColor
- light: Style.lightHover
- midlight: Style.ncSecondaryTextColor
- mid: Style.darkerHover
- dark: Style.menuBorder
- button: Style.buttonBackgroundColor
- window: palette.dark // NOTE: Fusion theme uses darker window colour for the border of the progress bar
- base: Style.backgroundColor
- toolTipBase: Style.backgroundColor
- toolTipText: Style.ncTextColor
- }
value: syncStatus.syncProgress
}
}
diff --git a/theme/Style/Style.qml b/theme/Style/Style.qml
index 548ec3864c7eb..44ad1a6fb012f 100644
--- a/theme/Style/Style.qml
+++ b/theme/Style/Style.qml
@@ -159,7 +159,18 @@ QtObject {
readonly property int veryLongAnimationDuration: 3000
// sync status
- property int progressBarPreferredHeight: 10
+ property int progressBarPreferredHeight: 9
+
+ property int progressBarWidth: 100
+ property int progressBarBackgroundHeight: 8
+ property int progressBarContentHeight: 8
+ property int progressBarRadius: 4
+ property int progressBarContentBorderWidth: 1
+ property int progressBarBackgroundBorderWidth: 1
+ property color progressBarContentColor: buttonBackgroundColor
+ property color progressBarContentBorderColor: menuBorder
+ property color progressBarBackgroundColor: backgroundColor
+ property color progressBarBackgroundBorderColor: menuBorder
function variableSize(size) {
return size * (1 + Math.min(pixelSize / 100, 1));