mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-08 08:11:36 +01:00
Don't resort the playlist when reloading
This commit is contained in:
parent
9430a8fd2f
commit
bd30d815d1
@ -45,7 +45,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
|
|
||||||
playlist_->Restore();
|
playlist_->Restore();
|
||||||
|
|
||||||
|
playlist_->IgnoreSorting(true);
|
||||||
ui_.playlist->setModel(playlist_);
|
ui_.playlist->setModel(playlist_);
|
||||||
|
playlist_->IgnoreSorting(false);
|
||||||
|
|
||||||
ui_.library_view->setModel(library_sort_model_);
|
ui_.library_view->setModel(library_sort_model_);
|
||||||
ui_.library_view->SetLibrary(library_);
|
ui_.library_view->SetLibrary(library_);
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ const char* Playlist::kSettingsGroup = "Playlist";
|
|||||||
Playlist::Playlist(QObject *parent) :
|
Playlist::Playlist(QObject *parent) :
|
||||||
QAbstractListModel(parent),
|
QAbstractListModel(parent),
|
||||||
current_is_paused_(false),
|
current_is_paused_(false),
|
||||||
ignore_next_sort_(true)
|
ignore_sorting_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -273,10 +273,8 @@ bool Playlist::CompareItems(int column, Qt::SortOrder order,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Playlist::sort(int column, Qt::SortOrder order) {
|
void Playlist::sort(int column, Qt::SortOrder order) {
|
||||||
if (ignore_next_sort_) {
|
if (ignore_sorting_)
|
||||||
ignore_next_sort_ = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
layoutAboutToBeChanged();
|
layoutAboutToBeChanged();
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ class Playlist : public QAbstractListModel {
|
|||||||
void Paused();
|
void Paused();
|
||||||
void Playing();
|
void Playing();
|
||||||
void Stopped();
|
void Stopped();
|
||||||
|
void IgnoreSorting(bool value) { ignore_sorting_ = value; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetCurrentIsPaused(bool paused);
|
void SetCurrentIsPaused(bool paused);
|
||||||
@ -82,7 +83,7 @@ class Playlist : public QAbstractListModel {
|
|||||||
bool current_is_paused_;
|
bool current_is_paused_;
|
||||||
|
|
||||||
// Hack to stop QTreeView::setModel sorting the playlist
|
// Hack to stop QTreeView::setModel sorting the playlist
|
||||||
bool ignore_next_sort_;
|
bool ignore_sorting_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PLAYLIST_H
|
#endif // PLAYLIST_H
|
||||||
|
Loading…
Reference in New Issue
Block a user