More composenting of history

This commit is contained in:
Ad5001 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 QtQuick 2.12
import QtQml 2.12 import QtQml 2.12
import "js/objects.js" as Objects import "../js/objects.js" as Objects
import "js/historylib.js" as HistoryLib import "../js/historylib.js" as HistoryLib
/*! /*!
\qmltype History \qmltype History
\inqmlmodule eu.ad5001.LogarithmPlotter \inqmlmodule eu.ad5001.LogarithmPlotter.History
\brief QObject holding persistantly for undo & redo stacks. \brief QObject holding persistantly for undo & redo stacks.
\sa HistoryBrowser, historylib \sa HistoryBrowser, historylib

View file

@ -18,12 +18,12 @@
import QtQuick.Controls 2.12 import QtQuick.Controls 2.12
import QtQuick 2.12 import QtQuick 2.12
import "js/utils.js" as Utils import "../js/utils.js" as Utils
/*! /*!
\qmltype HistoryBrowser \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. \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 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 id: redoColumn
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
width: historyBrowser.actionWidth width: actionWidth
Repeater { Repeater {
model: history.redoCount model: history.redoCount
Button { HistoryItem {
id: redoButton id: redoButton
width: historyBrowser.actionWidth width: actionWidth
height: actionHeight height: actionHeight
flat: true isRedo: true
text: history.redoStack[index].getReadableString() idx: index
ToolTip.visible: hovered
ToolTip.text: text
onClicked: {
history.redoMultipleDefered(history.redoCount-index)
}
} }
} }
} }
@ -94,7 +87,7 @@ ScrollView {
id: nowRect id: nowRect
anchors.right: parent.right anchors.right: parent.right
anchors.top: redoColumn.bottom anchors.top: redoColumn.bottom
width: historyBrowser.actionWidth width: actionWidth
height: actionHeight height: actionHeight
color: sysPalette.highlight color: sysPalette.highlight
Text { Text {
@ -110,24 +103,18 @@ ScrollView {
id: undoColumn id: undoColumn
anchors.right: parent.right anchors.right: parent.right
anchors.top: nowRect.bottom anchors.top: nowRect.bottom
width: historyBrowser.actionWidth width: actionWidth
Repeater { Repeater {
model: history.undoCount model: history.undoCount
Button {
HistoryItem {
id: undoButton id: undoButton
width: historyBrowser.actionWidth width: actionWidth
height: actionHeight height: actionHeight
flat: true isRedo: false
text: history.undoStack[history.undoCount-index-1].getReadableString() idx: index
ToolTip.visible: hovered
ToolTip.text: text
onClicked: {
history.undoMultipleDefered(index+1)
}
} }
} }
} }

View file

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

View file

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