summaryrefslogtreecommitdiffstats
path: root/src/library
diff options
context:
space:
mode:
authorronso0 <ronso0@mixxx.org>2019-11-04 15:24:40 +0100
committerronso0 <ronso0@mixxx.org>2019-11-04 15:24:58 +0100
commit751bf03c109f634fc238fac36403aae4196cbca5 (patch)
tree64a9f8d1812920194af96b7d204214b281ca9136 /src/library
parent35609127cd4ac6bb79ed2b52f4f8d0c6e7dc31ca (diff)
bind sidebar widget to all library features, make binding iterator more compact
use the widget as parent for right-click menus on sidebar items
Diffstat (limited to 'src/library')
-rw-r--r--src/library/autodj/autodjfeature.cpp19
-rw-r--r--src/library/autodj/autodjfeature.h4
-rw-r--r--src/library/baseexternallibraryfeature.cpp10
-rw-r--r--src/library/baseexternallibraryfeature.h5
-rw-r--r--src/library/browse/browsefeature.cpp8
-rw-r--r--src/library/browse/browsefeature.h3
-rw-r--r--src/library/crate/cratefeature.cpp10
-rw-r--r--src/library/crate/cratefeature.h6
-rw-r--r--src/library/itunes/itunesfeature.cpp10
-rw-r--r--src/library/itunes/itunesfeature.h6
-rw-r--r--src/library/library.cpp17
-rw-r--r--src/library/library.h3
-rw-r--r--src/library/libraryfeature.h1
-rw-r--r--src/library/playlistfeature.cpp12
-rw-r--r--src/library/playlistfeature.h5
-rw-r--r--src/library/setlogfeature.cpp13
-rw-r--r--src/library/setlogfeature.h4
17 files changed, 102 insertions, 34 deletions
diff --git a/src/library/autodj/autodjfeature.cpp b/src/library/autodj/autodjfeature.cpp
index 730ab31b1c..af96b92a4c 100644
--- a/src/library/autodj/autodjfeature.cpp
+++ b/src/library/autodj/autodjfeature.cpp
@@ -21,6 +21,7 @@
#include "util/compatibility.h"
#include "util/dnd.h"
#include "widget/wlibrary.h"
+#include "widget/wlibrarysidebar.h"
const QString AutoDJFeature::m_sAutoDJViewName = QString("Auto DJ");
@@ -149,6 +150,11 @@ void AutoDJFeature::bindLibraryWidget(WLibrary* libraryWidget,
&AutoDJFeature::slotAddRandomTrack);
}
+void AutoDJFeature::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) {
+ // store the sidebar widget pointer for later use in onRightClickChild
+ m_pSidebarWidget = pSidebarWidget;
+}
+
TreeItemModel* AutoDJFeature::getChildModel() {
return &m_childModel;
}
@@ -285,10 +291,11 @@ void AutoDJFeature::constructCrateChildModel() {
void AutoDJFeature::onRightClickChild(const QPoint& globalPos,
QModelIndex index) {
TreeItem* pClickedItem = static_cast<TreeItem*>(index.internalPointer());
+ QMenu menu(m_pSidebarWidget);
if (m_pCratesTreeItem == pClickedItem) {
// The "Crates" parent item was right-clicked.
// Bring up the context menu.
- QMenu crateMenu;
+ QMenu crateMenu(m_pSidebarWidget);
crateMenu.setTitle(tr("Add Crate as Track Source"));
CrateSelectResult nonAutoDjCrates(m_pTrackCollection->crates().selectAutoDjCrates(false));
Crate crate;
@@ -301,16 +308,14 @@ void AutoDJFeature::onRightClickChild(const QPoint& globalPos,
crateMenu.addAction(pAction.get());
pAction.release();
}
- QMenu contextMenu;
- contextMenu.addMenu(&crateMenu);
- contextMenu.exec(globalPos);
+ menu.addMenu(&crateMenu);
+ menu.exec(globalPos);
} else {
// A crate child item was right-clicked.
// Bring up the context menu.
m_pRemoveCrateFromAutoDj->setData(pClickedItem->getData()); // the selected CrateId
- QMenu contextMenu;
- contextMenu.addAction(m_pRemoveCrateFromAutoDj);
- contextMenu.exec(globalPos);
+ menu.addAction(m_pRemoveCrateFromAutoDj);
+ menu.exec(globalPos);
}
}
diff --git a/src/library/autodj/autodjfeature.h b/src/library/autodj/autodjfeature.h
index 31621a3d0b..2da3f84c9c 100644
--- a/src/library/autodj/autodjfeature.h
+++ b/src/library/autodj/autodjfeature.h
@@ -15,6 +15,7 @@
#include <QPoint>
#include <QAction>
#include <QSignalMapper>
+#include <QPointer>
#include "library/libraryfeature.h"
#include "preferences/usersettings.h"
@@ -27,6 +28,7 @@ class Library;
class PlayerManagerInterface;
class TrackCollection;
class AutoDJProcessor;
+class WLibrarySidebar;
class AutoDJFeature : public LibraryFeature {
Q_OBJECT
@@ -45,6 +47,7 @@ class AutoDJFeature : public LibraryFeature {
void bindLibraryWidget(WLibrary* libraryWidget,
KeyboardEventFilter* keyboard);
+ void bindSidebarWidget(WLibrarySidebar* pSidebarWidget);
TreeItemModel* getChildModel();
@@ -92,6 +95,7 @@ class AutoDJFeature : public LibraryFeature {
QSignalMapper m_crateMapper;
QIcon m_icon;
+ QPointer<WLibrarySidebar> m_pSidebarWidget;
private slots:
// Add a crate to the auto-DJ queue.
diff --git a/src/library/baseexternallibraryfeature.cpp b/src/library/baseexternallibraryfeature.cpp
index 8eee4928bd..9de8031f8b 100644
--- a/src/library/baseexternallibraryfeature.cpp
+++ b/src/library/baseexternallibraryfeature.cpp
@@ -3,6 +3,7 @@
#include <QMenu>
#include "library/basesqltablemodel.h"
+#include "widget/wlibrarysidebar.h"
BaseExternalLibraryFeature::BaseExternalLibraryFeature(QObject* pParent,
TrackCollection* pCollection)
@@ -33,6 +34,11 @@ BaseExternalLibraryFeature::~BaseExternalLibraryFeature() {
delete m_pImportAsMixxxPlaylistAction;
}
+void BaseExternalLibraryFeature::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) {
+ // store the sidebar widget pointer for later use in onRightClickChild
+ m_pSidebarWidget = pSidebarWidget;
+}
+
void BaseExternalLibraryFeature::onRightClick(const QPoint& globalPos) {
Q_UNUSED(globalPos);
m_lastRightClickedIndex = QModelIndex();
@@ -41,9 +47,7 @@ void BaseExternalLibraryFeature::onRightClick(const QPoint& globalPos) {
void BaseExternalLibraryFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) {
//Save the model index so we can get it in the action slots...
m_lastRightClickedIndex = index;
-
- //Create the right-click menu
- QMenu menu;
+ QMenu menu(m_pSidebarWidget);
menu.addAction(m_pAddToAutoDJAction);
menu.addAction(m_pAddToAutoDJTopAction);
menu.addSeparator();
diff --git a/src/library/baseexternallibraryfeature.h b/src/library/baseexternallibraryfeature.h
index efca53c271..672235b0db 100644
--- a/src/library/baseexternallibraryfeature.h
+++ b/src/library/baseexternallibraryfeature.h
@@ -3,11 +3,13 @@
#include <QAction>
#include <QModelIndex>
+#include <QPointer>
#include "library/libraryfeature.h"
class BaseSqlTableModel;
class TrackCollection;
+class WLibrarySidebar;
class BaseExternalLibraryFeature : public LibraryFeature {
Q_OBJECT
@@ -16,6 +18,7 @@ class BaseExternalLibraryFeature : public LibraryFeature {
virtual ~BaseExternalLibraryFeature();
public slots:
+ virtual void bindSidebarWidget(WLibrarySidebar* pSidebarWidget);
virtual void onRightClick(const QPoint& globalPos);
virtual void onRightClickChild(const QPoint& globalPos, QModelIndex index);
@@ -43,6 +46,8 @@ class BaseExternalLibraryFeature : public LibraryFeature {
QAction* m_pAddToAutoDJAction;
QAction* m_pAddToAutoDJTopAction;
QAction* m_pImportAsMixxxPlaylistAction;
+
+ QPointer<WLibrarySidebar> m_pSidebarWidget;
};
#endif // BASEEXTERNALLIBRARYFEATURE_H
diff --git a/src/library/browse/browsefeature.cpp b/src/library/browse/browsefeature.cpp
index f7632e60f7..89c1a7ca09 100644
--- a/src/library/browse/browsefeature.cpp
+++ b/src/library/browse/browsefeature.cpp
@@ -20,6 +20,7 @@
#include "util/sandbox.h"
#include "widget/wlibrary.h"
#include "widget/wlibrarytextbrowser.h"
+#include "widget/wlibrarysidebar.h"
const QString kQuickLinksSeparator = "-+-";
@@ -226,6 +227,11 @@ void BrowseFeature::bindLibraryWidget(WLibrary* libraryWidget,
libraryWidget->registerView("BROWSEHOME", edit);
}
+void BrowseFeature::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) {
+ // store the sidebar widget pointer for later use in onRightClickChild
+ m_pSidebarWidget = pSidebarWidget;
+}
+
void BrowseFeature::activate() {
emit(switchToView("BROWSEHOME"));
emit disableSearch();
@@ -275,7 +281,7 @@ void BrowseFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index
return;
}
- QMenu menu(NULL);
+ QMenu menu(m_pSidebarWidget);
if (item->parent()->getData().toString() == QUICK_LINK_NODE) {
menu.addAction(m_pRemoveQuickLinkAction);
menu.exec(globalPos);
diff --git a/src/library/browse/browsefeature.h b/src/library/browse/browsefeature.h
index dcbf845701..1bf005c662 100644
--- a/src/library/browse/browsefeature.h
+++ b/src/library/browse/browsefeature.h
@@ -24,6 +24,7 @@
class Library;
class TrackCollection;
+class WLibrarySidebar;
class BrowseFeature : public LibraryFeature {
Q_OBJECT
@@ -39,6 +40,7 @@ class BrowseFeature : public LibraryFeature {
void bindLibraryWidget(WLibrary* libraryWidget,
KeyboardEventFilter* keyboard);
+ void bindSidebarWidget(WLibrarySidebar* pSidebarWidget);
TreeItemModel* getChildModel();
@@ -77,6 +79,7 @@ class BrowseFeature : public LibraryFeature {
TreeItem* m_pQuickLinkItem;
QStringList m_quickLinkList;
QIcon m_icon;
+ QPointer<WLibrarySidebar> m_pSidebarWidget;
};
#endif // BROWSEFEATURE_H
diff --git a/src/library/crate/cratefeature.cpp b/src/library/crate/cratefeature.cpp
index a0dac0c0f3..0015eed5fe 100644
--- a/src/library/crate/cratefeature.cpp
+++ b/src/library/crate/cratefeature.cpp
@@ -22,6 +22,7 @@
#include "sources/soundsourceproxy.h"
#include "widget/wlibrary.h"
+#include "widget/wlibrarysidebar.h"
#include "widget/wlibrarytextbrowser.h"
#include "util/dnd.h"
@@ -280,6 +281,11 @@ void CrateFeature::bindLibraryWidget(WLibrary* libraryWidget,
libraryWidget->registerView("CRATEHOME", edit);
}
+void CrateFeature::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) {
+ // store the sidebar widget pointer for later use in onRightClickChild
+ m_pSidebarWidget = pSidebarWidget;
+}
+
TreeItemModel* CrateFeature::getChildModel() {
return &m_childModel;
}
@@ -334,7 +340,7 @@ bool CrateFeature::readLastRightClickedCrate(Crate* pCrate) const {
void CrateFeature::onRightClick(const QPoint& globalPos) {
m_lastRightClickedIndex = QModelIndex();
- QMenu menu(NULL);
+ QMenu menu(m_pSidebarWidget);
menu.addAction(m_pCreateCrateAction.get());
menu.addSeparator();
menu.addAction(m_pCreateImportPlaylistAction.get());
@@ -361,7 +367,7 @@ void CrateFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index)
m_pLockCrateAction->setText(crate.isLocked() ? tr("Unlock") : tr("Lock"));
- QMenu menu(NULL);
+ QMenu menu(m_pSidebarWidget);
menu.addAction(m_pCreateCrateAction.get());
menu.addSeparator();
menu.addAction(m_pRenameCrateAction.get());
diff --git a/src/library/crate/cratefeature.h b/src/library/crate/cratefeature.h
index b8d82f66a2..6e33ae73d1 100644
--- a/src/library/crate/cratefeature.h
+++ b/src/library/crate/cratefeature.h
@@ -9,6 +9,7 @@
#include <QUrl>
#include <QIcon>
#include <QPoint>
+#include <QPointer>
#include "library/crate/cratetablemodel.h"
@@ -24,7 +25,7 @@
// forward declaration(s)
class Library;
class TrackCollection;
-
+class WLibrarySidebar;
class CrateFeature : public LibraryFeature {
Q_OBJECT
@@ -43,6 +44,7 @@ class CrateFeature : public LibraryFeature {
void bindLibraryWidget(WLibrary* libraryWidget,
KeyboardEventFilter* keyboard) override;
+ void bindSidebarWidget(WLibrarySidebar* pSidebarWidget);
TreeItemModel* getChildModel() override;
@@ -121,6 +123,8 @@ class CrateFeature : public LibraryFeature {
parented_ptr<QAction> m_pExportPlaylistAction;
parented_ptr<QAction> m_pExportTrackFilesAction;
parented_ptr<QAction> m_pAnalyzeCrateAction;
+
+ QPointer<WLibrarySidebar> m_pSidebarWidget;
};
diff --git a/src/library/itunes/itunesfeature.cpp b/src/library/itunes/itunesfeature.cpp
index 112170b3ca..0883dd0778 100644
--- a/src/library/itunes/itunesfeature.cpp
+++ b/src/library/itunes/itunesfeature.cpp
@@ -17,6 +17,7 @@
#include "library/queryutil.h"
#include "util/lcs.h"
#include "util/sandbox.h"
+#include "widget/wlibrarysidebar.h"
#ifdef __SQLITE3__
#include <sqlite3.h>
@@ -146,6 +147,13 @@ QIcon ITunesFeature::getIcon() {
return m_icon;
}
+void ITunesFeature::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) {
+ // store the sidebar widget pointer for later use in onRightClick()
+ m_pSidebarWidget = pSidebarWidget;
+ // send it to BaseExternalLibraryFeature for onRightClickChild()
+ BaseExternalLibraryFeature::bindSidebarWidget(pSidebarWidget);
+}
+
void ITunesFeature::activate() {
activate(false);
emit(enableCoverArtDisplay(false));
@@ -226,7 +234,7 @@ TreeItemModel* ITunesFeature::getChildModel() {
void ITunesFeature::onRightClick(const QPoint& globalPos) {
BaseExternalLibraryFeature::onRightClick(globalPos);
- QMenu menu;
+ QMenu menu(m_pSidebarWidget);
QAction useDefault(tr("Use Default Library"), &menu);
QAction chooseNew(tr("Choose Library..."), &menu);
menu.addAction(&useDefault);
diff --git a/src/library/itunes/itunesfeature.h b/src/library/itunes/itunesfeature.h
index e3319a16d8..02081a03f1 100644
--- a/src/library/itunes/itunesfeature.h
+++ b/src/library/itunes/itunesfeature.h
@@ -9,6 +9,7 @@
#include <QFuture>
#include <QtConcurrentRun>
#include <QFutureWatcher>
+#include <QPointer>
#include "library/baseexternallibraryfeature.h"
#include "library/trackcollection.h"
@@ -17,6 +18,7 @@
class BaseExternalTrackModel;
class BaseExternalPlaylistModel;
+class WLibrarySidebar;
class ITunesFeature : public BaseExternalLibraryFeature {
Q_OBJECT
@@ -27,6 +29,7 @@ class ITunesFeature : public BaseExternalLibraryFeature {
QVariant title();
QIcon getIcon();
+ void bindSidebarWidget(WLibrarySidebar* pSidebarWidget);
TreeItemModel* getChildModel();
@@ -34,7 +37,7 @@ class ITunesFeature : public BaseExternalLibraryFeature {
void activate();
void activate(bool forceReload);
void activateChild(const QModelIndex& index);
- void onRightClick(const QPoint& globalPos);
+ void onRightClick(const QPoint& globalPos) override;
void onTrackCollectionLoaded();
private:
@@ -70,6 +73,7 @@ class ITunesFeature : public BaseExternalLibraryFeature {
QString m_mixxxItunesRoot;
QSharedPointer<BaseTrackCache> m_trackSource;
+ QPointer<WLibrarySidebar> m_pSidebarWidget;
QIcon m_icon;
};
diff --git a/src/library/library.cpp b/src/library/library.cpp
index 1a53ec914a..9d4f6e3d82 100644
--- a/src/library/library.cpp
+++ b/src/library/library.cpp
@@ -11,23 +11,25 @@
#include "mixer/playermanager.h"
#include "library/library.h"
#include "library/library_preferences.h"
+#include "library/librarycontrol.h"
#include "library/libraryfeature.h"
#include "library/librarytablemodel.h"
#include "library/sidebarmodel.h"
#include "library/trackcollection.h"
#include "library/trackmodel.h"
+
+#include "library/autodj/autodjfeature.h"
+#include "library/banshee/bansheefeature.h"
#include "library/browse/browsefeature.h"
#include "library/crate/cratefeature.h"
-#include "library/rhythmbox/rhythmboxfeature.h"
-#include "library/banshee/bansheefeature.h"
-#include "library/recording/recordingfeature.h"
#include "library/itunes/itunesfeature.h"
#include "library/mixxxlibraryfeature.h"
-#include "library/autodj/autodjfeature.h"
#include "library/playlistfeature.h"
-#include "library/traktor/traktorfeature.h"
-#include "library/librarycontrol.h"
+#include "library/recording/recordingfeature.h"
+#include "library/rhythmbox/rhythmboxfeature.h"
#include "library/setlogfeature.h"
+#include "library/traktor/traktorfeature.h"
+
#include "util/db/dbconnectionpooled.h"
#include "util/sandbox.h"
#include "util/logger.h"
@@ -135,6 +137,7 @@ Library::Library(
addFeature(m_pPlaylistFeature);
m_pCrateFeature = new CrateFeature(this, m_pTrackCollection, m_pConfig);
addFeature(m_pCrateFeature);
+
BrowseFeature* browseFeature = new BrowseFeature(
this, pConfig, m_pTrackCollection, pRecordingManager);
connect(browseFeature,
@@ -149,8 +152,8 @@ Library::Library(
&LibraryScanner::scanFinished,
browseFeature,
&BrowseFeature::slotLibraryScanFinished);
-
addFeature(browseFeature);
+
addFeature(new RecordingFeature(this, pConfig, m_pTrackCollection, pRecordingManager));
addFeature(new SetlogFeature(this, pConfig, m_pTrackCollection));
diff --git a/src/library/library.h b/src/library/library.h
index f2ee28c1e1..7075a6acb7 100644
--- a/src/library/library.h
+++ b/src/library/library.h
@@ -15,9 +15,8 @@
#include "preferences/usersettings.h"
#include "track/globaltrackcache.h"
#include "recording/recordingmanager.h"
-#include "analysisfeature.h"
+#include "library/analysisfeature.h"
#include "library/coverartcache.h"
-#include "library/setlogfeature.h"
#include "library/scanner/libraryscanner.h"
#include "util/db/dbconnectionpool.h"
diff --git a/src/library/libraryfeature.h b/src/library/libraryfeature.h
index e552f3f0ec..ad8abf51cd 100644
--- a/src/library/libraryfeature.h
+++ b/src/library/libraryfeature.h
@@ -64,6 +64,7 @@ class LibraryFeature : public QObject {
// Reimplement this to register custom views with the library widget.
virtual void bindLibraryWidget(WLibrary* /* libraryWidget */,
KeyboardEventFilter* /* keyboard */) {}
+ virtual void bindSidebarWidget(WLibrarySidebar* /* sidebar widget */) {}
virtual TreeItemModel* getChildModel() = 0;
virtual bool hasTrackTable() {
diff --git a/src/library/playlistfeature.cpp b/src/library/playlistfeature.cpp
index e91d12089b..e68e4d896d 100644
--- a/src/library/playlistfeature.cpp
+++ b/src/library/playlistfeature.cpp
@@ -58,11 +58,14 @@ QIcon PlaylistFeature::getIcon() {
return m_icon;
}
+void PlaylistFeature::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) {
+ // store the sidebar widget pointer for later use in onRightClickChild
+ m_pSidebarWidget = pSidebarWidget;
+}
+
void PlaylistFeature::onRightClick(const QPoint& globalPos) {
m_lastRightClickedIndex = QModelIndex();
-
- //Create the right-click menu
- QMenu menu(NULL);
+ QMenu menu(m_pSidebarWidget);
menu.addAction(m_pCreatePlaylistAction);
menu.addSeparator();
menu.addAction(m_pCreateImportPlaylistAction);
@@ -80,8 +83,7 @@ void PlaylistFeature::onRightClickChild(const QPoint& globalPos, QModelIndex ind
m_pLockPlaylistAction->setText(locked ? tr("Unlock") : tr("Lock"));
- //Create the right-click menu
- QMenu menu(NULL);
+ QMenu menu(m_pSidebarWidget);
menu.addAction(m_pCreatePlaylistAction);
menu.addSeparator();
menu.addAction(m_pAddToAutoDJAction);
diff --git a/src/library/playlistfeature.h b/src/library/playlistfeature.h
index ce6a1183ab..1d0bb936d1 100644
--- a/src/library/playlistfeature.h
+++ b/src/library/playlistfeature.h
@@ -10,12 +10,14 @@
#include <QUrl>
#include <QObject>
#include <QPoint>
+#include <QPointer>
#include "library/baseplaylistfeature.h"
#include "preferences/usersettings.h"
class TrackCollection;
class TreeItem;
+class WLibrarySidebar;
class PlaylistFeature : public BasePlaylistFeature {
Q_OBJECT
@@ -27,6 +29,8 @@ class PlaylistFeature : public BasePlaylistFeature {
QVariant title();
QIcon getIcon();
+ void bindSidebarWidget(WLibrarySidebar* pSidebarWidget);
+
bool dropAcceptChild(const QModelIndex& index, QList<QUrl> urls, QObject* pSource);
bool dragMoveAcceptChild(const QModelIndex& index, QUrl url);
@@ -47,6 +51,7 @@ class PlaylistFeature : public BasePlaylistFeature {
private:
QString getRootViewHtml() const;
QIcon m_icon;
+ QPointer<WLibrarySidebar> m_pSidebarWidget;
};
#endif /* PLAYLISTFEATURE_H */
diff --git a/src/library/setlogfeature.cpp b/src/library/setlogfeature.cpp
index 47ac438740..7330747e45 100644
--- a/src/library/setlogfeature.cpp
+++ b/src/library/setlogfeature.cpp
@@ -12,6 +12,7 @@
#include "mixer/playermanager.h"
#include "widget/wtracktableview.h"
#include "widget/wlibrary.h"
+#include "widget/wlibrarysidebar.h"
SetlogFeature::SetlogFeature(QObject* parent,
UserSettingsPointer pConfig,
@@ -75,6 +76,11 @@ void SetlogFeature::bindLibraryWidget(WLibrary* libraryWidget,
}
+void SetlogFeature::bindSidebarWidget(WLibrarySidebar* pSidebarWidget) {
+ // store the sidebar widget pointer for later use in onRightClickChild
+ m_pSidebarWidget = pSidebarWidget;
+}
+
void SetlogFeature::onRightClick(const QPoint& globalPos) {
Q_UNUSED(globalPos);
m_lastRightClickedIndex = QModelIndex();
@@ -89,10 +95,10 @@ void SetlogFeature::onRightClick(const QPoint& globalPos) {
void SetlogFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index) {
//Save the model index so we can get it in the action slots...
m_lastRightClickedIndex = index;
+
QString playlistName = index.data().toString();
int playlistId = m_playlistDao.getPlaylistIdFromName(playlistName);
-
bool locked = m_playlistDao.isPlaylistLocked(playlistId);
m_pDeletePlaylistAction->setEnabled(!locked);
m_pRenamePlaylistAction->setEnabled(!locked);
@@ -100,13 +106,12 @@ void SetlogFeature::onRightClickChild(const QPoint& globalPos, QModelIndex index
m_pLockPlaylistAction->setText(locked ? tr("Unlock") : tr("Lock"));
-
- //Create the right-click menu
- QMenu menu(NULL);
+ QMenu menu(m_pSidebarWidget);
//menu.addAction(m_pCreatePlaylistAction);
//menu.addSeparator();
menu.addAction(m_pAddToAutoDJAction);
menu.addAction(m_pAddToAutoDJTopAction);
+ menu.addSeparator();
menu.addAction(m_pRenamePlaylistAction);
if (playlistId != m_playlistId) {
// Todays playlist should not be locked or deleted
diff --git a/src/library/setlogfeature.h b/src/library/setlogfeature.h
index 4e46d1abb1..1813e35f9d 100644
--- a/src/library/setlogfeature.h
+++ b/src/library/setlogfeature.h
@@ -6,12 +6,14 @@
#include <QLinkedList>
#include <QSqlTableModel>
#include <QAction>
+#include <QPointer>
#include "library/baseplaylistfeature.h"
#include "preferences/usersettings.h"
class TrackCollection;
class TreeItem;
+class WLibrarySidebar;
class SetlogFeature : public BasePlaylistFeature {
Q_OBJECT
@@ -25,6 +27,7 @@ public:
virtual void bindLibraryWidget(WLibrary* libraryWidget,
KeyboardEventFilter* keyboard);
+ virtual void bindSidebarWidget(WLibrarySidebar* pSidebarWidget);
public slots:
void onRightClick(const QPoint& globalPos);
@@ -51,6 +54,7 @@ public:
QAction* m_pGetNewPlaylist;
int m_playlistId;
WLibrary* m_libraryWidget;
+ QPointer<WLibrarySidebar> m_pSidebarWidget;
QIcon m_icon;
};