2020-07-02 Fred Gleason <fredg@paravelsystems.com>

* Added a 'RDApplication::rssSchemas()' method.
	* Removed the 'RDFeed::rssSchemas()' method.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2020-07-02 19:04:10 -04:00
parent 55edded09a
commit eded76eed9
8 changed files with 27 additions and 36 deletions

View File

@ -20080,3 +20080,6 @@
* Added support for iTunes subcategories to the podcast subsystem.
2020-07-02 Fred Gleason <fredg@paravelsystems.com>
* Added a 'RDRssSchemas::supportsItemCategories()' method.
2020-07-02 Fred Gleason <fredg@paravelsystems.com>
* Added a 'RDApplication::rssSchemas()' method.
* Removed the 'RDFeed::rssSchemas()' method.

View File

@ -191,6 +191,7 @@ bool RDApplication::open(QString *err_msg,RDApplication::ErrorType *err_type,
//
app_station=new RDStation(app_config->stationName());
app_system=new RDSystem();
app_schemas=new RDRssSchemas();
app_library_conf=new RDLibraryConf(app_config->stationName());
app_logedit_conf=new RDLogeditConf(app_config->stationName());
app_airplay_conf=new RDAirPlayConf(app_config->stationName(),"RDAIRPLAY");
@ -262,6 +263,12 @@ RDRipc *RDApplication::ripc()
}
RDRssSchemas *RDApplication::rssSchemas()
{
return app_schemas;
}
RDStation *RDApplication::station()
{
return app_station;

View File

@ -36,6 +36,7 @@
#include <rdlibrary_conf.h>
#include <rdlogedit_conf.h>
#include <rdripc.h>
#include <rdrssschemas.h>
#include <rdstation.h>
#include <rdsystem.h>
#include <rduser.h>
@ -58,10 +59,10 @@ class RDApplication : public QObject
RDLogeditConf *logeditConf();
RDAirPlayConf *panelConf();
RDRipc *ripc();
RDRssSchemas *rssSchemas();
RDStation *station();
RDSystem *system();
RDUser *user();
// void log(RDConfig::LogPriority prio,const QString &msg);
bool dropTable(const QString &tbl_name);
void addTempFile(const QString &pathname);
void syslog(int priority,const char *fmt,...) const;
@ -83,6 +84,7 @@ class RDApplication : public QObject
RDLibraryConf *app_library_conf;
RDLogeditConf *app_logedit_conf;
RDRipc *app_ripc;
RDRssSchemas *app_schemas;
RDStation *app_station;
RDSystem *app_system;
RDUser *app_user;

View File

@ -60,6 +60,7 @@ size_t __RDFeed_Readfunction_Callback(char *buffer,size_t size,size_t nitems,
return curlsize;
}
RDFeed::RDFeed(const QString &keyname,RDConfig *config,QObject *parent)
: QObject(parent)
{
@ -69,8 +70,6 @@ RDFeed::RDFeed(const QString &keyname,RDConfig *config,QObject *parent)
feed_keyname=keyname;
feed_config=config;
feed_schemas=new RDRssSchemas();
sql=QString("select ID from FEEDS where ")+
"KEY_NAME=\""+RDEscapeString(keyname)+"\"";
q=new RDSqlQuery(sql);
@ -97,8 +96,6 @@ RDFeed::RDFeed(unsigned id,RDConfig *config,QObject *parent)
feed_id=id;
feed_config=config;
feed_schemas=new RDRssSchemas();
sql=QString().sprintf("select KEY_NAME from FEEDS where ID=%u",id);
q=new RDSqlQuery(sql);
if(q->first()) {
@ -108,12 +105,6 @@ RDFeed::RDFeed(unsigned id,RDConfig *config,QObject *parent)
}
RDFeed::~RDFeed()
{
delete feed_schemas;
}
bool RDFeed::exists() const
{
return RDDoesRowExist("FEEDS","KEY_NAME",feed_keyname);
@ -744,8 +735,8 @@ int RDFeed::importImageFile(const QString &pathname,QString *err_msg,
bool ok=false;
QString sql;
int ret;
QSize min=rssSchemas()->minimumImageSize(rssSchema());
QSize max=rssSchemas()->maximumImageSize(rssSchema());
QSize min=rda->rssSchemas()->minimumImageSize(rssSchema());
QSize max=rda->rssSchemas()->maximumImageSize(rssSchema());
*err_msg="OK";
//
@ -1338,9 +1329,9 @@ QString RDFeed::rssXml(QString *err_msg,bool *ok)
//
// Load the XML Templates
//
QString header_template=rssSchemas()->headerTemplate(rssSchema());
QString channel_template=rssSchemas()->channelTemplate(rssSchema());
QString item_template=rssSchemas()->itemTemplate(rssSchema());
QString header_template=rda->rssSchemas()->headerTemplate(rssSchema());
QString channel_template=rda->rssSchemas()->channelTemplate(rssSchema());
QString item_template=rda->rssSchemas()->itemTemplate(rssSchema());
if(rssSchema()==RDRssSchemas::CustomSchema) {
header_template=chan_q->value(15).toString();
channel_template=chan_q->value(16).toString();
@ -1432,12 +1423,6 @@ QString RDFeed::rssXml(QString *err_msg,bool *ok)
}
RDRssSchemas *RDFeed::rssSchemas() const
{
return feed_schemas;
}
unsigned RDFeed::create(const QString &keyname,bool enable_users,
QString *err_msg)
{

View File

@ -42,7 +42,6 @@ class RDFeed : public QObject
enum MediaLinkMode {LinkNone=0,LinkDirect=1,LinkCounted=2};
RDFeed(const QString &keyname,RDConfig *config,QObject *parent=0);
RDFeed(unsigned id,RDConfig *config,QObject *parent=0);
~RDFeed();
QString keyName() const;
unsigned id() const;
bool exists() const;
@ -151,7 +150,6 @@ class RDFeed : public QObject
Error *err,bool log_debug,RDConfig *config);
int totalPostSteps() const;
QString rssXml(QString *err_msg,bool *ok=NULL);
RDRssSchemas *rssSchemas() const;
static unsigned create(const QString &keyname,bool enable_users,
QString *err_msg);
static QString errorString(RDFeed::Error err);
@ -180,7 +178,6 @@ class RDFeed : public QObject
RDConfig *feed_config;
QByteArray feed_xml;
int feed_xml_ptr;
RDRssSchemas *feed_schemas;
friend size_t __RDFeed_Readfunction_Callback(char *buffer,size_t size,
size_t nitems,void *userdata);
};

View File

@ -18,12 +18,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include "rdapplication.h"
#include "rdrsscategorybox.h"
RDRssCategoryBox::RDRssCategoryBox(RDRssSchemas *schemas,QWidget *parent)
RDRssCategoryBox::RDRssCategoryBox(QWidget *parent)
: RDWidget(parent)
{
c_schemas=schemas;
c_schema=RDRssSchemas::CustomSchema;
//
@ -123,7 +123,7 @@ void RDRssCategoryBox::RefreshCategories(RDRssSchemas::RssSchema schema,
const QString &category,
const QString &sub_category)
{
QStringList categories=c_schemas->categories(schema);
QStringList categories=rda->rssSchemas()->categories(schema);
c_edit->setVisible(categories.size()==0);
c_sub_edit->setVisible(categories.size()==0);
c_box->setVisible(categories.size()>0);
@ -146,7 +146,7 @@ void RDRssCategoryBox::RefreshSubcategories(RDRssSchemas::RssSchema schema,
const QString &category,
const QString &sub_category)
{
QStringList subcategories=c_schemas->subCategories(schema,category);
QStringList subcategories=rda->rssSchemas()->subCategories(schema,category);
c_sub_box->clear();
for(int i=0;i<subcategories.size();i++) {

View File

@ -26,14 +26,13 @@
#include <qlineedit.h>
#include <QResizeEvent>
#include <rdrssschemas.h>
#include <rdwidget.h>
class RDRssCategoryBox : public RDWidget
{
Q_OBJECT
public:
RDRssCategoryBox(RDRssSchemas *schemas,QWidget *parent=0);
RDRssCategoryBox(QWidget *parent=0);
~RDRssCategoryBox();
RDRssSchemas::RssSchema schema() const;
void setSchema(RDRssSchemas::RssSchema schema);
@ -55,7 +54,6 @@ class RDRssCategoryBox : public RDWidget
void RefreshSubcategories(RDRssSchemas::RssSchema schema,
const QString &category,
const QString &sub_category);
RDRssSchemas *c_schemas;
RDRssSchemas::RssSchema c_schema;
QComboBox *c_box;
QComboBox *c_sub_box;

View File

@ -107,8 +107,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent)
//
// Channel Category
//
feed_channel_category_box=
new RDRssCategoryBox(feed_feed->rssSchemas(),this);
feed_channel_category_box=new RDRssCategoryBox(this);
feed_channel_category_label=new QLabel(tr("Category:"),this);
feed_channel_category_label->setFont(labelFont());
feed_channel_category_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
@ -404,7 +403,7 @@ EditFeed::EditFeed(const QString &feed,QWidget *parent)
for(int i=0;i<RDRssSchemas::LastSchema;i++) {
feed_rss_schema_box->
insertItem(feed_rss_schema_box->count(),
feed_feed->rssSchemas()->name((RDRssSchemas::RssSchema)i),i);
rda->rssSchemas()->name((RDRssSchemas::RssSchema)i),i);
}
connect(feed_rss_schema_box,SIGNAL(activated(int)),
this,SLOT(schemaActivatedData(int)));
@ -855,7 +854,7 @@ void EditFeed::UpdateControlState()
bool custom_schema=
feed_rss_schema_box->itemData(feed_rss_schema_box->currentIndex()).toInt()==
RDRssSchemas::CustomSchema;
bool item_image=feed_feed->rssSchemas()->
bool item_image=rda->rssSchemas()->
supportsItemImages((RDRssSchemas::RssSchema)feed_rss_schema_box->
itemData(feed_rss_schema_box->currentIndex()).toInt());