diff options
author | Arno <arno@disconnect.de> | 2017-05-05 21:33:42 +0200 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2017-05-05 21:33:42 +0200 |
commit | 3ded08ff5b68d5a66a0032d85480ede7dd07dcab (patch) | |
tree | 6ab7968ef486f7c0f2c0d30a1abecb885d55b197 /playerwidget.cpp | |
parent | f942c5c9e1fe6d8d1fdddb3f5864251f11dd4818 (diff) | |
download | BeetPlayer-3ded08ff5b68d5a66a0032d85480ede7dd07dcab.tar.gz BeetPlayer-3ded08ff5b68d5a66a0032d85480ede7dd07dcab.tar.bz2 BeetPlayer-3ded08ff5b68d5a66a0032d85480ede7dd07dcab.zip |
Display properties of selection
either left or right. Worked immediately. There have to be subtle bugs
or something. Cannot believe that it's bug free!
Diffstat (limited to 'playerwidget.cpp')
-rw-r--r-- | playerwidget.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/playerwidget.cpp b/playerwidget.cpp index 78b2531..f34725a 100644 --- a/playerwidget.cpp +++ b/playerwidget.cpp @@ -69,6 +69,7 @@ void PlayerWidget::setupGui(){ mSearchModel = new QStandardItemModel; mView->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(mView, &BeetView::doubleClicked, this, &PlayerWidget::viewDoubleClicked); + connect(mView->selectionModel(), &QItemSelectionModel::currentChanged, this, &PlayerWidget::leftCurrentChanged); mFolderModel = new QStandardItemModel; mCurrentModel = mViewModel; QToolBar *viewTB = new QToolBar; @@ -258,6 +259,7 @@ void PlayerWidget::setupGui(){ mPlayListView->setRootIsDecorated(false); mPlayListView->setSelectionMode(QAbstractItemView::ExtendedSelection); connect(mPlayListView, &BeetView::doubleClicked, this, &PlayerWidget::playCurrent); + connect(mPlayListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &PlayerWidget::rightCurrentChanged); QGroupBox *playListGB = new QGroupBox(tr("Playlist")); QVBoxLayout *playListL = new QVBoxLayout; playListL->addWidget(mPlayListView); @@ -751,6 +753,20 @@ void PlayerWidget::viewDoubleClicked(const QModelIndex &idx){ } } +void PlayerWidget::leftCurrentChanged(const QModelIndex &cur, const QModelIndex &prev){ + Q_UNUSED(prev) + QString fullPath(cur.data(FullPathRole).toString()); + TagLib::FileRef file(QString(fullPath).toUtf8()); + fillWithText(mLeftTE, file); +} + +void PlayerWidget::rightCurrentChanged(const QModelIndex &cur, const QModelIndex &prev){ + Q_UNUSED(prev) + QString fullPath(cur.data(FullPathRole).toString()); + TagLib::FileRef file(QString(fullPath).toUtf8()); + fillWithText(mRightTE, file); +} + void PlayerWidget::doPlay(){ if(mPlayer->state() == QMediaPlayer::PausedState){ mPlayer->play(); @@ -885,6 +901,9 @@ void PlayerWidget::adjustVolume(int by){ } void PlayerWidget::fillWithText(QTextEdit *te, const TagLib::FileRef &fr){ + if(fr.isNull()){ + return; + } QString artist = QString::fromStdWString(fr.tag()->artist().toWString()); QString album = QString::fromStdWString(fr.tag()->album().toWString()); QString title = QString::fromStdWString(fr.tag()->title().toWString()); |