summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--collectionwidget.cpp3
-rw-r--r--collectionwidget.h9
-rw-r--r--playerwidget.cpp11
3 files changed, 16 insertions, 7 deletions
diff --git a/collectionwidget.cpp b/collectionwidget.cpp
index af75520..0fda8c0 100644
--- a/collectionwidget.cpp
+++ b/collectionwidget.cpp
@@ -10,13 +10,14 @@
#include "collectionwidgetproxy.h"
CollectionWidget::CollectionWidget(QWidget *parent) : QWidget(parent){
- mView = new QTreeView;
+ mView = new BeetView;
mModel = new QStandardItemModel(this);
CollectionWidgetProxy *proxy = new CollectionWidgetProxy(this);
proxy->setSourceModel(mModel);
mView->setModel(proxy);
mView->setSortingEnabled(true);
mView->setAlternatingRowColors(true);
+ mView->setSelectionMode(QAbstractItemView::ExtendedSelection);
QGroupBox *filterGB = new QGroupBox(tr("Filter"));
QHBoxLayout *filterGBL = new QHBoxLayout;
mFilter = new QLineEdit;
diff --git a/collectionwidget.h b/collectionwidget.h
index 33799eb..bb85e49 100644
--- a/collectionwidget.h
+++ b/collectionwidget.h
@@ -2,7 +2,8 @@
#define COLLECTIONWIDGET_H
#include <QWidget>
-#include <QTreeView>
+
+#include "beetview.h"
class QStandardItemModel;
class QSortFilterProxyModel;
@@ -14,20 +15,18 @@ class CollectionWidget : public QWidget {
enum CustomRoles { TypeRole = Qt::UserRole + 1, IdRole = Qt::UserRole + 2, FullPathRole = Qt::UserRole + 3, GenreRole = Qt::UserRole + 4, ArtistRole = Qt::UserRole + 5, TitleRole = Qt::UserRole + 6, AlbumRole = Qt::UserRole + 7, LengthRole = Qt::UserRole + 8, UrlRole = Qt::UserRole + 9, RemoteRole = Qt::UserRole + 10 };
enum ItemType { Artist, Album, Song, Genre, WebRadio };
explicit CollectionWidget(QWidget *parent = nullptr);
- QTreeView *view() { return mView; }
+ BeetView *view() { return mView; }
QStandardItemModel *model() { return mModel; }
void setHeaders(const QStringList headers) { mHeaders = headers; }
const QStringList headers() const { return mHeaders; }
void disableSorting() { mView->setSortingEnabled(false); }
void enableSorting(int column = 0, Qt::SortOrder sortOrder = Qt::AscendingOrder);
- signals:
-
public slots:
virtual void populate() { return; }
private:
- QTreeView *mView;
+ BeetView *mView;
QStandardItemModel *mModel;
QLineEdit *mFilter;
QStringList mHeaders;
diff --git a/playerwidget.cpp b/playerwidget.cpp
index 9e5d699..e01014a 100644
--- a/playerwidget.cpp
+++ b/playerwidget.cpp
@@ -155,6 +155,15 @@ void PlayerWidget::setupGui(QSplashScreen *splash){
for(QAction *a : bottomTBG->actions()){
bottomTB->addAction(a);
}
+ for(int i = 0; i < mCollectionStack->count(); ++i){
+ CollectionWidget *curW = qobject_cast<CollectionWidget*>(mCollectionStack->widget(i));
+ QAction *addToPlayListA = new QAction(QIcon(":/belly_right.png"), tr("Add to playlist"), this);
+ connect(addToPlayListA, &QAction::triggered, this, &PlayerWidget::addToPlayList);
+ curW->view()->addAction(addToPlayListA);
+ QAction *addToPlayListAndClearA = new QAction(QIcon(":/belly_right_and_clear.png"), tr("Clear and add"), this);
+ connect(addToPlayListAndClearA, &QAction::triggered, this, &PlayerWidget::addToPlayListAndClear);
+ curW->view()->addAction(addToPlayListAndClearA);
+ }
//left widget
QWidget *leftWidget = new QWidget;
@@ -529,7 +538,7 @@ void PlayerWidget::setNowPlaying(const QString &what){
}
void PlayerWidget::recurse(const QModelIndex &parent){
- const QStandardItemModel *m = qobject_cast<const QStandardItemModel*>(parent.model());
+ const QAbstractItemModel *m = parent.model();
for(int i = 0; i < m->rowCount(parent); ++i){
QModelIndex cur = m->index(i, 0, parent);
int type = cur.data(TypeRole).toInt();