summaryrefslogtreecommitdiffstats
path: root/playerwidget.cpp
diff options
context:
space:
mode:
authorArno <arno@disconnect.de>2017-02-26 13:24:55 +0100
committerArno <arno@disconnect.de>2017-02-26 13:24:55 +0100
commit707853a339a804c9fe90e8ce5b7743c131b75dc1 (patch)
treea469d6064a8964cda4432400a80f8e10025d8fa6 /playerwidget.cpp
parent231aa131e6ed86dafa3ff94b4ca7b6a0aa4773e4 (diff)
downloadBeetPlayer-707853a339a804c9fe90e8ce5b7743c131b75dc1.tar.gz
BeetPlayer-707853a339a804c9fe90e8ce5b7743c131b75dc1.tar.bz2
BeetPlayer-707853a339a804c9fe90e8ce5b7743c131b75dc1.zip
Artwork and GUI modifications
Added the necessary QActions. Except the ConfigAction they don't do anything yet, but they have nice icons :) I got rid of the menuBar(tm) and added a QToolBar to the center widget instead.
Diffstat (limited to 'playerwidget.cpp')
-rw-r--r--playerwidget.cpp41
1 files changed, 39 insertions, 2 deletions
diff --git a/playerwidget.cpp b/playerwidget.cpp
index 951100d..35f3c40 100644
--- a/playerwidget.cpp
+++ b/playerwidget.cpp
@@ -12,19 +12,25 @@
#include <QVBoxLayout>
#include <QSqlDatabase>
#include <QSqlQuery>
+#include <QAction>
+#include <QToolBar>
#include "playerwidget.h"
+#include "beetview.h"
+#include "globals.h"
PlayerWidget::PlayerWidget(QWidget *parent) : QWidget(parent){
setupGui();
+ createActions();
}
void PlayerWidget::setupGui(){
//THE view
- mView = new QTreeView;
+ mView = new BeetView;
mViewModel = new QStandardItemModel;
mView->setModel(mViewModel);
mSearchModel = new QStandardItemModel;
+ mView->setSelectionMode(QAbstractItemView::ExtendedSelection);
//filter
QGroupBox *filterGB = new QGroupBox(tr("Filter"));
@@ -68,6 +74,8 @@ void PlayerWidget::setupGui(){
//center widget
QWidget *centerWidget = new QWidget;
QVBoxLayout *centerWidgetL = new QVBoxLayout;
+ mToolBar = new QToolBar;
+ centerWidgetL->addWidget(mToolBar);
centerWidgetL->addWidget(mNowPlayingL);
centerWidgetL->addWidget(mSlider);
centerWidgetL->addWidget(currentInfoGB);
@@ -75,7 +83,7 @@ void PlayerWidget::setupGui(){
//playlist
mPlayListModel = new QStandardItemModel;
- mPlayListView = new QTreeView;
+ mPlayListView = new BeetView;
mPlayListView->setModel(mPlayListModel);
QGroupBox *playListGB = new QGroupBox(tr("Playlist"));
QVBoxLayout *playListL = new QVBoxLayout;
@@ -99,6 +107,35 @@ void PlayerWidget::setupGui(){
populate();
}
+void PlayerWidget::createActions(){
+ QAction *playA = new QAction(QIcon(":/play.png"), tr("Play"), this);
+ QAction *pauseA = new QAction(QIcon(":/pause.png"), tr("Pause"), this);
+ QAction *stopA = new QAction(QIcon(":/stop.png"), tr("Stop"), this);
+ QAction *addToPlayListA = new QAction(QIcon(":/belly_right.png"), tr("Add to playlist"), this);
+ QAction *removeFromPlayListA = new QAction(QIcon(":/belly_left.png"), tr("Remove from playlist"), this);
+ QAction *clearPlayListA = new QAction(QIcon(":/delete.png"), tr("Clear Playlist"), this);
+ QAction *configA = Globals::instance()->action(Globals::ConfigAction);
+ mView->addAction(addToPlayListA);
+ mView->addAction(removeFromPlayListA);
+ mPlayListView->addAction(removeFromPlayListA);
+ mPlayListView->addAction(clearPlayListA);
+ QWidget* spacer1 = new QWidget();
+ spacer1->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ mToolBar->addWidget(spacer1);
+ mToolBar->addAction(playA);
+ mToolBar->addAction(pauseA);
+ mToolBar->addAction(stopA);
+ mToolBar->addSeparator();
+ mToolBar->addAction(addToPlayListA);
+ mToolBar->addAction(removeFromPlayListA);
+ mToolBar->addAction(clearPlayListA);
+ mToolBar->addSeparator();
+ mToolBar->addAction(configA);
+ QWidget* spacer2 = new QWidget();
+ spacer2->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ mToolBar->addWidget(spacer2);
+}
+
void PlayerWidget::populateByArtist(QStandardItem *parent, const QString &filter){
QSqlDatabase db = QSqlDatabase::database("beetplayerdb");
QStandardItem *root = parent;