[vlc-devel] [PATCH 6/7] qml: extend BusyIndicator

Pierre Lamot pierre at videolabs.io
Mon Oct 21 18:08:58 CEST 2019


  * use VLC color scheme
  * allow the indicator to be visible only after the state has been active
    long enough
---
 modules/gui/qt/Makefile.am                    |  1 +
 modules/gui/qt/qml/utils/BusyIndicatorExt.qml | 46 +++++++++++++++++++
 modules/gui/qt/vlc.qrc                        |  1 +
 3 files changed, 48 insertions(+)
 create mode 100644 modules/gui/qt/qml/utils/BusyIndicatorExt.qml

diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index deab19fdb1..670cdc53d7 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -583,6 +583,7 @@ libqt_plugin_la_QML = \
 	gui/qt/qml/dialogs/EditorTabButton.qml \
 	gui/qt/qml/dialogs/ToolbarEditorButtonList.qml \
 	gui/qt/qml/dialogs/ToolbarEditor.qml \
+	gui/qt/qml/utils/BusyIndicatorExt.qml \
 	gui/qt/qml/utils/DNDLabel.qml \
 	gui/qt/qml/utils/ToolTipArea.qml \
 	gui/qt/qml/utils/DrawerExt.qml \
diff --git a/modules/gui/qt/qml/utils/BusyIndicatorExt.qml b/modules/gui/qt/qml/utils/BusyIndicatorExt.qml
new file mode 100644
index 0000000000..1c73f22300
--- /dev/null
+++ b/modules/gui/qt/qml/utils/BusyIndicatorExt.qml
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * Copyright (C) 2019 VLC authors and VideoLAN
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import "qrc:///style/"
+
+BusyIndicator {
+    id: control
+
+    palette.text: VLCStyle.colors.text
+    running: false
+
+    property int delay: 1000 //ms
+    property bool runningDelayed: false
+    onRunningDelayedChanged: {
+        if (runningDelayed) {
+            controlDelay.start()
+        } else {
+            controlDelay.stop()
+            control.running = false
+        }
+    }
+
+    Timer {
+        id: controlDelay
+        interval: control.delay
+        running: false
+        repeat: false
+        onTriggered: control.running = true
+    }
+}
diff --git a/modules/gui/qt/vlc.qrc b/modules/gui/qt/vlc.qrc
index daf12bd2f5..bcf21ae7ed 100644
--- a/modules/gui/qt/vlc.qrc
+++ b/modules/gui/qt/vlc.qrc
@@ -176,6 +176,7 @@
         <file alias="MainInterface.qml">qml/MainInterface.qml</file>
     </qresource>
     <qresource prefix="/utils">
+        <file alias="BusyIndicatorExt.qml">qml/utils/BusyIndicatorExt.qml</file>
         <file alias="MultiCoverPreview.qml">qml/utils/MultiCoverPreview.qml</file>
         <file alias="GridItem.qml">qml/utils/GridItem.qml</file>
         <file alias="ListItem.qml">qml/utils/ListItem.qml</file>
-- 
2.17.1



More information about the vlc-devel mailing list