mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-27 14:12:34 +02:00
2022-09-14 Fred Gleason <fredg@paravelsystems.com>
* Rearranged data layout in the 'RDFeedListModel' class to aid code readability. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
32fa694cf8
commit
90fd7d0430
@ -23300,3 +23300,6 @@
|
||||
* Fixed a regression in rdlogedit(1) that caused the default setting
|
||||
of the 'Show Start Times As' dropdown in the 'Edit Log' dialog to
|
||||
fail to be preserved across instances.
|
||||
2022-09-14 Fred Gleason <fredg@paravelsystems.com>
|
||||
* Rearranged data layout in the 'RDFeedListModel' class to aid
|
||||
code readability.
|
||||
|
@ -350,13 +350,13 @@ QModelIndex RDFeedListModel::addFeed(const QString &keyname)
|
||||
}
|
||||
QList<QList<QVariant> > list_list;
|
||||
QList<unsigned> ids_list;
|
||||
list_list.push_back(list);
|
||||
d_icons.insert(offset,list);
|
||||
d_texts.insert(offset,list);
|
||||
d_key_names.insert(offset,keyname);
|
||||
d_feed_ids.insert(offset,0);
|
||||
d_texts.insert(offset,list);
|
||||
d_icons.insert(offset,list);
|
||||
list_list.push_back(list);
|
||||
d_cast_ids.insert(offset,ids_list);
|
||||
d_cast_icons.insert(offset,list);
|
||||
d_key_names.insert(offset,keyname);
|
||||
|
||||
QString sql=sqlFields()+
|
||||
"where "+
|
||||
@ -379,12 +379,12 @@ void RDFeedListModel::removeFeed(const QString &keyname)
|
||||
if(d_key_names.at(i)==keyname) {
|
||||
beginRemoveRows(QModelIndex(),i,i);
|
||||
|
||||
d_key_names.removeAt(i);
|
||||
d_feed_ids.removeAt(i);
|
||||
d_texts.removeAt(i);
|
||||
d_icons.removeAt(i);
|
||||
d_cast_ids.removeAt(i);
|
||||
d_cast_icons.removeAt(i);
|
||||
d_icons.removeAt(i);
|
||||
d_key_names.removeAt(i);
|
||||
|
||||
endRemoveRows();
|
||||
emit rowCountChanged(d_texts.size());
|
||||
@ -489,35 +489,35 @@ void RDFeedListModel::updateModel(const QString &filter_sql)
|
||||
"order by `FEEDS`.`KEY_NAME` asc, `PODCASTS`.`ORIGIN_DATETIME` desc";
|
||||
// printf("SQL: %s\n",sql.toUtf8().constData());
|
||||
beginResetModel();
|
||||
d_texts.clear();
|
||||
d_key_names.clear();
|
||||
d_feed_ids.clear();
|
||||
d_texts.clear();
|
||||
d_icons.clear();
|
||||
d_cast_ids.clear();
|
||||
d_cast_icons.clear();
|
||||
d_icons.clear();
|
||||
d_key_names.clear();
|
||||
|
||||
if(d_include_none) {
|
||||
d_feed_ids.push_back(0);
|
||||
d_texts.push_back(list);
|
||||
d_texts[0][0]=tr("[none]");
|
||||
d_icons.push_back(icons);
|
||||
d_key_names.push_back(QString());
|
||||
d_feed_ids.push_back(0);
|
||||
d_cast_texts.push_back(list_list);
|
||||
d_cast_ids.push_back(ids);
|
||||
d_cast_icons.push_back(list);
|
||||
d_icons.push_back(icons);
|
||||
d_cast_texts.push_back(list_list);
|
||||
}
|
||||
|
||||
QString prev_keyname;
|
||||
q=new RDSqlQuery(sql);
|
||||
while(q->next()) {
|
||||
if(q->value(0).toString()!=prev_keyname) {
|
||||
d_texts.push_back(list);
|
||||
d_key_names.push_back(QString());
|
||||
d_feed_ids.push_back(0);
|
||||
d_cast_texts.push_back(list_list);
|
||||
d_texts.push_back(list);
|
||||
d_icons.push_back(icons);
|
||||
d_cast_ids.push_back(ids);
|
||||
d_cast_icons.push_back(list);
|
||||
d_icons.push_back(icons);
|
||||
d_key_names.push_back(QString());
|
||||
d_cast_texts.push_back(list_list);
|
||||
updateRow(d_texts.size()-1,q);
|
||||
prev_keyname=q->value(0).toString();
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// Data model for Rivendell RSS feeds
|
||||
//
|
||||
// (C) Copyright 2021 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2021-2022 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@ -85,16 +85,21 @@ class RDFeedListModel : public QAbstractItemModel
|
||||
QFontMetrics *d_font_metrics;
|
||||
QFont d_bold_font;
|
||||
QFontMetrics *d_bold_font_metrics;
|
||||
// Column Data
|
||||
QList<QVariant> d_headers;
|
||||
QList<QVariant> d_alignments;
|
||||
|
||||
// Row Data
|
||||
QList<unsigned> d_feed_ids;
|
||||
QList<QList<QVariant> > d_texts;
|
||||
QList<QList<QVariant> > d_icons;
|
||||
QList<QList<QList<QVariant> > > d_cast_texts;
|
||||
QList<QList<unsigned> > d_cast_ids;
|
||||
QList<QList<QVariant> > d_cast_icons;
|
||||
QList<QVariant> d_alignments;
|
||||
QList<QVariant> d_background_colors;
|
||||
QStringList d_key_names;
|
||||
QList<unsigned> d_feed_ids;
|
||||
|
||||
// Z Data (episodes)
|
||||
QList<QList<QList<QVariant> > > d_cast_texts;
|
||||
|
||||
bool d_is_admin;
|
||||
bool d_include_none;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user