Skip to content

Commit

Permalink
Merge pull request #11661 from daschuer/rhythmbox_fix
Browse files Browse the repository at this point in the history
Import from Rhythmbox playlist fix
  • Loading branch information
Swiftb0y authored Jun 15, 2023
2 parents 6385f30 + f6999bd commit b2deaca
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 36 deletions.
14 changes: 7 additions & 7 deletions src/library/banshee/bansheefeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ class BansheeFeature : public BaseExternalLibraryFeature {
Q_OBJECT
public:
BansheeFeature(Library* pLibrary, UserSettingsPointer pConfig);
virtual ~BansheeFeature();
~BansheeFeature() override;
static bool isSupported();
static void prepareDbPath(UserSettingsPointer pConfig);

virtual QVariant title();
virtual QIcon getIcon();
QVariant title() override;
QIcon getIcon() override;

virtual TreeItemModel* getChildModel();
TreeItemModel* getChildModel() override;

public slots:
virtual void activate();
virtual void activateChild(const QModelIndex& index);
void activate() override;
void activateChild(const QModelIndex& index) override;

private:
virtual void appendTrackIdsFromRightClickIndex(QList<TrackId>* trackIds, QString* pPlaylist);
void appendTrackIdsFromRightClickIndex(QList<TrackId>* trackIds, QString* pPlaylist) override;

BansheePlaylistModel* m_pBansheePlaylistModel;
TreeItemModel m_childModel;
Expand Down
7 changes: 7 additions & 0 deletions src/library/baseexternallibraryfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,10 @@ void BaseExternalLibraryFeature::appendTrackIdsFromRightClickIndex(
trackIds->append(trackId);
}
}

std::unique_ptr<BaseSqlTableModel>
BaseExternalLibraryFeature::createPlaylistModelForPlaylist(
const QString& playlist) {
Q_UNUSED(playlist);
return {};
}
7 changes: 2 additions & 5 deletions src/library/baseexternallibraryfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,9 @@ class BaseExternalLibraryFeature : public LibraryFeature {
void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) override;

protected:
// Must be implemented by external Libraries copied to Mixxx DB
// Must be re-implemented by external Libraries copied to Mixxx DB
virtual std::unique_ptr<BaseSqlTableModel> createPlaylistModelForPlaylist(
const QString& playlist) {
Q_UNUSED(playlist);
return {};
}
const QString& playlist);
// Must be implemented by external Libraries not copied to Mixxx DB
virtual void appendTrackIdsFromRightClickIndex(QList<TrackId>* trackIds, QString* pPlaylist);

Expand Down
20 changes: 10 additions & 10 deletions src/library/browse/browsefeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,27 @@ class BrowseFeature : public LibraryFeature {
BrowseFeature(Library* pLibrary,
UserSettingsPointer pConfig,
RecordingManager* pRecordingManager);
virtual ~BrowseFeature();
~BrowseFeature() override;

QVariant title();
QIcon getIcon();
QVariant title() override;
QIcon getIcon() override;

void bindLibraryWidget(WLibrary* libraryWidget,
KeyboardEventFilter* keyboard);
void bindSidebarWidget(WLibrarySidebar* pSidebarWidget);
KeyboardEventFilter* keyboard) override;
void bindSidebarWidget(WLibrarySidebar* pSidebarWidget) override;

TreeItemModel* getChildModel();
TreeItemModel* getChildModel() override;

void releaseBrowseThread();

public slots:
void slotAddQuickLink();
void slotRemoveQuickLink();
void slotAddToLibrary();
void activate();
void activateChild(const QModelIndex& index);
void onRightClickChild(const QPoint& globalPos, const QModelIndex& index);
void onLazyChildExpandation(const QModelIndex& index);
void activate() override;
void activateChild(const QModelIndex& index) override;
void onRightClickChild(const QPoint& globalPos, const QModelIndex& index) override;
void onLazyChildExpandation(const QModelIndex& index) override;
void slotLibraryScanStarted();
void slotLibraryScanFinished();

Expand Down
15 changes: 8 additions & 7 deletions src/library/rhythmbox/rhythmboxfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ RhythmboxFeature::~RhythmboxFeature() {
delete m_pRhythmboxPlaylistModel;
}

BaseSqlTableModel* RhythmboxFeature::getPlaylistModelForPlaylist(const QString& playlist) {
BaseExternalPlaylistModel* pModel = new BaseExternalPlaylistModel(
this, m_pLibrary->trackCollections(),
"mixxx.db.model.rhythmbox_playlist",
"rhythmbox_playlists",
"rhythmbox_playlist_tracks",
m_trackSource);
std::unique_ptr<BaseSqlTableModel>
RhythmboxFeature::createPlaylistModelForPlaylist(const QString& playlist) {
auto pModel = std::make_unique<BaseExternalPlaylistModel>(this,
m_pLibrary->trackCollections(),
"mixxx.db.model.rhythmbox_playlist",
"rhythmbox_playlists",
"rhythmbox_playlist_tracks",
m_trackSource);
pModel->setPlaylist(playlist);
return pModel;
}
Expand Down
17 changes: 10 additions & 7 deletions src/library/rhythmbox/rhythmboxfeature.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,28 @@ class RhythmboxFeature : public BaseExternalLibraryFeature {
Q_OBJECT
public:
RhythmboxFeature(Library* pLibrary, UserSettingsPointer pConfig);
virtual ~RhythmboxFeature();
~RhythmboxFeature() override;
static bool isSupported();

QVariant title();
QIcon getIcon();
QVariant title() override;
QIcon getIcon() override;

TreeItemModel* getChildModel();
TreeItemModel* getChildModel() override;
// processes the music collection
TreeItem* importMusicCollection();
// processes the playlist entries
TreeItem* importPlaylists();

public slots:
void activate();
void activateChild(const QModelIndex& index);
void activate() override;
void activateChild(const QModelIndex& index) override;
void onTrackCollectionLoaded();

protected:
std::unique_ptr<BaseSqlTableModel> createPlaylistModelForPlaylist(
const QString& playlist) override;

private:
virtual BaseSqlTableModel* getPlaylistModelForPlaylist(const QString& playlist);
// Removes all rows from a given table
void clearTable(const QString& table_name);
// reads the properties of a track and executes a SQL statement
Expand Down

0 comments on commit b2deaca

Please sign in to comment.