Playlist fixes
- Fix bug resetting playlist view columns to show all when using more than one playlist. - Add queue to play next
This commit is contained in:
@@ -80,7 +80,6 @@
|
||||
|
||||
using std::sort;
|
||||
|
||||
const int PlaylistView::kStateVersion = 6;
|
||||
const int PlaylistView::kGlowIntensitySteps = 24;
|
||||
const int PlaylistView::kAutoscrollGraceTimeout = 30; // seconds
|
||||
const int PlaylistView::kDropIndicatorWidth = 2;
|
||||
@@ -135,8 +134,8 @@ PlaylistView::PlaylistView(QWidget *parent)
|
||||
style_(new PlaylistProxyStyle(style())),
|
||||
playlist_(nullptr),
|
||||
header_(new PlaylistHeader(Qt::Horizontal, this, this)),
|
||||
initialized_(false),
|
||||
setting_initial_header_layout_(false),
|
||||
upgrading_from_qheaderview_(false),
|
||||
read_only_settings_(true),
|
||||
header_loaded_(false),
|
||||
background_initialized_(false),
|
||||
@@ -159,19 +158,18 @@ PlaylistView::PlaylistView(QWidget *parent)
|
||||
currenttrack_pause_(":/pictures/currenttrack_pause.png"),
|
||||
cached_current_row_row_(-1),
|
||||
drop_indicator_row_(-1),
|
||||
drag_over_(false)
|
||||
{
|
||||
drag_over_(false) {
|
||||
|
||||
setHeader(header_);
|
||||
header_->setSectionsMovable(true);
|
||||
setStyle(style_);
|
||||
setMouseTracking(true);
|
||||
|
||||
|
||||
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()));
|
||||
connect(header_, SIGNAL(SectionVisibilityChanged(int,bool)), SLOT(InvalidateCachedCurrentPixmap()));
|
||||
@@ -196,6 +194,8 @@ PlaylistView::PlaylistView(QWidget *parent)
|
||||
connect(fade_animation_, SIGNAL(valueChanged(qreal)), SLOT(FadePreviousBackgroundImage(qreal)));
|
||||
fade_animation_->setDirection(QTimeLine::Backward); // 1.0 -> 0.0
|
||||
|
||||
initialized_ = true;
|
||||
|
||||
}
|
||||
|
||||
PlaylistView::~PlaylistView() {
|
||||
@@ -253,7 +253,7 @@ void PlaylistView::SetPlaylist(Playlist *playlist) {
|
||||
}
|
||||
|
||||
playlist_ = playlist;
|
||||
if (!header_loaded_) LoadGeometry();
|
||||
LoadGeometry();
|
||||
ReloadSettings();
|
||||
setFocus();
|
||||
read_only_settings_ = false;
|
||||
@@ -285,7 +285,6 @@ void PlaylistView::setModel(QAbstractItemModel *m) {
|
||||
void PlaylistView::LoadGeometry() {
|
||||
|
||||
QSettings settings;
|
||||
header_loaded_ = true;
|
||||
settings.beginGroup(Playlist::kSettingsGroup);
|
||||
|
||||
QByteArray state(settings.value("state").toByteArray());
|
||||
@@ -317,7 +316,7 @@ void PlaylistView::LoadGeometry() {
|
||||
setting_initial_header_layout_ = true;
|
||||
}
|
||||
else {
|
||||
upgrading_from_qheaderview_ = true;
|
||||
setting_initial_header_layout_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,11 +332,13 @@ void PlaylistView::LoadGeometry() {
|
||||
header_->ShowSection(Playlist::Column_Title);
|
||||
}
|
||||
|
||||
header_loaded_ = true;
|
||||
|
||||
}
|
||||
|
||||
void PlaylistView::SaveGeometry() {
|
||||
|
||||
if (read_only_settings_) return;
|
||||
if (!initialized_ || read_only_settings_) return;
|
||||
|
||||
QSettings settings;
|
||||
settings.beginGroup(Playlist::kSettingsGroup);
|
||||
@@ -929,11 +930,10 @@ void PlaylistView::ReloadSettings() {
|
||||
glow_enabled_ = s.value("glow_effect", true).toBool();
|
||||
s.endGroup();
|
||||
|
||||
if (setting_initial_header_layout_ || upgrading_from_qheaderview_) {
|
||||
if (setting_initial_header_layout_) {
|
||||
s.beginGroup(Playlist::kSettingsGroup);
|
||||
header_->SetStretchEnabled(s.value("stretch", true).toBool());
|
||||
s.endGroup();
|
||||
upgrading_from_qheaderview_ = false;
|
||||
}
|
||||
|
||||
if (currently_glowing_ && glow_enabled_ && isVisible()) StartGlowing();
|
||||
@@ -1035,7 +1035,7 @@ void PlaylistView::ReloadSettings() {
|
||||
|
||||
void PlaylistView::SaveSettings() {
|
||||
|
||||
if (read_only_settings_) return;
|
||||
if (!initialized_ || read_only_settings_) return;
|
||||
|
||||
QSettings s;
|
||||
|
||||
@@ -1054,6 +1054,7 @@ void PlaylistView::SaveSettings() {
|
||||
}
|
||||
|
||||
void PlaylistView::StretchChanged(bool stretch) {
|
||||
if (!initialized_) return;
|
||||
setHorizontalScrollBarPolicy(stretch ? Qt::ScrollBarAlwaysOff : Qt::ScrollBarAsNeeded);
|
||||
SaveGeometry();
|
||||
}
|
||||
@@ -1084,17 +1085,17 @@ ColumnAlignmentMap PlaylistView::DefaultColumnAlignment() {
|
||||
|
||||
ColumnAlignmentMap ret;
|
||||
|
||||
ret[Playlist::Column_Length] =
|
||||
ret[Playlist::Column_Year] =
|
||||
ret[Playlist::Column_OriginalYear] =
|
||||
ret[Playlist::Column_Track] =
|
||||
ret[Playlist::Column_Disc] =
|
||||
ret[Playlist::Column_Year] =
|
||||
ret[Playlist::Column_Bitrate] =
|
||||
ret[Playlist::Column_Length] =
|
||||
ret[Playlist::Column_Samplerate] =
|
||||
ret[Playlist::Column_Bitdepth] =
|
||||
ret[Playlist::Column_Bitrate] =
|
||||
ret[Playlist::Column_Filesize] =
|
||||
ret[Playlist::Column_PlayCount] =
|
||||
ret[Playlist::Column_SkipCount] =
|
||||
ret[Playlist::Column_OriginalYear] =
|
||||
(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user