Skip to content

Commit

Permalink
Timeline: restore UI state
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Dec 8, 2024
1 parent f20ff00 commit 54e2354
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/app/GUI/timelinewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions src/app/GUI/timelinewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class TimelineWidget : public QWidget {
QWidget * const menu,
QWidget *parent);

~TimelineWidget();
Canvas* getCurrrentScene() const {
return mCurrentScene;
}
Expand All @@ -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);
Expand Down

0 comments on commit 54e2354

Please sign in to comment.