Skip to content

Commit

Permalink
automatically refresh Not In Timeline playlist bin
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Jan 4, 2025
1 parent adfd866 commit f01893e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/docks/playlistdock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ class PlaylistProxyModel : public QSortFilterProxyModel
{
m_bin.clear();
m_smartBin = static_cast<enum PlaylistDock::SmartBin>(bin);
LOG_DEBUG() << m_smartBin;

switch (bin) {
case PlaylistDock::SmartBinDuplicates: {
Expand Down Expand Up @@ -1751,6 +1752,15 @@ void PlaylistDock::onPlaylistCleared()
Actions["playlistSelectAllAction"]->setEnabled(nonEmptyModel);
}

void PlaylistDock::refreshTimelineSmartBins()
{
auto items = ui->treeWidget->selectedItems();
if (!items.isEmpty() && SmartBinNotInTimeline == items.first()->data(0, Qt::UserRole).toInt()
&& m_proxyModel->rowCount() > 0) {
m_proxyModel->setSmartBin(SmartBinNotInTimeline);
}
}

void PlaylistDock::onDropped(const QMimeData *data, int row)
{
if (data && data->hasUrls()) {
Expand Down
1 change: 1 addition & 0 deletions src/docks/playlistdock.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public slots:
void onPlaylistCreated();
void onPlaylistLoaded();
void onPlaylistCleared();
void refreshTimelineSmartBins();

private slots:

Expand Down
2 changes: 2 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ void MainWindow::setupAndConnectDocks()
connect(m_timelineDock->model(), SIGNAL(created()), SLOT(onMultitrackCreated()));
connect(m_timelineDock->model(), SIGNAL(closed()), SLOT(onMultitrackClosed()));
connect(m_timelineDock->model(), SIGNAL(modified()), SLOT(onMultitrackModified()));
connect(m_timelineDock->model(), &MultitrackModel::modified, m_playlistDock,
&PlaylistDock::refreshTimelineSmartBins);
connect(m_timelineDock->model(), SIGNAL(durationChanged()), SLOT(onMultitrackDurationChanged()));
connect(m_timelineDock, SIGNAL(clipOpened(Mlt::Producer *)), SLOT(openCut(Mlt::Producer *)));
connect(m_timelineDock->model(), &MultitrackModel::seeked, this, &MainWindow::seekTimeline);
Expand Down

0 comments on commit f01893e

Please sign in to comment.