1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 11:19:18 +01:00

Make F2 edit the first playlist column again after the cursor has been moved. Fixes issue #939

This commit is contained in:
David Sansome 2010-11-28 15:14:48 +00:00
parent 96a45bb0ca
commit 59875c9708
4 changed files with 21 additions and 0 deletions

View File

@ -164,6 +164,7 @@ void PlaylistContainer::SetViewModel(Playlist* playlist) {
connect(view()->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(SelectionChanged()));
emit ViewSelectionModelChanged();
// Update filter
filter_->setText(playlist->proxy()->filterRegExp().pattern());

View File

@ -52,6 +52,7 @@ signals:
void Remove(int id);
void UndoRedoActionsChanged(QAction* undo, QAction* redo);
void ViewSelectionModelChanged();
protected:
// QWidget

View File

@ -217,6 +217,7 @@ MainWindow::MainWindow(Engine::Type engine, QWidget *parent)
library_sort_model_->setDynamicSortFilter(true);
library_sort_model_->sort(0);
connect(ui_->playlist, SIGNAL(ViewSelectionModelChanged()), SLOT(PlaylistViewSelectionModelChanged()));
ui_->playlist->SetManager(playlists_);
library_view_->view()->setModel(library_sort_model_);
@ -1665,3 +1666,19 @@ void MainWindow::ConnectInfoView(SongInfoBase* view) {
void MainWindow::ShowSongInfoConfig() {
OpenSettingsDialogAtPage(SettingsDialog::Page_SongInformation);
}
void MainWindow::PlaylistViewSelectionModelChanged() {
connect(ui_->playlist->view()->selectionModel(),
SIGNAL(currentChanged(QModelIndex,QModelIndex)),
SLOT(PlaylistCurrentChanged(QModelIndex)));
}
void MainWindow::PlaylistCurrentChanged(const QModelIndex& proxy_current) {
const QModelIndex source_current =
playlists_->current()->proxy()->mapToSource(proxy_current);
// If the user moves the current index using the keyboard and then presses
// F2, we don't want that editing the last column that was right clicked on.
if (source_current != playlist_menu_index_)
playlist_menu_index_ = QModelIndex();
}

View File

@ -109,6 +109,8 @@ class MainWindow : public QMainWindow, public PlatformInterface {
void ForceShowOSD(const Song& song);
void PlaylistRightClick(const QPoint& global_pos, const QModelIndex& index);
void PlaylistCurrentChanged(const QModelIndex& current);
void PlaylistViewSelectionModelChanged();
void PlaylistPlay();
void PlaylistStopAfter();
void PlaylistQueue();