This commit is contained in:
parent
600027a707
commit
3f107f1ba4
4 changed files with 138 additions and 91 deletions
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.12
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
|
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
|
||||||
import "../js/utils.js" as Utils
|
import "../js/utils.js" as Utils
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,11 +33,9 @@ import "../js/utils.js" as Utils
|
||||||
|
|
||||||
\sa LogarithmPlotter, Settings, ObjectLists
|
\sa LogarithmPlotter, Settings, ObjectLists
|
||||||
*/
|
*/
|
||||||
ScrollView {
|
Item {
|
||||||
id: historyBrowser
|
id: historyBrowser
|
||||||
|
|
||||||
ScrollBar.horizontal.visible: false
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty int HistoryBrowser::actionWidth
|
\qmlproperty int HistoryBrowser::actionWidth
|
||||||
Width of the actions.
|
Width of the actions.
|
||||||
|
@ -49,89 +48,108 @@ ScrollView {
|
||||||
*/
|
*/
|
||||||
property bool darkTheme: isDarkTheme()
|
property bool darkTheme: isDarkTheme()
|
||||||
|
|
||||||
Flickable {
|
Setting.TextSetting {
|
||||||
width: parent.width
|
id: filterInput
|
||||||
height: parent.height
|
anchors.left: parent.left
|
||||||
contentHeight: redoColumn.height + nowRect.height + undoColumn.height
|
anchors.right: parent.right
|
||||||
contentWidth: parent.width
|
anchors.top: parent.top
|
||||||
|
placeholderText: "Filter..."
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
ScrollView {
|
||||||
id: redoColumn
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: parent.top
|
anchors.bottom: parent.bottom
|
||||||
width: actionWidth
|
anchors.top: filterInput.bottom
|
||||||
|
|
||||||
Repeater {
|
ScrollBar.horizontal.visible: false
|
||||||
model: history.redoCount
|
|
||||||
|
|
||||||
HistoryItem {
|
Flickable {
|
||||||
id: redoButton
|
width: parent.width
|
||||||
width: actionWidth
|
height: parent.height
|
||||||
//height: actionHeight
|
contentHeight: redoColumn.height + nowRect.height + undoColumn.height
|
||||||
isRedo: true
|
contentWidth: parent.width
|
||||||
idx: index
|
|
||||||
darkTheme: historyBrowser.darkTheme
|
Column {
|
||||||
|
id: redoColumn
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
width: actionWidth
|
||||||
|
|
||||||
|
Repeater {
|
||||||
|
model: history.redoCount
|
||||||
|
|
||||||
|
HistoryItem {
|
||||||
|
id: redoButton
|
||||||
|
width: actionWidth
|
||||||
|
//height: actionHeight
|
||||||
|
isRedo: true
|
||||||
|
idx: index
|
||||||
|
darkTheme: historyBrowser.darkTheme
|
||||||
|
hidden: !(filterInput.value == "" || content.includes(filterInput.value))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.bottom: nowRect.top
|
|
||||||
text: qsTr("Redo >")
|
|
||||||
color: sysPaletteIn.windowText
|
|
||||||
transform: Rotation { origin.x: 30; origin.y: 30; angle: 270}
|
|
||||||
height: 70
|
|
||||||
width: 20
|
|
||||||
visible: history.redoCount > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
id: nowRect
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.top: redoColumn.bottom
|
|
||||||
width: actionWidth
|
|
||||||
height: 40
|
|
||||||
color: sysPalette.highlight
|
|
||||||
Text {
|
Text {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 5
|
anchors.bottom: nowRect.top
|
||||||
text: qsTr("> Now")
|
text: qsTr("Redo >")
|
||||||
color: sysPalette.windowText
|
color: sysPaletteIn.windowText
|
||||||
|
transform: Rotation { origin.x: 30; origin.y: 30; angle: 270}
|
||||||
|
height: 70
|
||||||
|
width: 20
|
||||||
|
visible: history.redoCount > 0
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
Rectangle {
|
||||||
id: undoColumn
|
id: nowRect
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.top: nowRect.bottom
|
anchors.top: redoColumn.bottom
|
||||||
width: actionWidth
|
width: actionWidth
|
||||||
|
height: 40
|
||||||
Repeater {
|
color: sysPalette.highlight
|
||||||
model: history.undoCount
|
Text {
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.left: parent.left
|
||||||
HistoryItem {
|
anchors.leftMargin: 5
|
||||||
id: undoButton
|
text: qsTr("> Now")
|
||||||
width: actionWidth
|
color: sysPalette.windowText
|
||||||
//height: actionHeight
|
|
||||||
isRedo: false
|
|
||||||
idx: index
|
|
||||||
darkTheme: historyBrowser.darkTheme
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
Column {
|
||||||
anchors.left: parent.left
|
id: undoColumn
|
||||||
anchors.top: undoColumn.top
|
anchors.right: parent.right
|
||||||
text: qsTr("< Undo")
|
anchors.top: nowRect.bottom
|
||||||
color: sysPaletteIn.windowText
|
width: actionWidth
|
||||||
transform: Rotation { origin.x: 30; origin.y: 30; angle: 270}
|
|
||||||
height: 60
|
Repeater {
|
||||||
width: 20
|
model: history.undoCount
|
||||||
visible: history.undoCount > 0
|
|
||||||
|
|
||||||
|
HistoryItem {
|
||||||
|
id: undoButton
|
||||||
|
width: actionWidth
|
||||||
|
//height: actionHeight
|
||||||
|
isRedo: false
|
||||||
|
idx: index
|
||||||
|
darkTheme: historyBrowser.darkTheme
|
||||||
|
hidden: !(filterInput.value == "" || content.includes(filterInput.value))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: undoColumn.top
|
||||||
|
text: qsTr("< Undo")
|
||||||
|
color: sysPaletteIn.windowText
|
||||||
|
transform: Rotation { origin.x: 30; origin.y: 30; angle: 270}
|
||||||
|
height: 60
|
||||||
|
width: 20
|
||||||
|
visible: history.undoCount > 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,10 +49,15 @@ Button {
|
||||||
*/
|
*/
|
||||||
property int idx
|
property int idx
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty int HistoryItem::idx
|
\qmlproperty bool HistoryItem::darkTheme
|
||||||
true when the system is running with a dark theme, false otherwise.
|
true when the system is running with a dark theme, false otherwise.
|
||||||
*/
|
*/
|
||||||
property bool darkTheme
|
property bool darkTheme
|
||||||
|
/*!
|
||||||
|
\qmlproperty bool HistoryItem::hidden
|
||||||
|
true when the item is filtered out, false otherwise.
|
||||||
|
*/
|
||||||
|
property bool hidden: false
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty int HistoryItem::historyAction
|
\qmlproperty int HistoryItem::historyAction
|
||||||
Associated history action.
|
Associated history action.
|
||||||
|
@ -69,12 +74,18 @@ Button {
|
||||||
Color of the history action.
|
Color of the history action.
|
||||||
*/
|
*/
|
||||||
readonly property color clr: historyAction.color(darkTheme)
|
readonly property color clr: historyAction.color(darkTheme)
|
||||||
|
/*!
|
||||||
|
\qmlproperty string HistoryItem::clr
|
||||||
|
Label description of the history item.
|
||||||
|
*/
|
||||||
|
readonly property string content: historyAction.getReadableString()
|
||||||
|
|
||||||
height: Math.max(actionHeight, label.height + 15)
|
height: hidden ? 8 : Math.max(actionHeight, label.height + 15)
|
||||||
|
|
||||||
|
|
||||||
LinearGradient {
|
LinearGradient {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
visible: !hidden
|
||||||
start: Qt.point(0, 0)
|
start: Qt.point(0, 0)
|
||||||
end: Qt.point(parent.width, 0)
|
end: Qt.point(parent.width, 0)
|
||||||
gradient: Gradient {
|
gradient: Gradient {
|
||||||
|
@ -85,11 +96,12 @@ Button {
|
||||||
|
|
||||||
Setting.Icon {
|
Setting.Icon {
|
||||||
id: icon
|
id: icon
|
||||||
width: 18
|
|
||||||
height: 18
|
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 6
|
anchors.leftMargin: 6
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: !hidden
|
||||||
|
width: 18
|
||||||
|
height: 18
|
||||||
|
|
||||||
color: sysPalette.windowText
|
color: sysPalette.windowText
|
||||||
source: `../icons/history/${historyAction.icon()}.svg`
|
source: `../icons/history/${historyAction.icon()}.svg`
|
||||||
|
@ -102,6 +114,7 @@ Button {
|
||||||
anchors.leftMargin: 6
|
anchors.leftMargin: 6
|
||||||
anchors.rightMargin: 20
|
anchors.rightMargin: 20
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: !hidden
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
text: historyAction.getHTMLString().replace(/\$\{tag_color\}/g, clr)
|
text: historyAction.getHTMLString().replace(/\$\{tag_color\}/g, clr)
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
|
@ -109,11 +122,21 @@ Button {
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
}
|
}
|
||||||
|
|
||||||
//text: historyAction.getReadableString()
|
Rectangle {
|
||||||
|
id: hiddenDot
|
||||||
|
anchors.centerIn: parent
|
||||||
|
visible: hidden
|
||||||
|
width: 5
|
||||||
|
height: 5
|
||||||
|
radius: 5
|
||||||
|
color: sysPalette.windowText
|
||||||
|
}
|
||||||
|
|
||||||
|
//text: content
|
||||||
|
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.delay: 200
|
ToolTip.delay: 200
|
||||||
ToolTip.text: historyAction.getReadableString()
|
ToolTip.text: content
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if(isRedo)
|
if(isRedo)
|
||||||
|
|
|
@ -77,7 +77,7 @@ ListView {
|
||||||
Label {
|
Label {
|
||||||
id: typeHeaderText
|
id: typeHeaderText
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
text: Objects.types[objType].displayTypeMultiple() + ":"
|
text: qsTranslate("control", "%1: ").arg(Objects.types[objType].displayTypeMultiple())
|
||||||
font.pixelSize: 20
|
font.pixelSize: 20
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,11 @@ Item {
|
||||||
Value of the input.
|
Value of the input.
|
||||||
*/
|
*/
|
||||||
property alias value: input.text
|
property alias value: input.text
|
||||||
|
/*!
|
||||||
|
\qmlproperty string TextSetting::placeholderText
|
||||||
|
Value of the input.
|
||||||
|
*/
|
||||||
|
property alias placeholderText: input.placeholderText
|
||||||
/*!
|
/*!
|
||||||
\qmlproperty string TextSetting::label
|
\qmlproperty string TextSetting::label
|
||||||
Label of the setting.
|
Label of the setting.
|
||||||
|
@ -92,7 +97,8 @@ Item {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
//color: sysPalette.windowText
|
//color: sysPalette.windowText
|
||||||
text: qsTranslate("control", "%1: ").arg(control.label)
|
text: visible ? qsTranslate("control", "%1: ").arg(control.label) : ""
|
||||||
|
visible: control.label != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,10 +107,10 @@ Item {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: labelItem.right
|
anchors.left: labelItem.right
|
||||||
anchors.leftMargin: 5
|
anchors.leftMargin: 5
|
||||||
width: control.width - labelItem.width - iconLabel.width - 10
|
width: control.width - (labelItem.visible ? labelItem.width + 5 : 0) - iconLabel.width - 5
|
||||||
height: parent.height
|
height: parent.height
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
horizontalAlignment: TextInput.AlignHCenter
|
horizontalAlignment: control.label == "" ? TextInput.AlignLeft : TextInput.AlignHCenter
|
||||||
color: sysPalette.windowText
|
color: sysPalette.windowText
|
||||||
focus: true
|
focus: true
|
||||||
text: control.defValue
|
text: control.defValue
|
||||||
|
|
Loading…
Reference in a new issue