@@ -111,15 +111,38 @@ void BaseTrackTableModel::setKeyColorPalette(const ColorPalette& palette) {
111111bool BaseTrackTableModel::s_bApplyPlayedTrackColor =
112112 kApplyPlayedTrackColorDefault ;
113113
114+ // static
114115void BaseTrackTableModel::setApplyPlayedTrackColor (bool apply) {
115116 s_bApplyPlayedTrackColor = apply;
116117}
117118
118119const QString BaseTrackTableModel::kDateFormatDefault = QString();
119120QString BaseTrackTableModel::s_dateFormat = BaseTrackTableModel::kDateFormatDefault ;
120121
122+ // static
121123void BaseTrackTableModel::setDateFormat (const QString& format) {
122124 s_dateFormat = format;
125+ emit broadcaster ()->dateFormatChanged ();
126+ }
127+
128+ void BaseTrackTableModel::slotEmitDataChangedForDateColumns () {
129+ // Notify the view to update.
130+ // These are the columns that use s_dateFormat
131+ QList<int > columns;
132+ columns.append (fieldIndex (ColumnCache::COLUMN_LIBRARYTABLE_DATETIMEADDED ));
133+ columns.append (fieldIndex (ColumnCache::COLUMN_PLAYLISTTRACKSTABLE_DATETIMEADDED ));
134+ columns.append (fieldIndex (ColumnCache::COLUMN_LIBRARYTABLE_LAST_PLAYED_AT ));
135+ const QVector<int > roles{Qt::DisplayRole};
136+ QModelIndex topLeft;
137+ QModelIndex bottomRight;
138+ for (int i : columns) {
139+ if (i == -1 ) {
140+ continue ;
141+ }
142+ topLeft = index (0 , i);
143+ bottomRight = index (rowCount () - 1 , i);
144+ emit dataChanged (topLeft, bottomRight, roles);
145+ }
123146}
124147
125148BaseTrackTableModel::BaseTrackTableModel (
@@ -148,6 +171,10 @@ BaseTrackTableModel::BaseTrackTableModel(
148171 this ,
149172 &BaseTrackTableModel::slotCoverFound);
150173 }
174+ connect (broadcaster (),
175+ &DateFormatChangedBroadcaster::dateFormatChanged,
176+ this ,
177+ &BaseTrackTableModel::slotEmitDataChangedForDateColumns);
151178}
152179
153180void BaseTrackTableModel::initTableColumnsAndHeaderProperties (
0 commit comments