Skip to content

Commit

Permalink
Library: emit showTrackmodel when activating feature root with tracks…
Browse files Browse the repository at this point in the history
… table

This makes the track menu 'Select track in library' action work in feature root views that
have a tracks table (AutoDJ, Analyze), though it's not working in Browse and Recording
because the BrowseModel does currently not support getTrackRows().

Issue still unresolved:
When triggering this section while a feature root view with no tracks table is active
the track will be selected in the previously selected tracks table.
  • Loading branch information
ronso0 committed May 3, 2022
1 parent d294c9e commit 9aac4c6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/library/analysisfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ void AnalysisFeature::activate() {
if (m_pAnalysisView) {
emit restoreSearch(m_pAnalysisView->currentSearch());
}
emit showTrackModel(m_pAnalysisView->getTableModel());
emit enableCoverArtDisplay(true);
}

Expand Down
1 change: 1 addition & 0 deletions src/library/autodj/autodjfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ void AutoDJFeature::activate() {
//qDebug() << "AutoDJFeature::activate()";
emit switchToView(kViewName);
emit disableSearch();
emit showTrackModel(m_pAutoDJProcessor->getTableModel());
emit enableCoverArtDisplay(true);
}

Expand Down
3 changes: 3 additions & 0 deletions src/library/dlganalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class DlgAnalysis : public QWidget, public Ui::DlgAnalysis, public virtual Libra
void slotAddToAutoDJTop() override;
void slotAddToAutoDJReplace() override;
void moveSelection(int delta) override;
AnalysisLibraryTableModel* getTableModel() const {
return m_pAnalysisLibraryTableModel;
}
inline const QString currentSearch() {
return m_pAnalysisLibraryTableModel->currentSearch();
}
Expand Down
3 changes: 3 additions & 0 deletions src/library/recording/dlgrecording.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class DlgRecording : public QWidget, public Ui::DlgRecording, public virtual Lib
void slotAddToAutoDJReplace() override;
void loadSelectedTrackToGroup(const QString& group, bool play) override;
void moveSelection(int delta) override;
ProxyTrackModel* getTableModel() {
return &m_proxyModel;
}
inline const QString currentSearch() { return m_proxyModel.currentSearch(); }
void saveCurrentViewState() override;
bool restoreCurrentViewState() override;
Expand Down
30 changes: 16 additions & 14 deletions src/library/recording/recordingfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ RecordingFeature::RecordingFeature(Library* pLibrary,
RecordingManager* pRecordingManager)
: LibraryFeature(pLibrary, pConfig, QStringLiteral("recordings")),
m_pRecordingManager(pRecordingManager),
m_pSidebarModel(new FolderTreeModel(this)) {
m_pSidebarModel(new FolderTreeModel(this)),
m_pRecordingView(nullptr) {
}

QVariant RecordingFeature::title() {
Expand All @@ -34,35 +35,35 @@ TreeItemModel* RecordingFeature::sidebarModel() const {
void RecordingFeature::bindLibraryWidget(WLibrary* pLibraryWidget,
KeyboardEventFilter *keyboard) {
//The view will be deleted by LibraryWidget
DlgRecording* pRecordingView = new DlgRecording(pLibraryWidget,
m_pConfig,
m_pLibrary,
m_pRecordingManager,
keyboard);
m_pRecordingView = new DlgRecording(pLibraryWidget,
m_pConfig,
m_pLibrary,
m_pRecordingManager,
keyboard);

pRecordingView->installEventFilter(keyboard);
pLibraryWidget->registerView(kViewName, pRecordingView);
connect(pRecordingView,
m_pRecordingView->installEventFilter(keyboard);
pLibraryWidget->registerView(kViewName, m_pRecordingView);
connect(m_pRecordingView,
&DlgRecording::loadTrack,
this,
&RecordingFeature::loadTrack);
connect(pRecordingView,
connect(m_pRecordingView,
&DlgRecording::loadTrackToPlayer,
this,
&RecordingFeature::loadTrackToPlayer);
connect(this,
&RecordingFeature::refreshBrowseModel,
pRecordingView,
m_pRecordingView,
&DlgRecording::refreshBrowseModel);
connect(this,
&RecordingFeature::requestRestoreSearch,
pRecordingView,
m_pRecordingView,
&DlgRecording::slotRestoreSearch);
connect(pRecordingView,
connect(m_pRecordingView,
&DlgRecording::restoreSearch,
this,
&RecordingFeature::restoreSearch);
connect(pRecordingView,
connect(m_pRecordingView,
&DlgRecording::restoreModelState,
this,
&RecordingFeature::restoreModelState);
Expand All @@ -72,5 +73,6 @@ void RecordingFeature::activate() {
emit refreshBrowseModel();
emit switchToView(kViewName);
emit disableSearch();
emit showTrackModel(m_pRecordingView->getTableModel());
emit enableCoverArtDisplay(false);
}
2 changes: 2 additions & 0 deletions src/library/recording/recordingfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "library/proxytrackmodel.h"

class RecordingManager;
class DlgRecording;

class RecordingFeature final : public LibraryFeature {
Q_OBJECT
Expand Down Expand Up @@ -38,4 +39,5 @@ class RecordingFeature final : public LibraryFeature {
RecordingManager* const m_pRecordingManager;

FolderTreeModel* m_pSidebarModel;
DlgRecording* m_pRecordingView;
};

0 comments on commit 9aac4c6

Please sign in to comment.