Refactor playlist view/header code
- Don't reload all settings when changing playlists - Fix initial playlist header columns sizes - Properly reset header state when resetting columns
This commit is contained in:
@@ -98,7 +98,7 @@ class PlaylistView : public QTreeView {
|
||||
|
||||
static ColumnAlignmentMap DefaultColumnAlignment();
|
||||
|
||||
void SetApplication(Application *app);
|
||||
void Init(Application *app);
|
||||
void SetItemDelegates();
|
||||
void SetPlaylist(Playlist *playlist);
|
||||
void RemoveSelected();
|
||||
@@ -109,14 +109,13 @@ class PlaylistView : public QTreeView {
|
||||
AppearanceSettingsPage::BackgroundImageType background_image_type() const { return background_image_type_; }
|
||||
Qt::Alignment column_alignment(int section) const;
|
||||
|
||||
void ResetColumns();
|
||||
void ResetHeaderState();
|
||||
|
||||
// QTreeView
|
||||
void setModel(QAbstractItemModel *model) override;
|
||||
|
||||
public slots:
|
||||
void ReloadSettings();
|
||||
void SaveGeometry();
|
||||
void SaveSettings();
|
||||
void SetColumnAlignment(const int section, const Qt::Alignment alignment);
|
||||
void JumpToCurrentlyPlayingTrack();
|
||||
@@ -163,6 +162,7 @@ class PlaylistView : public QTreeView {
|
||||
void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint) override;
|
||||
|
||||
private slots:
|
||||
void SetHeaderState();
|
||||
void InhibitAutoscrollTimeout();
|
||||
void MaybeAutoscroll(const Playlist::AutoScroll autoscroll);
|
||||
void InvalidateCachedCurrentPixmap();
|
||||
@@ -179,7 +179,9 @@ class PlaylistView : public QTreeView {
|
||||
void AlbumCoverLoaded(const Song &song, AlbumCoverLoaderResult result = AlbumCoverLoaderResult());
|
||||
|
||||
private:
|
||||
void LoadGeometry();
|
||||
void LoadHeaderState();
|
||||
void RestoreHeaderState();
|
||||
|
||||
void ReloadBarPixmaps();
|
||||
QList<QPixmap> LoadBarPixmap(const QString &filename);
|
||||
void UpdateCachedCurrentRowPixmap(QStyleOptionViewItem option, const QModelIndex &idx);
|
||||
@@ -219,11 +221,12 @@ class PlaylistView : public QTreeView {
|
||||
int blur_radius_;
|
||||
int opacity_level_;
|
||||
|
||||
bool initialized_;
|
||||
bool background_initialized_;
|
||||
bool setting_initial_header_layout_;
|
||||
bool set_initial_header_layout_;
|
||||
bool read_only_settings_;
|
||||
bool state_loaded_;
|
||||
bool header_state_loaded_;
|
||||
bool header_state_restored_;
|
||||
bool header_state_readonly_;
|
||||
|
||||
QImage background_image_;
|
||||
QImage current_song_cover_art_;
|
||||
@@ -272,10 +275,9 @@ class PlaylistView : public QTreeView {
|
||||
int drop_indicator_row_;
|
||||
bool drag_over_;
|
||||
|
||||
QByteArray header_state_;
|
||||
ColumnAlignmentMap column_alignment_;
|
||||
|
||||
QByteArray state_;
|
||||
|
||||
Song song_playing_;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user