diff --git a/Device.qml b/Device.qml index 612037e3e6360c5a7f0b5ebd6f5c7d7442176abd..15582559d85b9c432b7fc374d815600cc8034cd0 100644 --- a/Device.qml +++ b/Device.qml @@ -4,7 +4,9 @@ import QtQuick.Window 2.0 Item { id: dapDevice - property string device: dp() +// property string device: dp() + //TODO: Temporary editing + property string device: "desktop" property int dpi: Screen.pixelDensity * 25.4 function dp(){ diff --git a/libdap-qt-ui-qml.qrc b/libdap-qt-ui-qml.qrc index 5a536778bcc749dd404b2dd70ba2cd0fb2167de7..3cb2929606497965356e2b7843886fc4e8aaa581 100644 --- a/libdap-qt-ui-qml.qrc +++ b/libdap-qt-ui-qml.qrc @@ -28,5 +28,7 @@ <file>widgets/DapMessageBox.qml</file> <file>widgets/DapMessageBoxForm.ui.qml</file> <file>DapFont.qml</file> + <file>widgets/DapBusyIndicator.qml</file> + <file>widgets/DapBusyIndicatorForm.ui.qml</file> </qresource> </RCC> diff --git a/widgets/DapBusyIndicator.qml b/widgets/DapBusyIndicator.qml new file mode 100644 index 0000000000000000000000000000000000000000..ce2c27b8cb5828e0ce26c303d457dd78c958e4c9 --- /dev/null +++ b/widgets/DapBusyIndicator.qml @@ -0,0 +1,130 @@ +import QtQuick 2.2 +import QtQuick.Controls 2.0 + +DapBusyIndicatorForm +{ + + contentItem: + Item + { + id: busyItem + width: busyIndicatorWidth + height: busyIndicatorHeight + + //To set number of indicator point + Repeater + { + id: busyRepeater + model: busyPointNum + + Rectangle + { + x: busyItem.width / 2 - width / 2 + y: busyItem.height / 2 - height / 2 + width: busyPointWidth + height: busyPointHeight + radius: busyPointRounding + opacity: 1 + //Add possibility of color animation + Behavior on color + { + ColorAnimation + { + from: busyIndicatorDarkColor + duration: busyIndicatorDelay * busyPointNum + } + } + //Add possibility of scale animation + Behavior on scale + { + ScaleAnimator + { + from: busyPointMaxScale + duration: busyIndicatorDelay * busyPointNum + } + } + //Set next indicator point as transformation of previous + transform: + Rotation + { + origin.x: busyItem.width / 2 - width + origin.y: busyItem.height / 2 - height + angle: index * (360 / busyPointNum) + } + //Timer of every point transformation + Timer + { + id: reset + interval: busyIndicatorDelay * (index) + onTriggered: + { + console.log("reset triggered, index: ", index) + parent.opacity = 1 + parent.color = busyIndicatorDarkColor + parent.scale = busyPointMaxScale + reset2.start() + } + onRunningChanged: + { + if(running) console.log("reset start, index: ", index) + else console.log("reset stop, index: ", index) + } + } + //Timer of point transformation at one position + Timer + { + id: reset2 + interval: busyIndicatorDelay + onTriggered: + { + console.log("reset2 triggered, index: ", index) + parent.opacity = 1 + parent.color = busyIndicatorLightColor + parent.scale = busyPointMinScale + } + onRunningChanged: + { + if(running) console.log("reset2 start, index: ", index) + else console.log("reset2 stop, index: ", index) + } + } + //Timer of all busy indicator transformation + Timer + { + id: globalTimer + interval: busyIndicatorDelay * busyPointNum + onTriggered: + { + console.log("globalTimer triggered, index: ", index) + reset.start() + } + triggeredOnStart: true + repeat: true + } + Component.onCompleted: + { + globalTimer.start() + } + onVisibleChanged: + { + if(!visible) + { + globalTimer.stop(); + reset.stop(); + reset2.stop(); + + } + } + } + } + } + onRunningChanged: + { + if(running) + { + console.log("running all") + } + else console.log("stop all") + } + +} diff --git a/widgets/DapBusyIndicatorForm.ui.qml b/widgets/DapBusyIndicatorForm.ui.qml new file mode 100644 index 0000000000000000000000000000000000000000..6eec7a400a414f39f5d299886f1bfe2cc23a67b5 --- /dev/null +++ b/widgets/DapBusyIndicatorForm.ui.qml @@ -0,0 +1,37 @@ +import QtQuick 2.2 +import QtQuick.Controls 2.0 + +BusyIndicator +{ + ///@detalis dapBusy Identificator of dap busy indicator + property alias dapBusy: control + ///@detalis busyPointNum Number of rectangle points at busy indicator + property int busyPointNum + ///@detalis busyPointRounding Rounding of rectangle points at busy indicator + property int busyPointRounding + ///@detalis busyPointWidth Width of rectangle points at busy indicator + property int busyPointWidth + ///@detalis busyPointHeight Height of rectangle points at busy indicator + property int busyPointHeight + ///@detalis busyPointMinScale Minimum scale of point + property real busyPointMinScale + ///@detalis busyPointMaxScale Maximum scale of point + property real busyPointMaxScale + ///@detalis busyIndicatorWidth Width of rectangle busy indicator + property int busyIndicatorWidth + ///@detalis busyIndicatorHeight Height of rectangle busy indicator + property int busyIndicatorHeight + ///@detalis busyIndicatorDelay Delay between busy indicator states + property int busyIndicatorDelay + ///@detalis busyIndicatorDarkColor Color of lightest point of busy indicator + property string busyIndicatorDarkColor + ///@detalis busyIndicatorLightColor Color of darkest point of busy indicator + property string busyIndicatorLightColor + + + + id: control + visible: running + +} + diff --git a/widgets/DapComboBox.qml b/widgets/DapComboBox.qml index 67452ec29943fa42854b22b5cf7dce00b77fee78..b147f400a5c67dfd6940a631767ffee6ec42349f 100644 --- a/widgets/DapComboBox.qml +++ b/widgets/DapComboBox.qml @@ -3,6 +3,18 @@ import QtQuick.Controls 2.0 DapComboBoxForm { + Component.onCompleted: + { + if(isDefaultNeedToAppend && model.get(0, comboBoxTextRole[0]) !== mainLineText) + { + if(comboBoxTextRole[0] === "name") + model.insert(0, {name: mainLineText}); + else if(comboBoxTextRole[0] === "text") + model.insert(0, {text: mainLineText}); + currentIndex = 0; + } + } + delegate: ItemDelegate { diff --git a/widgets/DapComboBoxForm.ui.qml b/widgets/DapComboBoxForm.ui.qml index 80ca3731f79ef23ab51076fd61f4c3a64ae8eba7..7e52207bf02172a001d03753c22d95f2a174bd2f 100644 --- a/widgets/DapComboBoxForm.ui.qml +++ b/widgets/DapComboBoxForm.ui.qml @@ -84,6 +84,8 @@ ComboBox property var mainRow: [""] //@detalis mainLineText Text without unneccesary part. property string mainLineText + ///@details isDefaultNeedToAppend Sign to add default data to the beginning of model + property bool isDefaultNeedToAppend: false width: popup.visible ? widthPopupComboBoxActive : widthPopupComboBoxNormal height: popup.visible ? heightComboBoxActive : heightComboBoxNormal @@ -133,8 +135,9 @@ ComboBox Text { anchors.verticalCenter: parent.verticalCenter + text: (popup.visible) ? - (index < mainRow.length ? mainRow[index] : ""): + (dapComboBox.currentIndex === -1 ? mainLineText : (index < mainRow.length ? mainRow[index] : "") ) : mainLineText font: popup.visible ? ((fontComboBox.length > index) ?