diff --git a/qml/components/ProgressBar.qml b/qml/components/ProgressBar.qml new file mode 100644 index 0000000000000000000000000000000000000000..5afa85ed2565b2d83b9ec181da8c22b0bc61be24 --- /dev/null +++ b/qml/components/ProgressBar.qml @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2014-2018 CZ.NIC + * + * 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 3 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, see . + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations including + * the two. + */ + +import QtGraphicalEffects 1.0 +import QtQuick 2.7 +import QtQuick.Layouts 1.3 +import QtQuick.Controls 2.1 + +Rectangle { + id: root + visible: false + property int statusBarTimer: 5000 + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.right: parent.right + height: headerHeight + color: datovkaPalette.text + Column { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + anchors.margins: defaultMargin + spacing: formItemVerticalSpacing + Text { + id: statusBarText + color: datovkaPalette.base + anchors.horizontalCenter: parent.horizontalCenter + text: mainWindow.width + " x "+ mainWindow.height + Connections { + target: isds + onStatusBarTextChanged: { + root.visible = isVisible + statusBarText.text = txt + timer.running = !busy + progressBar.visible = busy + } + } + Connections { + target: files + onStatusBarTextChanged: { + root.visible = true + statusBarText.text = txt + timer.running = !busy + progressBar.visible = busy + } + } + Connections { + target: settings + onStatusBarTextChanged: { + root.visible = true + statusBarText.text = txt + timer.running = !busy + progressBar.visible = busy + } + } + } + ProgressBar { + id: progressBar + anchors.horizontalCenter: parent.horizontalCenter + indeterminate: true + } + } + Timer { + id: timer + interval: statusBarTimer + running: false + repeat: false + onTriggered: { + // reset timer and clear status text + timer.running = false + root.visible = false + statusBarText.text = "" + } + } +} diff --git a/qml/main.qml b/qml/main.qml index 9c6c8240ca9f7f08f1e7ed47969063f26d76b5d6..5288222452cebf372f0296a9427c086346a55bcc 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -85,7 +85,6 @@ ApplicationWindow { // header background color property string mainHeaderBgColor: "#00539b" - property int statusBarTimer: 5000 // dimension and style based on font pixel size and screen dpi property int textFontSizeInPixels: defaultTextFont.font.pixelSize property int textPointSmall: Math.round(defaultTextFont.font.pointSize * 0.7) @@ -169,65 +168,8 @@ ApplicationWindow { } } } - Rectangle { + ProgressBar { id: statusBar - visible: false - anchors.left: parent.left - anchors.bottom: parent.bottom - anchors.right: parent.right - height: headerHeight * 0.5 - color: datovkaPalette.alternateBase - BusyIndicator { - id: busyuIndicator - width: parent.height - height: parent.height - anchors.centerIn: parent - running: false - } - Text { - id: statusBarText - color: datovkaPalette.text - anchors.centerIn: parent - text: mainWindow.width + " x "+ mainWindow.height - Connections { - target: isds - onStatusBarTextChanged: { - statusBar.visible = isVisible - statusBarText.text = txt - busyuIndicator.running = busy - timerId.running = !busy - } - } - Connections { - target: files - onStatusBarTextChanged: { - statusBar.visible = true - statusBarText.text = txt - busyuIndicator.running = busy - timerId.running = !busy - } - } - Connections { - target: settings - onStatusBarTextChanged: { - statusBar.visible = true - statusBarText.text = txt - busyuIndicator.running = busy - timerId.running = !busy - } - } - } - Timer { - id: timerId - interval: statusBarTimer; - running: false; - repeat: false - onTriggered: { - timerId.running = false - statusBar.visible = false - statusBarText.text = "" - } - } } } diff --git a/qml/pages/PageAccountList.qml b/qml/pages/PageAccountList.qml index 26c1d423ecb9ae3c50100a111a10e55608dd0197..3c8a0592b983a38073b517f23abc1390ea91a682 100644 --- a/qml/pages/PageAccountList.qml +++ b/qml/pages/PageAccountList.qml @@ -107,7 +107,6 @@ Component { MouseArea { anchors.fill: parent onClicked: { - statusBarText.text = "" isds.doIsdsAction("syncAllAccounts", "") } } diff --git a/res/qml.qrc b/res/qml.qrc index 3bf8b1cf07fc3a747ae619c2e52f6978d4c81059..b3e1512abf0d7f0d01a0754f6ebdc3be30e6b0fd 100644 --- a/res/qml.qrc +++ b/res/qml.qrc @@ -105,6 +105,7 @@ ../qml/components/MessageList.qml ../qml/components/OverlaidImage.qml ../qml/components/PageHeader.qml + ../qml/components/ProgressBar.qml ../qml/components/SpinBoxZeroMax.qml ../qml/dialogues/InputDialogue.qml ../qml/dialogues/FileDialogue.qml diff --git a/src/main.cpp b/src/main.cpp index aadf0fd607fc74ffa09e36013966f85ff9a9fd07..9f0b27b8650c7777378850ea8f0ee6358413c456 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,6 +127,7 @@ const struct QmlTypeEntry qmlComponents[] = { { "MessageList", 1, 0 }, { "OverlaidImage", 1, 0 }, { "PageHeader", 1, 0 }, + { "ProgressBar", 1, 0 }, { "SpinBoxZeroMax", 1, 0 }, { NULL, 0, 0 } };