summaryrefslogtreecommitdiffstats
path: root/src/library/browse
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/browse
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/browse')
-rw-r--r--src/library/browse/browsefeature.cpp8
-rw-r--r--src/library/browse/browsefeature.h3
2 files changed, 10 insertions, 1 deletions
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