mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-17 20:09:50 +01:00
Save the state of the playlist column sort marker
Fixes issue 2098
This commit is contained in:
parent
f599c0fca7
commit
3eb9aee989
@ -111,6 +111,7 @@ PlaylistView::PlaylistView(QWidget *parent)
|
||||
|
||||
connect(header_, SIGNAL(sectionResized(int,int,int)), SLOT(SaveGeometry()));
|
||||
connect(header_, SIGNAL(sectionMoved(int,int,int)), SLOT(SaveGeometry()));
|
||||
connect(header_, SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)), SLOT(SaveGeometry()));
|
||||
connect(header_, SIGNAL(SectionVisibilityChanged(int,bool)), SLOT(SaveGeometry()));
|
||||
connect(header_, SIGNAL(sectionResized(int,int,int)), SLOT(InvalidateCachedCurrentPixmap()));
|
||||
connect(header_, SIGNAL(sectionMoved(int,int,int)), SLOT(InvalidateCachedCurrentPixmap()));
|
||||
@ -166,7 +167,7 @@ void PlaylistView::SetItemDelegates(LibraryBackend* backend) {
|
||||
setItemDelegateForColumn(Playlist::Column_LastPlayed, new LastPlayedItemDelegate(this));
|
||||
}
|
||||
|
||||
void PlaylistView::SetPlaylist(Playlist *playlist) {
|
||||
void PlaylistView::SetPlaylist(Playlist* playlist) {
|
||||
if (playlist_) {
|
||||
disconnect(playlist_, SIGNAL(CurrentSongChanged(Song)),
|
||||
this, SLOT(MaybeAutoscroll()));
|
||||
|
@ -245,11 +245,17 @@ bool StretchHeaderView::RestoreState(const QByteArray& data) {
|
||||
|
||||
QList<int> pixel_widths;
|
||||
QList<int> visual_indices;
|
||||
int sort_indicator_order = Qt::AscendingOrder;
|
||||
int sort_indicator_section = 0;
|
||||
|
||||
s >> stretch_enabled_;
|
||||
s >> pixel_widths;
|
||||
s >> visual_indices;
|
||||
s >> column_widths_;
|
||||
s >> sort_indicator_order;
|
||||
s >> sort_indicator_section;
|
||||
|
||||
setSortIndicator(sort_indicator_section, Qt::SortOrder(sort_indicator_order));
|
||||
|
||||
const int persisted_column_count =
|
||||
qMin(qMin(visual_indices.count(), pixel_widths.count()), column_widths_.count());
|
||||
@ -295,6 +301,8 @@ QByteArray StretchHeaderView::SaveState() const {
|
||||
s << pixel_widths;
|
||||
s << visual_indices;
|
||||
s << column_widths_;
|
||||
s << int(sortIndicatorOrder());
|
||||
s << sortIndicatorSection();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user