Save the state of the playlist column sort marker

Fixes issue 2098
This commit is contained in:
David Sansome 2011-07-25 16:53:58 +01:00
parent f599c0fca7
commit 3eb9aee989
2 changed files with 10 additions and 1 deletions

View File

@ -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()));

View File

@ -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;
}