diff --git a/src/playlist/playlist.cpp b/src/playlist/playlist.cpp index 5c4e6c3f6..a4af079c9 100644 --- a/src/playlist/playlist.cpp +++ b/src/playlist/playlist.cpp @@ -140,6 +140,7 @@ bool Playlist::column_is_editable(Playlist::Column column) { case Column_Year: case Column_Genre: case Column_Score: + case Column_Comment: return true; default: break; @@ -183,6 +184,10 @@ bool Playlist::set_column_value(Song& song, Playlist::Column column, break; case Column_Score: song.set_score(value.toInt()); + break; + case Column_Comment: + song.set_comment(value.toString()); + break; default: break; } @@ -246,6 +251,7 @@ QVariant Playlist::data(const QModelIndex& index, int role) const { case Column_Filetype: return song.filetype(); case Column_DateModified: return song.mtime(); case Column_DateCreated: return song.ctime(); + case Column_Comment: return song.comment(); } } @@ -893,6 +899,8 @@ bool Playlist::CompareItems(int column, Qt::SortOrder order, case Column_Filetype: cmp(filetype); case Column_DateModified: cmp(mtime); case Column_DateCreated: cmp(ctime); + + case Column_Comment: strcmp(comment); } #undef cmp @@ -929,6 +937,8 @@ QString Playlist::column_name(Column column) { case Column_Filetype: return tr("File type"); case Column_DateModified: return tr("Date modified"); case Column_DateCreated: return tr("Date created"); + + case Column_Comment: return tr("Comment"); default: return QString(); } return ""; diff --git a/src/playlist/playlist.h b/src/playlist/playlist.h index bdb6a5e86..1c5f6e20f 100644 --- a/src/playlist/playlist.h +++ b/src/playlist/playlist.h @@ -89,6 +89,8 @@ class Playlist : public QAbstractListModel { Column_LastPlayed, Column_Score, + Column_Comment, + ColumnCount }; diff --git a/src/playlist/playlistfilter.cpp b/src/playlist/playlistfilter.cpp index ba8cf19cf..512bd32c2 100644 --- a/src/playlist/playlistfilter.cpp +++ b/src/playlist/playlistfilter.cpp @@ -37,6 +37,7 @@ PlaylistFilter::PlaylistFilter(QObject *parent) column_names_["year"] = Playlist::Column_Year; column_names_["genre"] = Playlist::Column_Genre; column_names_["score"] = Playlist::Column_Score; + column_names_["comment"] = Playlist::Column_Comment; exact_columns_ << Playlist::Column_Length << Playlist::Column_Track diff --git a/src/playlist/playlistview.cpp b/src/playlist/playlistview.cpp index c19e04a53..848d0545d 100644 --- a/src/playlist/playlistview.cpp +++ b/src/playlist/playlistview.cpp @@ -36,7 +36,7 @@ #include const char* PlaylistView::kSettingsGroup = "Playlist"; -const int PlaylistView::kStateVersion = 2; +const int PlaylistView::kStateVersion = 3; const int PlaylistView::kGlowIntensitySteps = 24; const int PlaylistView::kAutoscrollGraceTimeout = 60; // seconds const int PlaylistView::kDropIndicatorWidth = 2; @@ -221,6 +221,9 @@ void PlaylistView::LoadGeometry() { if (state_version < 2) { header_->HideSection(Playlist::Column_Score); } + if (state_version < 3) { + header_->HideSection(Playlist::Column_Comment); + } } void PlaylistView::SaveGeometry() {