Skip to content

Commit 3075e2a

Browse files
committed
Refactoring
1 parent 774ce86 commit 3075e2a

22 files changed

+945
-157
lines changed

bin/toucan-view/App.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ namespace toucan
4848

4949
_documentsModel = std::make_shared<DocumentsModel>(context, _host);
5050

51+
_windowModel = std::make_shared<WindowModel>();
52+
5153
_window = Window::create(
5254
context,
5355
std::dynamic_pointer_cast<App>(shared_from_this()),
@@ -91,4 +93,9 @@ namespace toucan
9193
{
9294
return _documentsModel;
9395
}
96+
97+
const std::shared_ptr<WindowModel>& App::getWindowModel() const
98+
{
99+
return _windowModel;
100+
}
94101
}

bin/toucan-view/App.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "DocumentsModel.h"
88
#include "TimeUnitsModel.h"
99
#include "Window.h"
10+
#include "WindowModel.h"
1011

1112
#include <dtk/ui/App.h>
1213

@@ -30,12 +31,15 @@ namespace toucan
3031

3132
const std::shared_ptr<DocumentsModel>& getDocumentsModel() const;
3233

34+
const std::shared_ptr<WindowModel>& getWindowModel() const;
35+
3336
private:
3437
std::shared_ptr<MessageLog> _messageLog;
3538
std::filesystem::path _path;
3639
std::shared_ptr<TimeUnitsModel> _timeUnitsModel;
3740
std::shared_ptr<ImageEffectHost> _host;
3841
std::shared_ptr<DocumentsModel> _documentsModel;
42+
std::shared_ptr<WindowModel> _windowModel;
3943
std::shared_ptr<Window> _window;
4044
};
4145
}

bin/toucan-view/BottomBar.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ namespace toucan
2626
_timeEdit = TimeEdit::create(context, app->getTimeUnitsModel(), _layout);
2727
_timeEdit->setTooltip("Current time");
2828

29-
_slider = dtk::IntSlider::create(context, nullptr, _layout);
30-
3129
_durationLabel = TimeLabel::create(context, app->getTimeUnitsModel(), _layout);
3230
_durationLabel->setTooltip("Timeline duration");
3331

@@ -62,17 +60,6 @@ namespace toucan
6260
}
6361
});
6462

65-
_slider->setCallback(
66-
[this](double value)
67-
{
68-
if (_document)
69-
{
70-
_document->getPlaybackModel()->setCurrentTime(OTIO_NS::RationalTime(
71-
value,
72-
_timeRange.duration().rate()));
73-
}
74-
});
75-
7663
std::weak_ptr<App> appWeak(app);
7764
_timeUnitsComboBox->setIndexCallback(
7865
[appWeak](int index)
@@ -132,7 +119,6 @@ namespace toucan
132119
_frameButtons->setEnabled(document.get());
133120
_playbackButtons->setEnabled(document.get());
134121
_timeEdit->setEnabled(document.get());
135-
_slider->setEnabled(document.get());
136122
_durationLabel->setEnabled(document.get());
137123
});
138124

@@ -176,18 +162,12 @@ namespace toucan
176162
{
177163
_timeEdit->setTimeRange(_timeRange);
178164

179-
_slider->setRange(dtk::RangeI(
180-
_timeRange.start_time().value(),
181-
_timeRange.end_time_inclusive().value()));
182-
183165
_durationLabel->setTime(_timeRange.duration());
184166
}
185167

186168
void BottomBar::_currentTimeUpdate()
187169
{
188170
_timeEdit->setTime(_currentTime);
189-
190-
_slider->setValue(_currentTime.value());
191171
}
192172

193173
void BottomBar::_playbackUpdate()

bin/toucan-view/BottomBar.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include "TimeWidgets.h"
88

99
#include <dtk/ui/ComboBox.h>
10-
#include <dtk/ui/IntSlider.h>
1110
#include <dtk/ui/RowLayout.h>
1211
#include <dtk/ui/ToolButton.h>
1312

@@ -50,7 +49,6 @@ namespace toucan
5049
std::shared_ptr<FrameButtons> _frameButtons;
5150
std::shared_ptr<PlaybackButtons> _playbackButtons;
5251
std::shared_ptr<TimeEdit> _timeEdit;
53-
std::shared_ptr<dtk::IntSlider> _slider;
5452
std::shared_ptr<TimeLabel> _durationLabel;
5553
std::shared_ptr<dtk::ComboBox> _timeUnitsComboBox;
5654

bin/toucan-view/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ set(HEADERS
1313
ToolBar.h
1414
ViewModel.h
1515
Viewport.h
16-
Window.h)
16+
Window.h
17+
WindowModel.h)
1718

1819
set(SOURCE
1920
App.cpp
@@ -31,6 +32,7 @@ set(SOURCE
3132
ViewModel.cpp
3233
Viewport.cpp
3334
Window.cpp
35+
WindowModel.cpp
3436
main.cpp)
3537

3638
add_executable(toucan-view ${HEADERS} ${SOURCE})

bin/toucan-view/Document.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ namespace toucan
6464
return _path;
6565
}
6666

67+
const OTIO_NS::SerializableObject::Retainer<OTIO_NS::Timeline>& Document::getTimeline() const
68+
{
69+
return _timeline;
70+
}
71+
6772
const std::shared_ptr<PlaybackModel>& Document::getPlaybackModel() const
6873
{
6974
return _playbackModel;

bin/toucan-view/Document.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ namespace toucan
3232

3333
const std::filesystem::path& getPath() const;
3434

35+
const OTIO_NS::SerializableObject::Retainer<OTIO_NS::Timeline>& getTimeline() const;
36+
3537
const std::shared_ptr<PlaybackModel>& getPlaybackModel() const;
3638

3739
const std::shared_ptr<ViewModel>& getViewModel() const;

0 commit comments

Comments
 (0)