From 54e235468f58a61387e333b859661a517015ae90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Sun, 8 Dec 2024 02:32:56 +0100 Subject: [PATCH] Timeline: restore UI state --- src/app/GUI/timelinewidget.cpp | 20 ++++++++++++++++++++ src/app/GUI/timelinewidget.h | 4 ++++ 2 files changed, 24 insertions(+) diff --git a/src/app/GUI/timelinewidget.cpp b/src/app/GUI/timelinewidget.cpp index 626e47099..63ff004fe 100644 --- a/src/app/GUI/timelinewidget.cpp +++ b/src/app/GUI/timelinewidget.cpp @@ -295,6 +295,13 @@ TimelineWidget::TimelineWidget(Document &document, connect(chww, &ChangeWidthWidget::widthSet, this, &TimelineWidget::setBoxesListWidth); setBoxesListWidth(chww->getCurrentWidth()); + + readSettings(); +} + +TimelineWidget::~TimelineWidget() +{ + writeSettings(); } void TimelineWidget::setCurrentScene(Canvas * const scene) { @@ -498,6 +505,19 @@ void TimelineWidget::writeStateXEV(QDomElement& ele, QDomDocument& doc, ele.setAttribute("search", mSearchLine->text()); } +void TimelineWidget::readSettings() +{ + const auto tWidth = AppSupport::getSettings("ui", + "TimeLineMenuWidth"); + if (tWidth.isValid()) { setBoxesListWidth(tWidth.toInt()); } +} + +void TimelineWidget::writeSettings() +{ + AppSupport::setSettings("ui", "TimeLineMenuWidth", + mBoxesListScrollArea->width()); +} + void TimelineWidget::moveSlider(int val) { int diff = val%eSizesUI::widget; if(diff != 0) { diff --git a/src/app/GUI/timelinewidget.h b/src/app/GUI/timelinewidget.h index 888b38ab2..194a734a9 100644 --- a/src/app/GUI/timelinewidget.h +++ b/src/app/GUI/timelinewidget.h @@ -64,6 +64,7 @@ class TimelineWidget : public QWidget { QWidget * const menu, QWidget *parent); + ~TimelineWidget(); Canvas* getCurrrentScene() const { return mCurrentScene; } @@ -80,6 +81,9 @@ class TimelineWidget : public QWidget { RuntimeIdToWriteId& objListIdConv); void writeStateXEV(QDomElement& ele, QDomDocument& doc, RuntimeIdToWriteId& objListIdConv) const; + void readSettings(); + void writeSettings(); + private: void setViewedFrameRange(const FrameRange &range); void setCanvasFrameRange(const FrameRange &range);