mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-05 14:28:40 +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_->IgnoreSorting(true);
|
||||
ui_.playlist->setModel(playlist_);
|
||||
playlist_->IgnoreSorting(false);
|
||||
|
||||
ui_.library_view->setModel(library_sort_model_);
|
||||
ui_.library_view->SetLibrary(library_);
|
||||
|
||||
|
@ -17,7 +17,7 @@ const char* Playlist::kSettingsGroup = "Playlist";
|
||||
Playlist::Playlist(QObject *parent) :
|
||||
QAbstractListModel(parent),
|
||||
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) {
|
||||
if (ignore_next_sort_) {
|
||||
ignore_next_sort_ = false;
|
||||
if (ignore_sorting_)
|
||||
return;
|
||||
}
|
||||
|
||||
layoutAboutToBeChanged();
|
||||
|
||||
|
@ -70,6 +70,7 @@ class Playlist : public QAbstractListModel {
|
||||
void Paused();
|
||||
void Playing();
|
||||
void Stopped();
|
||||
void IgnoreSorting(bool value) { ignore_sorting_ = value; }
|
||||
|
||||
private:
|
||||
void SetCurrentIsPaused(bool paused);
|
||||
@ -82,7 +83,7 @@ class Playlist : public QAbstractListModel {
|
||||
bool current_is_paused_;
|
||||
|
||||
// Hack to stop QTreeView::setModel sorting the playlist
|
||||
bool ignore_next_sort_;
|
||||
bool ignore_sorting_;
|
||||
};
|
||||
|
||||
#endif // PLAYLIST_H
|
||||
|
Loading…
Reference in New Issue
Block a user