From b852eed48931fcdcfece25fd1f0afa641db13e13 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Sun, 30 Jan 2022 01:22:33 +0100 Subject: [PATCH] More composenting of history --- .../{ => History}/History.qml | 6 +-- .../{ => History}/HistoryBrowser.qml | 41 +++++++------------ .../LogarithmPlotter/LogarithmPlotter.qml | 1 + .../qml/eu/ad5001/LogarithmPlotter/qmldir | 1 - 4 files changed, 18 insertions(+), 31 deletions(-) rename LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/{ => History}/History.qml (97%) rename LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/{ => History}/HistoryBrowser.qml (76%) diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/History.qml similarity index 97% rename from LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml rename to LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/History.qml index 2584385..47c4fbe 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/History.qml @@ -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 diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/HistoryBrowser.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/HistoryBrowser.qml similarity index 76% rename from LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/HistoryBrowser.qml rename to LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/HistoryBrowser.qml index 9ce3098..45275cd 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/HistoryBrowser.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/History/HistoryBrowser.qml @@ -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 } } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml index 9b5a09f..c030d8d 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml @@ -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 diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/qmldir b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/qmldir index 7751252..ac68e47 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/qmldir +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/qmldir @@ -1,5 +1,4 @@ module eu.ad5001.LogarithmPlotter -Icon 1.0 Icon.qml Settings 1.0 Settings.qml Alert 1.0 Alert.qml