Add button under playqueue to re-center playqueue on current song.
BUG: 472
This commit is contained in:
@@ -108,6 +108,7 @@
|
||||
libdbusmenu-qt https://bugs.launchpad.net/libdbusmenu-qt/+bug/1287337)
|
||||
(Qt-only builds)
|
||||
67. If connection to MPD faiils, attempt to ascertain if its a proxy error.
|
||||
68. Add button under playqueue to re-center playqueue on current song.
|
||||
|
||||
1.3.4
|
||||
-----
|
||||
|
||||
@@ -266,6 +266,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
cropPlayQueueAction = ActionCollection::get()->createAction("cropplaylist", i18n("Crop"));
|
||||
addStreamToPlayQueueAction = ActionCollection::get()->createAction("addstreamtoplayqueue", i18n("Add Stream URL"), menuIcons ? Icons::self()->addRadioStreamIcon : Icon());
|
||||
promptClearPlayQueueAction = ActionCollection::get()->createAction("clearplaylist", i18n("Clear"), Icons::self()->clearListIcon);
|
||||
centerPlayQueueAction = ActionCollection::get()->createAction("centerplaylist", i18n("Center On Current Track"), Qt::RightToLeft==layoutDirection() ? "go-previous" : "go-next");
|
||||
songInfoAction = ActionCollection::get()->createAction("showsonginfo", i18n("Show Current Song Information"), Icons::self()->infoIcon);
|
||||
songInfoAction->setShortcut(Qt::Key_F12);
|
||||
songInfoAction->setCheckable(true);
|
||||
@@ -328,10 +329,12 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
stopTrackButton->setPopupMode(QToolButton::DelayedPopup);
|
||||
|
||||
promptClearPlayQueueAction->setEnabled(false);
|
||||
centerPlayQueueAction->setEnabled(false);
|
||||
StdActions::self()->savePlayQueueAction->setEnabled(false);
|
||||
addStreamToPlayQueueAction->setEnabled(false);
|
||||
clearPlayQueueButton->setDefaultAction(promptClearPlayQueueAction);
|
||||
savePlayQueueButton->setDefaultAction(StdActions::self()->savePlayQueueAction);
|
||||
centerPlayQueueButton->setDefaultAction(centerPlayQueueAction);
|
||||
randomButton->setDefaultAction(randomPlayQueueAction);
|
||||
repeatButton->setDefaultAction(repeatPlayQueueAction);
|
||||
singleButton->setDefaultAction(singlePlayQueueAction);
|
||||
@@ -790,6 +793,7 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
connect(playQueue->removeFromAct(), SIGNAL(triggered(bool)), this, SLOT(removeFromPlayQueue()));
|
||||
connect(promptClearPlayQueueAction, SIGNAL(triggered(bool)), playQueueSearchWidget, SLOT(clear()));
|
||||
connect(promptClearPlayQueueAction, SIGNAL(triggered(bool)), this, SLOT(promptClearPlayQueue()));
|
||||
connect(centerPlayQueueAction, SIGNAL(triggered(bool)), this, SLOT(centerPlayQueue()));
|
||||
connect(cropPlayQueueAction, SIGNAL(triggered(bool)), this, SLOT(cropPlayQueue()));
|
||||
connect(songInfoAction, SIGNAL(triggered(bool)), this, SLOT(showSongInfo()));
|
||||
connect(fullScreenAction, SIGNAL(triggered(bool)), this, SLOT(fullScreen()));
|
||||
@@ -1633,6 +1637,7 @@ void MainWindow::updatePlayQueue(const QList<Song> &songs)
|
||||
StdActions::self()->prevTrackAction->setEnabled(StdActions::self()->stopPlaybackAction->isEnabled() && songs.count()>1);
|
||||
StdActions::self()->savePlayQueueAction->setEnabled(!songs.isEmpty());
|
||||
promptClearPlayQueueAction->setEnabled(!songs.isEmpty());
|
||||
centerPlayQueueAction->setEnabled(songs.count()>1);
|
||||
|
||||
int topRow=-1;
|
||||
QModelIndex topIndex=playQueueModel.lastCommandWasUnodOrRedo() ? playQueue->indexAt(QPoint(0, 0)) : QModelIndex();
|
||||
@@ -1877,6 +1882,18 @@ void MainWindow::clearPlayQueue()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::centerPlayQueue()
|
||||
{
|
||||
QModelIndex idx=playQueueProxyModel.mapFromSource(playQueueModel.index(playQueueModel.currentSongRow(), 0));
|
||||
if (idx.isValid()) {
|
||||
if (playQueue->isGrouped()) {
|
||||
playQueue->updateRows(idx.row(), current.key, true, true);
|
||||
} else {
|
||||
playQueue->scrollTo(idx, QAbstractItemView::PositionAtCenter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::addToPlayQueue(bool replace, quint8 priority, bool randomAlbums)
|
||||
{
|
||||
playQueueSearchWidget->clear();
|
||||
@@ -2486,7 +2503,6 @@ void MainWindow::controlPlaylistActions()
|
||||
StdActions::self()->addToStoredPlaylistAction->setVisible(enable);
|
||||
StdActions::self()->savePlayQueueAction->setVisible(enable);
|
||||
savePlayQueueButton->setVisible(enable);
|
||||
midSpacer->setVisible(enable);
|
||||
addPlayQueueToStoredPlaylistAction->setVisible(enable);
|
||||
}
|
||||
|
||||
|
||||
@@ -199,6 +199,7 @@ public Q_SLOTS:
|
||||
void playQueueItemActivated(const QModelIndex &);
|
||||
void promptClearPlayQueue();
|
||||
void clearPlayQueue();
|
||||
void centerPlayQueue();
|
||||
void removeFromPlayQueue() { playQueueModel.remove(playQueueProxyModel.mapToSourceRows(playQueue->selectedIndexes())); }
|
||||
void replacePlayQueue() { addToPlayQueue(true); }
|
||||
void addToPlayQueue() { addToPlayQueue(false); }
|
||||
@@ -317,6 +318,7 @@ private:
|
||||
Action *stopAfterTrackAction;
|
||||
Action *addPlayQueueToStoredPlaylistAction;
|
||||
Action *promptClearPlayQueueAction;
|
||||
Action *centerPlayQueueAction;
|
||||
Action *cropPlayQueueAction;
|
||||
Action *addStreamToPlayQueueAction;
|
||||
Action *randomPlayQueueAction;
|
||||
|
||||
@@ -313,6 +313,9 @@
|
||||
<item>
|
||||
<widget class="SpacerWidget" name="midSpacer" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ToolButton" name="centerPlayQueueButton"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="ToolButton" name="savePlayQueueButton"/>
|
||||
</item>
|
||||
|
||||
@@ -540,7 +540,7 @@ void GroupedView::setStartClosed(bool sc)
|
||||
}
|
||||
}
|
||||
|
||||
void GroupedView::updateRows(qint32 row, quint16 curAlbum, bool scroll, const QModelIndex &parent)
|
||||
void GroupedView::updateRows(qint32 row, quint16 curAlbum, bool scroll, const QModelIndex &parent, bool forceScroll)
|
||||
{
|
||||
currentAlbum=curAlbum;
|
||||
|
||||
@@ -560,7 +560,7 @@ void GroupedView::updateRows(qint32 row, quint16 curAlbum, bool scroll, const QM
|
||||
}
|
||||
|
||||
updateRows(parent);
|
||||
if (MPDState_Playing==MPDStatus::self()->state() && scroll) {
|
||||
if (scroll && (MPDState_Playing==MPDStatus::self()->state() || forceScroll)) {
|
||||
scrollTo(model()->index(row, 0, parent), QAbstractItemView::PositionAtCenter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public:
|
||||
void setStartClosed(bool sc);
|
||||
bool isStartClosed() const { return startClosed; }
|
||||
void setMultiLevel(bool ml) { isMultiLevel=ml; }
|
||||
void updateRows(qint32 row, quint16 curAlbum, bool scroll, const QModelIndex &parent=QModelIndex());
|
||||
void updateRows(qint32 row, quint16 curAlbum, bool scroll, const QModelIndex &parent=QModelIndex(), bool forceScroll=false);
|
||||
void updateCollectionRows();
|
||||
bool isCurrentAlbum(quint16 key) const { return key==currentAlbum; }
|
||||
bool isExpanded(quint16 key, quint32 collection) const { return filterActive ||
|
||||
|
||||
@@ -467,10 +467,10 @@ void PlayQueueView::setFilterActive(bool f)
|
||||
}
|
||||
}
|
||||
|
||||
void PlayQueueView::updateRows(qint32 row, quint16 curAlbum, bool scroll)
|
||||
void PlayQueueView::updateRows(qint32 row, quint16 curAlbum, bool scroll, bool forceScroll)
|
||||
{
|
||||
if (ItemView::Mode_GroupedTree==mode) {
|
||||
groupedView->updateRows(row, curAlbum, scroll);
|
||||
groupedView->updateRows(row, curAlbum, scroll, QModelIndex(), forceScroll);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ public:
|
||||
void setStartClosed(bool sc);
|
||||
bool isStartClosed() const;
|
||||
void setFilterActive(bool f);
|
||||
void updateRows(qint32 row, quint16 curAlbum, bool scroll);
|
||||
void updateRows(qint32 row, quint16 curAlbum, bool scroll, bool forceScroll=false);
|
||||
void scrollTo(const QModelIndex &index, QAbstractItemView::ScrollHint hint);
|
||||
QModelIndex indexAt(const QPoint &point);
|
||||
void setModel(QAbstractItemModel *m) { view()->setModel(m); }
|
||||
|
||||
Reference in New Issue
Block a user