91 lines
2.4 KiB
QML
91 lines
2.4 KiB
QML
|
|
import QtQuick
|
||
|
|
import QtQuick.Controls 2.15
|
||
|
|
|
||
|
|
// Плашка хода долгой операции в левом нижнем углу: не задевает кнопку запуска,
|
||
|
|
// сообщение по центру и кнопки папки с настройками.
|
||
|
|
Rectangle {
|
||
|
|
id: panel
|
||
|
|
|
||
|
|
property string title: ""
|
||
|
|
property string status: ""
|
||
|
|
// -1 — итог ещё неизвестен, показываем «…» вместо процентов.
|
||
|
|
property double fraction: -1
|
||
|
|
// Необязательная вторая строка: мегабайты у загрузки, путь у архивации.
|
||
|
|
property string detail: ""
|
||
|
|
property bool cancellable: true
|
||
|
|
|
||
|
|
signal cancelRequested()
|
||
|
|
|
||
|
|
width: 320
|
||
|
|
height: 72
|
||
|
|
radius: 8
|
||
|
|
color: "#1e1e1e"
|
||
|
|
opacity: 0.94
|
||
|
|
border.color: "#91B315"
|
||
|
|
border.width: 1
|
||
|
|
|
||
|
|
Text {
|
||
|
|
x: 12; y: 8
|
||
|
|
width: parent.width - 70
|
||
|
|
elide: Text.ElideRight
|
||
|
|
color: "#ffffff"
|
||
|
|
font.pixelSize: 12
|
||
|
|
font.bold: true
|
||
|
|
text: panel.title
|
||
|
|
}
|
||
|
|
|
||
|
|
Text {
|
||
|
|
anchors.right: parent.right
|
||
|
|
anchors.rightMargin: 12
|
||
|
|
y: 8
|
||
|
|
color: "#91B315"
|
||
|
|
font.pixelSize: 12
|
||
|
|
text: panel.fraction < 0 ? "…" : Math.round(panel.fraction * 100) + "%"
|
||
|
|
}
|
||
|
|
|
||
|
|
Rectangle {
|
||
|
|
id: track
|
||
|
|
x: 12; y: 30
|
||
|
|
width: parent.width - 24
|
||
|
|
height: 6
|
||
|
|
radius: 3
|
||
|
|
color: "#2a2a2a"
|
||
|
|
|
||
|
|
Rectangle {
|
||
|
|
width: panel.fraction > 0 ? track.width * panel.fraction : 0
|
||
|
|
height: parent.height
|
||
|
|
radius: 3
|
||
|
|
color: "#91B315"
|
||
|
|
Behavior on width { NumberAnimation { duration: 120 } }
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Text {
|
||
|
|
x: 12; y: 44
|
||
|
|
width: parent.width - 40
|
||
|
|
elide: Text.ElideMiddle
|
||
|
|
color: "#888888"
|
||
|
|
font.pixelSize: 10
|
||
|
|
text: panel.detail !== "" ? panel.detail : panel.status
|
||
|
|
}
|
||
|
|
|
||
|
|
Text {
|
||
|
|
anchors.right: parent.right
|
||
|
|
anchors.bottom: parent.bottom
|
||
|
|
anchors.rightMargin: 10
|
||
|
|
anchors.bottomMargin: 6
|
||
|
|
visible: panel.cancellable
|
||
|
|
text: "✕"
|
||
|
|
color: cancelArea.containsMouse ? "#cc6666" : "#666666"
|
||
|
|
font.pixelSize: 12
|
||
|
|
|
||
|
|
MouseArea {
|
||
|
|
id: cancelArea
|
||
|
|
anchors.fill: parent
|
||
|
|
anchors.margins: -6
|
||
|
|
hoverEnabled: true
|
||
|
|
onClicked: panel.cancelRequested()
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|