diff options
author | Arno <arno@disconnect.de> | 2017-02-26 13:24:55 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-02-26 13:24:55 +0100 |
commit | 707853a339a804c9fe90e8ce5b7743c131b75dc1 (patch) | |
tree | a469d6064a8964cda4432400a80f8e10025d8fa6 | |
parent | 231aa131e6ed86dafa3ff94b4ca7b6a0aa4773e4 (diff) | |
download | BeetPlayer-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.
-rw-r--r-- | BeetPlayer.pro | 6 | ||||
-rw-r--r-- | beetplayer.cpp | 4 | ||||
-rw-r--r-- | beetplayer.qrc | 7 | ||||
-rw-r--r-- | beetview.cpp | 15 | ||||
-rw-r--r-- | beetview.h | 15 | ||||
-rw-r--r-- | belly_left.png | bin | 0 -> 8540 bytes | |||
-rw-r--r-- | belly_right.png | bin | 0 -> 8724 bytes | |||
-rwxr-xr-x | chastity_belt.png | bin | 0 -> 850 bytes | |||
-rwxr-xr-x | delete.png | bin | 0 -> 1333 bytes | |||
-rw-r--r-- | indexerwidget.cpp | 20 | ||||
-rw-r--r-- | indexerwidget.h | 2 | ||||
-rw-r--r-- | pause.png | bin | 0 -> 5951 bytes | |||
-rw-r--r-- | play.png | bin | 0 -> 4691 bytes | |||
-rw-r--r-- | playerwidget.cpp | 41 | ||||
-rw-r--r-- | playerwidget.h | 9 | ||||
-rw-r--r-- | stop.png | bin | 0 -> 8770 bytes |
16 files changed, 86 insertions, 33 deletions
diff --git a/BeetPlayer.pro b/BeetPlayer.pro index 5e319f0..0873852 100644 --- a/BeetPlayer.pro +++ b/BeetPlayer.pro @@ -28,13 +28,15 @@ SOURCES += main.cpp\ configurationdialog.cpp \ indexerwidget.cpp \ globals.cpp \ - playerwidget.cpp + playerwidget.cpp \ + beetview.cpp HEADERS += beetplayer.h \ configurationdialog.h \ indexerwidget.h \ globals.h \ - playerwidget.h + playerwidget.h \ + beetview.h LIBS += -ltag diff --git a/beetplayer.cpp b/beetplayer.cpp index c846c83..d2ed7d9 100644 --- a/beetplayer.cpp +++ b/beetplayer.cpp @@ -27,10 +27,6 @@ BeetPlayer::BeetPlayer(QWidget *parent, Qt::WindowFlags f) : QMainWindow(parent, mTab->addTab(player, tr("Player")); mTab->addTab(indexer, tr("Indexer")); connect(mTab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); - menuBar()->clear(); - foreach(QMenu* m, indexer->menus()){ - menuBar()->addMenu(m); - } //layout QHBoxLayout *mainLayout = new QHBoxLayout; diff --git a/beetplayer.qrc b/beetplayer.qrc index ff1e26f..690f619 100644 --- a/beetplayer.qrc +++ b/beetplayer.qrc @@ -1,5 +1,12 @@ <RCC> <qresource prefix="/"> <file>beetplayer32.png</file> + <file>belly_left.png</file> + <file>belly_right.png</file> + <file>pause.png</file> + <file>play.png</file> + <file>stop.png</file> + <file>chastity_belt.png</file> + <file>delete.png</file> </qresource> </RCC> diff --git a/beetview.cpp b/beetview.cpp new file mode 100644 index 0000000..acde916 --- /dev/null +++ b/beetview.cpp @@ -0,0 +1,15 @@ +#include <QMenu> +#include <QContextMenuEvent> + +#include "beetview.h" + +BeetView::BeetView(QWidget *parent) : QTreeView(parent) { +} + +void BeetView::contextMenuEvent(QContextMenuEvent *e){ + QMenu ctxMenu; + foreach(QAction *a, actions()){ + ctxMenu.addAction(a); + } + ctxMenu.exec(e->globalPos()); +} diff --git a/beetview.h b/beetview.h new file mode 100644 index 0000000..763dc8e --- /dev/null +++ b/beetview.h @@ -0,0 +1,15 @@ +#ifndef BEETVIEW_H +#define BEETVIEW_H + +#include <QTreeView> + +class BeetView : public QTreeView { + Q_OBJECT + public: + explicit BeetView(QWidget *parent = 0); + + protected: + virtual void contextMenuEvent(QContextMenuEvent *e); +}; + +#endif // BEETVIEW_H diff --git a/belly_left.png b/belly_left.png Binary files differnew file mode 100644 index 0000000..5fed4a0 --- /dev/null +++ b/belly_left.png diff --git a/belly_right.png b/belly_right.png Binary files differnew file mode 100644 index 0000000..3e93aa2 --- /dev/null +++ b/belly_right.png diff --git a/chastity_belt.png b/chastity_belt.png Binary files differnew file mode 100755 index 0000000..ebe3390 --- /dev/null +++ b/chastity_belt.png diff --git a/delete.png b/delete.png Binary files differnew file mode 100755 index 0000000..351659b --- /dev/null +++ b/delete.png diff --git a/indexerwidget.cpp b/indexerwidget.cpp index e1643fa..c5c8bda 100644 --- a/indexerwidget.cpp +++ b/indexerwidget.cpp @@ -32,9 +32,6 @@ IndexerWidget::IndexerWidget(QWidget *parent) : QWidget(parent) { connect(mReader, SIGNAL(message(QString)), this, SLOT(addToLog(QString))); connect(mReader, SIGNAL(errorMsg(QString)), this, SLOT(addToError(QString))); - //misc - createMenus(); - //layout QVBoxLayout *mainLayout = new QVBoxLayout; QHBoxLayout *buttonLayout = new QHBoxLayout; @@ -66,23 +63,6 @@ void IndexerWidget::addToError(QString msg){ mError->append(msg); } -void IndexerWidget::createMenus(){ - QMenu *fileMenu = new QMenu(tr("&File")); - mStartIndexingA = new QAction(tr("&Start indexing"), this); - connect(mStartIndexingA, SIGNAL(triggered()), this, SLOT(startIndexing())); - fileMenu->addAction(mStartIndexingA); - mStopIndexingA = new QAction(tr("Sto&p indexing"), this); - connect(mStopIndexingA, SIGNAL(triggered()), this, SLOT(stopIndexing())); - fileMenu->addAction(mStopIndexingA); - fileMenu->addSeparator(); - fileMenu->addAction(Globals::instance()->action(Globals::QuitAction)); - mMenus.append(fileMenu); - QMenu *editMenu = new QMenu(tr("&Edit")); - editMenu->addAction(Globals::instance()->action(Globals::ConfigAction)); - mMenus.append(editMenu); -} - - BeetReader::BeetReader() : mCanceled(false){ mDb = QSqlDatabase::database("beetplayerdb"); mInsertArtistsQ = new QSqlQuery(mDb); diff --git a/indexerwidget.h b/indexerwidget.h index 64e1343..0f43266 100644 --- a/indexerwidget.h +++ b/indexerwidget.h @@ -19,7 +19,6 @@ class IndexerWidget : public QWidget { Q_OBJECT public: explicit IndexerWidget(QWidget *parent = 0); - QVector<QMenu*> menus() { return mMenus; } public slots: void startIndexing(); @@ -28,7 +27,6 @@ class IndexerWidget : public QWidget { void addToError(QString msg); private: - void createMenus(); QTextEdit *mLog; QTextEdit *mError; QVector<QMenu*> mMenus; diff --git a/pause.png b/pause.png Binary files differnew file mode 100644 index 0000000..cb44d0d --- /dev/null +++ b/pause.png diff --git a/play.png b/play.png Binary files differnew file mode 100644 index 0000000..3f6a373 --- /dev/null +++ b/play.png 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; diff --git a/playerwidget.h b/playerwidget.h index 5a6ff95..22cd2c5 100644 --- a/playerwidget.h +++ b/playerwidget.h @@ -3,7 +3,6 @@ #include <QWidget> -class QTreeView; class QStandardItemModel; class QStandardItem; class QLineEdit; @@ -11,7 +10,9 @@ class QLabel; class QSlider; class QTextEdit; class QMediaPlayer; +class QToolBar; class BeetPlayerProxy; +class BeetView; class PlayerWidget : public QWidget { Q_OBJECT @@ -27,19 +28,21 @@ class PlayerWidget : public QWidget { private: void setupGui(); + void createActions(); void populateByArtist(QStandardItem *parent, const QString &filter); void populateBySong(QStandardItem *parent, const QString &filter); void populateByGenre(QStandardItem *parent, const QString &filter); QLineEdit *mFilter; QMediaPlayer *mPlayer; - QTreeView *mView; + BeetView *mView; QStandardItemModel *mViewModel; QStandardItemModel *mSearchModel; QLabel *mNowPlayingL; QSlider *mSlider; QTextEdit *mCurrentTE; - QTreeView *mPlayListView; + BeetView *mPlayListView; QStandardItemModel *mPlayListModel; + QToolBar *mToolBar; }; #endif // PLAYERWIDGET_H diff --git a/stop.png b/stop.png Binary files differnew file mode 100644 index 0000000..86bfbf7 --- /dev/null +++ b/stop.png |