Skip to content

Commit

Permalink
Merge pull request #11453 from daschuer/woverview_reload
Browse files Browse the repository at this point in the history
Init WOverview with a track, if it was already loaded before
  • Loading branch information
ronso0 authored Apr 8, 2023
2 parents 2bc15c7 + f370c60 commit e399c7c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/skin/legacy/legacyskinparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -964,16 +964,12 @@ QWidget* LegacySkinParser::parseOverview(const QDomElement& node) {
overviewWidget->setup(node, *m_pContext);
overviewWidget->installEventFilter(m_pKeyboard);
overviewWidget->installEventFilter(m_pControllerManager->getControllerLearningEventFilter());
overviewWidget->Init();
overviewWidget->initWithTrack(pPlayer->getLoadedTrack());

// Connect the player's load and unload signals to the overview widget.
connect(pPlayer, &BaseTrackPlayer::newTrackLoaded, overviewWidget, &WOverview::slotTrackLoaded);
connect(pPlayer, &BaseTrackPlayer::loadingTrack, overviewWidget, &WOverview::slotLoadingTrack);

// just in case track already loaded
overviewWidget->slotLoadingTrack(pPlayer->getLoadedTrack(), TrackPointer());
overviewWidget->slotTrackLoaded(pPlayer->getLoadedTrack());

return overviewWidget;
}

Expand Down
10 changes: 10 additions & 0 deletions src/widget/woverview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ void WOverview::setup(const QDomNode& node, const SkinContext& context) {
setFocusPolicy(Qt::NoFocus);
}

void WOverview::initWithTrack(TrackPointer pTrack) {
Init();
if (pTrack) {
// if a track already loaded (after skin change)
slotLoadingTrack(pTrack, TrackPointer());
slotTrackLoaded(pTrack);
slotWaveformSummaryUpdated();
}
}

void WOverview::onConnectedControlChanged(double dParameter, double dValue) {
// this is connected via skin to "playposition"
Q_UNUSED(dValue);
Expand Down
1 change: 1 addition & 0 deletions src/widget/woverview.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class WOverview : public WWidget, public TrackDropTarget {
Q_OBJECT
public:
void setup(const QDomNode& node, const SkinContext& context);
virtual void initWithTrack(TrackPointer pTrack);

public slots:
void onConnectedControlChanged(double dParameter, double dValue) override;
Expand Down

0 comments on commit e399c7c

Please sign in to comment.