More composenting of history

This commit is contained in:
Adsooi 2022-01-30 01:22:33 +01:00
parent 22328c6227
commit b852eed489
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
4 changed files with 18 additions and 31 deletions

View file

@ -18,12 +18,12 @@
import QtQuick 2.12
import QtQml 2.12
import "js/objects.js" as Objects
import "js/historylib.js" as HistoryLib
import "../js/objects.js" as Objects
import "../js/historylib.js" as HistoryLib
/*!
\qmltype History
\inqmlmodule eu.ad5001.LogarithmPlotter
\inqmlmodule eu.ad5001.LogarithmPlotter.History
\brief QObject holding persistantly for undo & redo stacks.
\sa HistoryBrowser, historylib

View file

@ -18,12 +18,12 @@
import QtQuick.Controls 2.12
import QtQuick 2.12
import "js/utils.js" as Utils
import "../js/utils.js" as Utils
/*!
\qmltype HistoryBrowser
\inqmlmodule eu.ad5001.LogarithmPlotter
\inqmlmodule eu.ad5001.LogarithmPlotter.History
\brief Tab of the drawer that allows to navigate through the undo and redo history.
Creates a scrollable view containing a list of history actions based on the redo stack, then a "Now" indicator
@ -57,24 +57,17 @@ ScrollView {
id: redoColumn
anchors.right: parent.right
anchors.top: parent.top
width: historyBrowser.actionWidth
width: actionWidth
Repeater {
model: history.redoCount
Button {
HistoryItem {
id: redoButton
width: historyBrowser.actionWidth
width: actionWidth
height: actionHeight
flat: true
text: history.redoStack[index].getReadableString()
ToolTip.visible: hovered
ToolTip.text: text
onClicked: {
history.redoMultipleDefered(history.redoCount-index)
}
isRedo: true
idx: index
}
}
}
@ -94,7 +87,7 @@ ScrollView {
id: nowRect
anchors.right: parent.right
anchors.top: redoColumn.bottom
width: historyBrowser.actionWidth
width: actionWidth
height: actionHeight
color: sysPalette.highlight
Text {
@ -110,24 +103,18 @@ ScrollView {
id: undoColumn
anchors.right: parent.right
anchors.top: nowRect.bottom
width: historyBrowser.actionWidth
width: actionWidth
Repeater {
model: history.undoCount
Button {
HistoryItem {
id: undoButton
width: historyBrowser.actionWidth
width: actionWidth
height: actionHeight
flat: true
text: history.undoStack[history.undoCount-index-1].getReadableString()
ToolTip.visible: hovered
ToolTip.text: text
onClicked: {
history.undoMultipleDefered(index+1)
}
isRedo: false
idx: index
}
}
}

View file

@ -25,6 +25,7 @@ import QtQuick 2.12
import "js/objs/autoload.js" as ALObjects
import "js/objects.js" as Objects
import eu.ad5001.LogarithmPlotter.History 1.0
import eu.ad5001.LogarithmPlotter.ObjectLists 1.0
import eu.ad5001.LogarithmPlotter.Popup 1.0 as Popup

View file

@ -1,5 +1,4 @@
module eu.ad5001.LogarithmPlotter
Icon 1.0 Icon.qml
Settings 1.0 Settings.qml
Alert 1.0 Alert.qml