1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 19:31:02 +01:00

Add a Comment field to the playlist. Fixes issue #890

This commit is contained in:
David Sansome 2010-11-28 15:22:48 +00:00
parent 59875c9708
commit 31a6aa2de7
4 changed files with 17 additions and 1 deletions

View File

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

View File

@ -89,6 +89,8 @@ class Playlist : public QAbstractListModel {
Column_LastPlayed,
Column_Score,
Column_Comment,
ColumnCount
};

View File

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

View File

@ -36,7 +36,7 @@
#include <math.h>
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() {