Browse Source

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

* Added a 'SYSTEM.RSS_PROCESSOR_STATION' field to the database.
	* Added a 'PODCASTS.EXPIRATION_DATETIME' field to the database.
	* Dropped the 'PODCASTS.SHELF_LIFE' field from the database.
	* Incremented the database version to 329.
	* Modified convention to use local system time for all podcast
	components.
	* Added 'RDPodcast::expirationDateTime()' and
	'RDPodcast::setExpirationDateTime()' methods.
	* Removed 'RDPodcast::shelfLife()' and 'RDPodcast::setShelfLife()'
	methods.
	* Added an rdrssd(8) daemon.
	* Removed the rdpurgecasts(8) utility.
	* Added 'RDSystem::rssProcessorStation()' and
	'RDSystem::setRssProcessorStation()' methods.
	* Added a 'Process RSS Updates' control to the 'System-Wide Settings'
	dialog in rdadmin(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
pull/613/head
Fred Gleason 3 years ago
parent
commit
e0af63d3e1
  1. 1
      .gitignore
  2. 17
      ChangeLog
  3. 1
      Makefile.am
  4. 2
      configure.ac
  5. 2
      docs/tables/podcasts.txt
  6. 21
      docs/tables/system.txt
  7. 2
      lib/dbversion.h
  8. 105
      lib/rdfeed.cpp
  9. 5
      lib/rdfeed.h
  10. 27
      lib/rdpodcast.cpp
  11. 4
      lib/rdpodcast.h
  12. 31
      lib/rdsystem.cpp
  13. 2
      lib/rdsystem.h
  14. 2
      rdadmin/edit_feed.cpp
  15. 187
      rdadmin/edit_settings.cpp
  16. 51
      rdadmin/edit_settings.h
  17. 8
      rdadmin/rdadmin_cs.ts
  18. 8
      rdadmin/rdadmin_de.ts
  19. 8
      rdadmin/rdadmin_es.ts
  20. 8
      rdadmin/rdadmin_fr.ts
  21. 8
      rdadmin/rdadmin_nb.ts
  22. 8
      rdadmin/rdadmin_nn.ts
  23. 8
      rdadmin/rdadmin_pt_BR.ts
  24. 114
      rdcastmanager/edit_cast.cpp
  25. 8
      rdcastmanager/edit_cast.h
  26. 31
      rdcastmanager/list_casts.cpp
  27. 8
      rdcastmanager/rdcastmanager_cs.ts
  28. 8
      rdcastmanager/rdcastmanager_de.ts
  29. 8
      rdcastmanager/rdcastmanager_es.ts
  30. 10
      rdcastmanager/rdcastmanager_fr.ts
  31. 8
      rdcastmanager/rdcastmanager_nb.ts
  32. 8
      rdcastmanager/rdcastmanager_nn.ts
  33. 8
      rdcastmanager/rdcastmanager_pt_BR.ts
  34. 22
      rdrssd/Makefile.am
  35. 184
      rdrssd/rdrssd.cpp
  36. 27
      rdrssd/rdrssd.h
  37. 7
      rdservice/maint_routines.cpp
  38. 11
      rdservice/rdservice.h
  39. 29
      rdservice/startup.cpp
  40. 2
      rivendell.spec.in
  41. 1
      utils/Makefile.am
  42. 38
      utils/rddbmgr/revertschema.cpp
  43. 2
      utils/rddbmgr/schemamap.cpp
  44. 47
      utils/rddbmgr/updateschema.cpp
  45. 159
      utils/rdpurgecasts/rdpurgecasts.cpp

1
.gitignore

@ -95,6 +95,7 @@ rdrepld/rdrepld
rdrepld-suse
rdselect/rdselect
rdservice/rdservice
rdrssd/rdrssd
rdvairplayd/rdvairplayd
ripcd/ripcd
rivendell

17
ChangeLog

@ -20146,3 +20146,20 @@
* Added an 'RDLogIcons' class.
2020-08-04 Fred Gleason <fredg@paravelsystems.com>
* Added a 'Log Render Options' dialog to rdcastmanager(1).
2020-08-07 Fred Gleason <fredg@paravelsystems.com>
* Added a 'SYSTEM.RSS_PROCESSOR_STATION' field to the database.
* Added a 'PODCASTS.EXPIRATION_DATETIME' field to the database.
* Dropped the 'PODCASTS.SHELF_LIFE' field from the database.
* Incremented the database version to 329.
* Modified convention to use local system time for all podcast
components.
* Added 'RDPodcast::expirationDateTime()' and
'RDPodcast::setExpirationDateTime()' methods.
* Removed 'RDPodcast::shelfLife()' and 'RDPodcast::setShelfLife()'
methods.
* Added an rdrssd(8) daemon.
* Removed the rdpurgecasts(8) utility.
* Added 'RDSystem::rssProcessorStation()' and
'RDSystem::setRssProcessorStation()' methods.
* Added a 'Process RSS Updates' control to the 'System-Wide Settings'
dialog in rdadmin(1).

1
Makefile.am

@ -52,6 +52,7 @@ SUBDIRS = icons\
rdrepld\
rdpadd\
rdpadengined\
rdrssd\
rdselect\
rdservice\
rdvairplayd\

2
configure.ac

@ -544,6 +544,7 @@ AC_CONFIG_FILES([rivendell.spec \
rdrepld/Makefile \
rdpadd/Makefile \
rdpadengined/Makefile \
rdrssd/Makefile \
rdselect/Makefile \
rdservice/Makefile \
rdvairplayd/Makefile \
@ -571,7 +572,6 @@ AC_CONFIG_FILES([rivendell.spec \
utils/rdmarkerset/Makefile \
utils/rdmetadata/Makefile \
utils/rdpopup/Makefile \
utils/rdpurgecasts/Makefile \
utils/rdrender/Makefile \
utils/rdselect_helper/Makefile \
utils/rdsoftkeys/Makefile \

2
docs/tables/podcasts.txt

@ -20,6 +20,6 @@ ITEM_IMAGE_ID int(11) From FEED_IMAGES.ID
AUDIO_FILENAME varchar(191)
AUDIO_LENGTH int(10) unsigned
AUDIO_TIME int(10) unsigned
SHELF_LIFE int(11)
ORIGIN_DATETIME datetime
EFFECTIVE_DATETIME datetime
EXPIRATION_DATETIME datetime

21
docs/tables/system.txt

@ -2,14 +2,15 @@
The SYSTEM table contains system-wide settings.
FIELD NAME TYPE REMARKS
FIELD NAME TYPE REMARKS
---------------------------------------------------------------
ID int(11) Auto increment, primary key
SAMPLE_RATE int(10) unsigned
DUP_CART_TITLE enum('N','Y')
FIX_DUP_CART_TITLES enum('N','Y')
MAX_POST_LENGTH int(10) unsigned
ISCI_XREFERENCE_PATH varchar(191)
TEMP_CART_GROUP varchar(10) From 'GROUPS.NAME'
SHOW_USER_LIST enum('N','Y')
NOTIFICATION_ADDRESS varchar(15)
ID int(11) Auto increment, primary key
SAMPLE_RATE int(10) unsigned
DUP_CART_TITLE enum('N','Y')
FIX_DUP_CART_TITLES enum('N','Y')
MAX_POST_LENGTH int(10) unsigned
ISCI_XREFERENCE_PATH varchar(191)
TEMP_CART_GROUP varchar(10) From 'GROUPS.NAME'
SHOW_USER_LIST enum('N','Y')
NOTIFICATION_ADDRESS varchar(15)
RSS_PROCESSOR_STATION varchar(64)

2
lib/dbversion.h

@ -24,7 +24,7 @@
/*
* Current Database Version
*/
#define RD_VERSION_DATABASE 328
#define RD_VERSION_DATABASE 329
#endif // DBVERSION_H

105
lib/rdfeed.cpp

@ -820,13 +820,14 @@ bool RDFeed::postXml(QString *err_msg)
CURLcode curl_err;
bool ret=false;
char errstr[CURL_ERROR_SIZE];
QDateTime now=QDateTime::currentDateTime();
if((curl=curl_easy_init())==NULL) {
*err_msg=tr("Unable to get CURL handle.");
return false;
}
feed_xml=rssXml(err_msg).toUtf8();
feed_xml=rssXml(err_msg,now).toUtf8();
feed_xml_ptr=0;
curl_easy_setopt(curl,CURLOPT_URL,feedUrl().toUtf8().constData());
@ -848,6 +849,7 @@ bool RDFeed::postXml(QString *err_msg)
switch((curl_err=curl_easy_perform(curl))) {
case CURLE_OK:
case CURLE_PARTIAL_FILE:
setLastBuildDateTime(now);
ret=true;
break;
@ -1311,7 +1313,7 @@ unsigned RDFeed::postLog(const QString &logname,const QTime &start_time,
}
QString RDFeed::rssXml(QString *err_msg,bool *ok)
QString RDFeed::rssXml(QString *err_msg,const QDateTime &now,bool *ok)
{
QString ret;
@ -1337,22 +1339,21 @@ QString RDFeed::rssXml(QString *err_msg,bool *ok)
"FEEDS.CHANNEL_WEBMASTER,"+ // 10
"FEEDS.CHANNEL_LANGUAGE,"+ // 11
"FEEDS.CHANNEL_EXPLICIT,"+ // 12
"FEEDS.LAST_BUILD_DATETIME,"+ // 13
"FEEDS.ORIGIN_DATETIME,"+ // 14
"FEEDS.HEADER_XML,"+ // 15
"FEEDS.CHANNEL_XML,"+ // 16
"FEEDS.ITEM_XML,"+ // 17
"FEEDS.BASE_URL,"+ // 18
"FEEDS.ID,"+ // 19
"FEEDS.UPLOAD_EXTENSION,"+ // 20
"FEEDS.CAST_ORDER,"+ // 21
"FEEDS.BASE_PREAMBLE,"+ // 22
"FEEDS.IS_SUPERFEED,"+ // 23
"FEED_IMAGES.ID,"+ // 24
"FEED_IMAGES.WIDTH,"+ // 25
"FEED_IMAGES.HEIGHT,"+ // 26
"FEED_IMAGES.DESCRIPTION,"+ // 27
"FEED_IMAGES.FILE_EXTENSION "+ // 28
"FEEDS.ORIGIN_DATETIME,"+ // 13
"FEEDS.HEADER_XML,"+ // 14
"FEEDS.CHANNEL_XML,"+ // 15
"FEEDS.ITEM_XML,"+ // 16
"FEEDS.BASE_URL,"+ // 17
"FEEDS.ID,"+ // 18
"FEEDS.UPLOAD_EXTENSION,"+ // 19
"FEEDS.CAST_ORDER,"+ // 20
"FEEDS.BASE_PREAMBLE,"+ // 21
"FEEDS.IS_SUPERFEED,"+ // 22
"FEED_IMAGES.ID,"+ // 23
"FEED_IMAGES.WIDTH,"+ // 24
"FEED_IMAGES.HEIGHT,"+ // 25
"FEED_IMAGES.DESCRIPTION,"+ // 26
"FEED_IMAGES.FILE_EXTENSION "+ // 27
"from FEEDS ";
sql+="left join FEED_IMAGES ";
sql+="on FEEDS.CHANNEL_IMAGE_ID=FEED_IMAGES.ID ";
@ -1371,9 +1372,9 @@ QString RDFeed::rssXml(QString *err_msg,bool *ok)
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();
item_template=chan_q->value(17).toString();
header_template=chan_q->value(14).toString();
channel_template=chan_q->value(15).toString();
item_template=chan_q->value(16).toString();
}
//
@ -1385,17 +1386,17 @@ QString RDFeed::rssXml(QString *err_msg,bool *ok)
// Render Channel XML
//
ret+=" <channel>\n";
ret+=ResolveChannelWildcards(channel_template,chan_q)+"\r\n";
ret+=ResolveChannelWildcards(channel_template,chan_q,now)+"\r\n";
//
// Render Item XML
//
QString where;
if(chan_q->value(23).toString()=="Y") { // Is a Superfeed
if(chan_q->value(22).toString()=="Y") { // Is a Superfeed
sql=QString("select ")+
"MEMBER_FEED_ID "+ // 00
"from SUPERFEED_MAPS where "+
QString().sprintf("FEED_ID=%d",chan_q->value(19).toUInt());
QString().sprintf("FEED_ID=%d",chan_q->value(18).toUInt());
q=new RDSqlQuery(sql);
while(q->next()) {
where+=QString().sprintf("(PODCASTS.FEED_ID=%u) || ",q->value(0).toUInt());
@ -1404,7 +1405,7 @@ QString RDFeed::rssXml(QString *err_msg,bool *ok)
where=("("+where.left(where.length()-4)+") && ");
}
else {
where =QString().sprintf("(PODCASTS.FEED_ID=%u)&&",chan_q->value(19).toUInt());
where=QString().sprintf("(PODCASTS.FEED_ID=%u)&&",chan_q->value(18).toUInt());
}
sql=QString("select ")+
"PODCASTS.FEED_ID,"+ // 00
@ -1435,11 +1436,15 @@ QString RDFeed::rssXml(QString *err_msg,bool *ok)
"left join FEED_IMAGES "+
"on PODCASTS.ITEM_IMAGE_ID=FEED_IMAGES.ID where "+
where+
QString().sprintf("(PODCASTS.STATUS=%d) ",RDPodcast::StatusActive)+
QString().sprintf("(PODCASTS.STATUS=%d) && ",RDPodcast::StatusActive)+
"(PODCASTS.EFFECTIVE_DATETIME<=now()) && "+
"((PODCASTS.EXPIRATION_DATETIME is null)||"+
"(PODCASTS.EXPIRATION_DATETIME>now())) "+
"order by PODCASTS.ORIGIN_DATETIME";
if(chan_q->value(21).toString()=="N") {
if(chan_q->value(20).toString()=="N") {
sql+=" desc";
}
// printf("item_sql: %s\n",sql.toUtf8().constData());
item_q=new RDSqlQuery(sql);
while(item_q->next()) {
ret+=" <item>\r\n";
@ -1615,7 +1620,8 @@ unsigned RDFeed::CreateCast(QString *filename,int bytes,int msecs) const
"CHANNEL_LINK,"+ // 03
"MAX_SHELF_LIFE,"+ // 04
"UPLOAD_FORMAT,"+ // 05
"UPLOAD_EXTENSION "+ // 06
"UPLOAD_EXTENSION,"+ // 06
"ENABLE_AUTOPOST "+ // 07
"from FEEDS where "+
QString().sprintf("ID=%u",feed_id);
q=new RDSqlQuery(sql);
@ -1633,10 +1639,23 @@ unsigned RDFeed::CreateCast(QString *filename,int bytes,int msecs) const
"ITEM_DESCRIPTION=\""+RDEscapeString(q->value(1).toString())+"\","+
"ITEM_CATEGORY=\""+RDEscapeString(q->value(2).toString())+"\","+
"ITEM_LINK=\""+RDEscapeString(q->value(3).toString())+"\","+
QString().sprintf("SHELF_LIFE=%d,",q->value(4).toInt())+
"ITEM_AUTHOR=\""+RDEscapeString(rda->user()->emailContact())+"\","+
"EFFECTIVE_DATETIME=UTC_TIMESTAMP(),"+
"ORIGIN_DATETIME=UTC_TIMESTAMP()";
"EFFECTIVE_DATETIME=now(),"+
"ORIGIN_DATETIME=now(),";
if(RDBool(q->value(7).toString())) {
sql+=QString().sprintf("STATUS=%d,",RDPodcast::StatusActive);
}
else {
sql+=QString().sprintf("STATUS=%d,",RDPodcast::StatusPending);
}
if(q->value(4).toInt()==0) {
sql+="EXPIRATION_DATETIME=NULL";
}
else {
sql+="EXPIRATION_DATETIME=\""+
QDateTime::currentDateTime().addDays(q->value(4).toInt()).
toString("yyyy-MM-dd hh:mm:ss")+"\"";
}
q1=new RDSqlQuery(sql);
delete q1;
@ -1667,7 +1686,8 @@ unsigned RDFeed::CreateCast(QString *filename,int bytes,int msecs) const
}
QString RDFeed::ResolveChannelWildcards(const QString &tmplt,RDSqlQuery *chan_q)
QString RDFeed::ResolveChannelWildcards(const QString &tmplt,RDSqlQuery *chan_q,
const QDateTime &build_datetime)
{
QString ret=" "+tmplt;
@ -1692,21 +1712,21 @@ QString RDFeed::ResolveChannelWildcards(const QString &tmplt,RDSqlQuery *chan_q)
explicit_str="true";
}
ret.replace("%EXPLICIT%",RDXmlEscape(explicit_str));
ret.replace("%BUILD_DATE%",chan_q->value(13).toDateTime().
ret.replace("%BUILD_DATE%",RDLocalToUtc(build_datetime).
toString("ddd, d MMM yyyy hh:mm:ss ")+"GMT");
ret.replace("%PUBLISH_DATE%",chan_q->value(14).toDateTime().
ret.replace("%PUBLISH_DATE%",RDLocalToUtc(chan_q->value(13).toDateTime()).
toString("ddd, d MMM yyyy hh:mm:ss ")+"GMT");
ret.replace("%GENERATOR%",QString("Rivendell ")+VERSION);
ret.replace("%FEED_URL%",RDXmlEscape(chan_q->value(18).toString())+"/"+
ret.replace("%FEED_URL%",RDXmlEscape(chan_q->value(17).toString())+"/"+
RDXmlEscape(keyName()+"."+RD_RSS_XML_FILE_EXTENSION));
ret.replace("%IMAGE_URL%",chan_q->value(18).toString()+"/"+
RDFeed::imageFilename(id(),chan_q->value(24).toInt(),
chan_q->value(28).toString()));
ret.replace("%IMAGE_URL%",chan_q->value(17).toString()+"/"+
RDFeed::imageFilename(id(),chan_q->value(23).toInt(),
chan_q->value(27).toString()));
ret.replace("%IMAGE_WIDTH%",
QString().sprintf("%d",chan_q->value(25).toInt()));
QString().sprintf("%d",chan_q->value(24).toInt()));
ret.replace("%IMAGE_HEIGHT%",
QString().sprintf("%d",chan_q->value(25).toInt()));
ret.replace("%IMAGE_DESCRIPTION%",chan_q->value(27).toString());
QString().sprintf("%d",chan_q->value(24).toInt()));
ret.replace("%IMAGE_DESCRIPTION%",chan_q->value(26).toString());
return ret;
}
@ -1748,7 +1768,8 @@ QString RDFeed::ResolveItemWildcards(const QString &tmplt,RDSqlQuery *item_q,
RDGetTimeLength(item_q->value(12).toInt(),false,false));
ret.replace("%ITEM_AUDIO_SECONDS%",
QString().sprintf("%d",item_q->value(12).toInt()/1000));
ret.replace("%ITEM_PUBLISH_DATE%",item_q->value(13).toDateTime().
ret.replace("%ITEM_PUBLISH_DATE%",
RDLocalToUtc(item_q->value(13).toDateTime()).
toString("ddd, d MMM yyyy hh:mm:ss ")+"GMT");
ret.replace("%ITEM_GUID%",RDPodcast::guid(item_q->value(15).toString(),
item_q->value(10).toString(),

5
lib/rdfeed.h

@ -138,7 +138,7 @@ class RDFeed : public QObject
unsigned postFile(const QString &srcfile,Error *err);
unsigned postLog(const QString &logname,const QTime &start_time,
bool stop_at_stop,int start_line,int end_line,Error *err);
QString rssXml(QString *err_msg,bool *ok=NULL);
QString rssXml(QString *err_msg,const QDateTime &now,bool *ok=NULL);
static unsigned create(const QString &keyname,bool enable_users,
QString *err_msg);
static QString errorString(RDFeed::Error err);
@ -157,7 +157,8 @@ class RDFeed : public QObject
private:
unsigned CreateCast(QString *filename,int bytes,int msecs) const;
QString ResolveChannelWildcards(const QString &tmplt,RDSqlQuery *chan_q);
QString ResolveChannelWildcards(const QString &tmplt,RDSqlQuery *chan_q,
const QDateTime &build_datetime);
QString ResolveItemWildcards(const QString &tmplt,RDSqlQuery *item_q,
RDSqlQuery *chan_q);
QString GetTempFilename() const;

27
lib/rdpodcast.cpp

@ -298,16 +298,16 @@ void RDPodcast::setAudioTime(int msecs) const
}
unsigned RDPodcast::shelfLife() const
QDateTime RDPodcast::expirationDateTime() const
{
return RDGetSqlValue("PODCASTS","ID",podcast_id,"SHELF_LIFE").
toUInt();
return RDGetSqlValue("PODCASTS","ID",podcast_id,
"EXPIRATION_DATETIME").toDateTime();
}
void RDPodcast::setShelfLife(unsigned days) const
void RDPodcast::setExpirationDateTime(const QDateTime &dt) const
{
SetRow("SHELF_LIFE",days);
SetRow("EXPIRATION_DATETIME",dt,"yyyy-MM-dd hh:mm:ss");
}
@ -387,12 +387,17 @@ void RDPodcast::SetRow(const QString &param,const QString &value) const
void RDPodcast::SetRow(const QString &param,const QDateTime &value,
const QString &format) const
{
RDSqlQuery *q;
QString sql;
sql=QString("update PODCASTS set ")+
param+"="+RDCheckDateTime(value, format)+" where "+
QString().sprintf("ID=%u",podcast_id);
q=new RDSqlQuery(sql);
delete q;
if(value.isNull()) {
sql=QString("update PODCASTS set ")+
param+"=NULL"+" where "+
QString().sprintf("ID=%u",podcast_id);
}
else {
sql=QString("update PODCASTS set ")+
param+"="+RDCheckDateTime(value, format)+" where "+
QString().sprintf("ID=%u",podcast_id);
}
RDSqlQuery::apply(sql);
}

4
lib/rdpodcast.h

@ -64,8 +64,8 @@ class RDPodcast
void setAudioLength(int len) const;
int audioTime() const;
void setAudioTime(int msecs) const;
unsigned shelfLife() const;
void setShelfLife(unsigned days) const;
QDateTime expirationDateTime() const;
void setExpirationDateTime(const QDateTime &dt) const;
RDPodcast::Status status() const;
void setStatus(RDPodcast::Status status);
bool removeAudio(RDFeed *feed,QString *err_text,bool log_debug) const;

31
lib/rdsystem.cpp

@ -187,6 +187,18 @@ void RDSystem::setNotificationAddress(const QHostAddress &addr)
}
QString RDSystem::rssProcessorStation() const
{
return GetValue("RSS_PROCESSOR_STATION").toString();
}
void RDSystem::setRssProcessorStation(const QString &str) const
{
SetRow("RSS_PROCESSOR_STATION",str);
}
QString RDSystem::xml() const
{
QString xml="<systemSettings>\n";
@ -218,24 +230,25 @@ QVariant RDSystem::GetValue(const QString &field) const
void RDSystem::SetRow(const QString &param,QString value) const
{
RDSqlQuery *q;
QString sql;
// value.replace("\\","\\\\"); // Needed to preserve Windows pathnames
sql=QString("update SYSTEM set ")+
param+"=\""+RDEscapeString(value)+"\"";
q=new RDSqlQuery(sql);
delete q;
if(value.isNull()) {
sql=QString("update SYSTEM set ")+
param+"=NULL";
}
else {
sql=QString("update SYSTEM set ")+
param+"=\""+RDEscapeString(value)+"\"";
}
RDSqlQuery::apply(sql);
}
void RDSystem::SetRow(const QString &param,int value) const
{
RDSqlQuery *q;
QString sql;
sql=QString("update SYSTEM set ")+
param+QString().sprintf("=%d",value);
q=new RDSqlQuery(sql);
delete q;
RDSqlQuery::apply(sql);
}

2
lib/rdsystem.h

@ -44,6 +44,8 @@ class RDSystem
void setShowUserList(bool state) const;
QHostAddress notificationAddress() const;
void setNotificationAddress(const QHostAddress &addr);
QString rssProcessorStation() const;
void setRssProcessorStation(const QString &str=QString()) const;
QString xml() const;
private:

2
rdadmin/edit_feed.cpp

@ -663,8 +663,6 @@ void EditFeed::okData()
feed_feed->setChannelXml(feed_channel_xml_edit->text());
feed_feed->setItemXml(feed_item_xml_edit->text());
feed_feed->setMaxShelfLife(feed_max_shelf_life_spin->value());
feed_feed->setLastBuildDateTime(QDateTime(QDate::currentDate(),
QTime::currentTime()));
feed_feed->setEnableAutopost(feed_autopost_box->currentIndex());
feed_feed->setUploadFormat(feed_settings.format());
feed_feed->setUploadChannels(feed_settings.channels());

187
rdadmin/edit_settings.cpp

@ -18,7 +18,6 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qapplication.h>
#include <qfiledialog.h>
#include <qmessagebox.h>
@ -34,8 +33,6 @@
EditSettings::EditSettings(QWidget *parent)
: RDDialog(parent)
{
setModal(true);
QString sql;
RDSqlQuery *q;
@ -45,7 +42,7 @@ EditSettings::EditSettings(QWidget *parent)
// Fix the Window Size
//
setMinimumSize(sizeHint());
setMaximumSize(sizeHint());
setMaximumHeight(sizeHint().height());
edit_system=new RDSystem();
@ -57,37 +54,35 @@ EditSettings::EditSettings(QWidget *parent)
// System Sample Rate
//
edit_sample_rate_box=new QComboBox(this);
edit_sample_rate_box->setGeometry(250,10,70,20);
edit_sample_rate_box->insertItem("32000");
edit_sample_rate_box->insertItem("44100");
edit_sample_rate_box->insertItem("48000");
QLabel *label=new QLabel(edit_sample_rate_box,tr("System Sample Rate:"),this);
label->setGeometry(10,10,235,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
label=new QLabel(tr("samples/second"),this);
label->setGeometry(325,10,sizeHint().width()-285,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_sample_rate_label=
new QLabel(edit_sample_rate_box,tr("System Sample Rate:"),this);
edit_sample_rate_label->setFont(labelFont());
edit_sample_rate_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_sample_rate_unit_label=new QLabel(tr("samples/second"),this);
edit_sample_rate_unit_label->setGeometry(325,10,sizeHint().width()-285,20);
edit_sample_rate_unit_label->setFont(labelFont());
edit_sample_rate_unit_label->
setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic);
//
// Allow Duplicate Cart Titles Box
//
edit_duplicate_carts_box=new QCheckBox(this);
edit_duplicate_carts_box->setGeometry(20,32,15,15);
connect(edit_duplicate_carts_box,SIGNAL(toggled(bool)),
this,SLOT(duplicatesCheckedData(bool)));
label=
edit_duplicate_label=
new QLabel(edit_duplicate_carts_box,tr("Allow Duplicate Cart Titles"),this);
label->setGeometry(40,30,sizeHint().width()-50,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_duplicate_label->setFont(labelFont());
edit_duplicate_label->
setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_fix_duplicate_carts_box=new QCheckBox(this);
edit_fix_duplicate_carts_box->setGeometry(30,52,15,15);
edit_fix_duplicate_carts_label=new QLabel(edit_fix_duplicate_carts_box,
tr("Auto-Correct Duplicate Cart Titles"),this);
edit_fix_duplicate_carts_label->setGeometry(50,50,sizeHint().width()-60,20);
edit_fix_duplicate_carts_label->setFont(labelFont());
edit_fix_duplicate_carts_label->
setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic);
@ -96,77 +91,93 @@ EditSettings::EditSettings(QWidget *parent)
// ISCI Cross Reference Path
//
edit_isci_path_edit=new QLineEdit(this);
edit_isci_path_edit->setGeometry(250,76,sizeHint().width()-260,20);
label=new QLabel(edit_isci_path_edit,tr("ISCI Cross Reference Path:"),this);
label->setGeometry(10,76,235,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_isci_path_label=
new QLabel(edit_isci_path_edit,tr("ISCI Cross Reference Path:"),this);
edit_isci_path_label->setFont(labelFont());
edit_isci_path_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
//
// Notification Address
//
edit_notification_address_edit=new QLineEdit(this);
edit_notification_address_edit->setGeometry(250,98,150,20);
label=new QLabel(edit_notification_address_edit,tr("Multicast Address for Notifications"),this);
label->setGeometry(10,98,235,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_notification_address_label=
new QLabel(edit_notification_address_edit,
tr("Multicast Address for Notifications"),this);
edit_notification_address_label->setFont(labelFont());
edit_notification_address_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
//
// Maximum POST Size
//
edit_maxpost_spin=new QSpinBox(this);
edit_maxpost_spin->setGeometry(250,120,60,20);
edit_maxpost_spin->setRange(1,1000);
label=new QLabel(edit_maxpost_spin,tr("Maximum Remote Post Length:"),this);
label->setGeometry(10,120,235,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
label=new QLabel(tr("Mbytes"),this);
label->setGeometry(315,120,60,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_maxpost_label=
new QLabel(edit_maxpost_spin,tr("Maximum Remote Post Length:"),this);
edit_maxpost_label->setFont(labelFont());
edit_maxpost_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_maxpost_unit_label=new QLabel(tr("Mbytes"),this);
edit_maxpost_unit_label->setFont(labelFont());
edit_maxpost_unit_label->
setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic);
//
// Temporary Cart Group
//
edit_temp_cart_group_box=new QComboBox(this);
edit_temp_cart_group_box->setGeometry(250,141,100,20);
sql="select NAME from GROUPS order by NAME";
q=new RDSqlQuery(sql);
while(q->next()) {
edit_temp_cart_group_box->insertItem(q->value(0).toString());
}
delete q;
label=new QLabel(edit_temp_cart_group_box,tr("Temporary Cart Group:"),this);
label->setGeometry(10,141,235,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_temp_cart_group_label=
new QLabel(edit_temp_cart_group_box,tr("Temporary Cart Group:"),this);
edit_temp_cart_group_label->setFont(labelFont());
edit_temp_cart_group_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
//
// Show User List
//
edit_show_user_list_box=new QCheckBox(this);
edit_show_user_list_box->setGeometry(20,165,15,15);
connect(edit_show_user_list_box,SIGNAL(toggled(bool)),
this,SLOT(duplicatesCheckedData(bool)));
label=
edit_show_user_list_label=
new QLabel(edit_show_user_list_box,tr("Show User List in RDLogin"),this);
label->setGeometry(40,163,sizeHint().width()-50,20);
label->setFont(labelFont());
label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic);
edit_show_user_list_label->setFont(labelFont());
edit_show_user_list_label->
setAlignment(Qt::AlignLeft|Qt::AlignVCenter|Qt::TextShowMnemonic);
//
// RSS Processor Host
//
edit_rss_processor_box=new QComboBox(this);
sql=QString("select NAME from STATIONS order by NAME");
q=new RDSqlQuery(sql);
edit_rss_processor_box->insertItem(0,tr("[none]"));
while(q->next()) {
edit_rss_processor_box->insertItem(edit_rss_processor_box->count(),
q->value(0).toString());
}
delete q;
edit_rss_processor_label=
new QLabel(edit_rss_processor_box,tr("Process RSS Updates On")+":",this);
edit_rss_processor_label->setFont(labelFont());
edit_rss_processor_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter|Qt::TextShowMnemonic);
//
// Duplicate List (initially hidden)
//
edit_duplicate_label=new QLabel(this);
edit_duplicate_label->setText(tr("The following duplicate titles must be corrected before \"Allow Duplicate Values\" can be turned off."));
edit_duplicate_label->setWordWrap(true);
edit_duplicate_label->setGeometry(15,186,sizeHint().width()-30,50);
edit_duplicate_label->setFont(subLabelFont());
edit_duplicate_label->hide();
edit_duplicate_hidden_label=new QLabel(this);
edit_duplicate_hidden_label->setText(tr("The following duplicate titles must be corrected before \"Allow Duplicate Values\" can be turned off."));
edit_duplicate_hidden_label->setWordWrap(true);
edit_duplicate_hidden_label->setFont(subLabelFont());
edit_duplicate_hidden_label->hide();
edit_duplicate_list=new Q3ListView(this);
edit_duplicate_list->setGeometry(10,234,sizeHint().width()-20,215);
edit_duplicate_list->setItemMargin(5);
edit_duplicate_list->setAllColumnsShowFocus(true);
edit_duplicate_list->addColumn(tr("Cart"));
@ -175,8 +186,6 @@ EditSettings::EditSettings(QWidget *parent)
edit_duplicate_list->setColumnAlignment(1,Qt::AlignLeft);
edit_duplicate_list->hide();
edit_save_button=new QPushButton(this);
edit_save_button->
setGeometry(sizeHint().width()-85,454,70,25);
edit_save_button->setFont(buttonFont());
edit_save_button->setText(tr("&Save List"));
connect(edit_save_button,SIGNAL(clicked()),this,SLOT(saveData()));
@ -186,8 +195,6 @@ EditSettings::EditSettings(QWidget *parent)
// Ok Button
//
edit_ok_button=new QPushButton(this);
edit_ok_button->setGeometry(sizeHint().width()-180,sizeHint().height()-60,
80,50);
edit_ok_button->setFont(buttonFont());
edit_ok_button->setText(tr("&OK"));
connect(edit_ok_button,SIGNAL(clicked()),this,SLOT(okData()));
@ -196,8 +203,6 @@ EditSettings::EditSettings(QWidget *parent)
// Cancel Button
//
edit_cancel_button=new QPushButton(this);
edit_cancel_button->setGeometry(sizeHint().width()-90,sizeHint().height()-60,
80,50);
edit_cancel_button->setFont(buttonFont());
edit_cancel_button->setText(tr("&Cancel"));
connect(edit_cancel_button,SIGNAL(clicked()),this,SLOT(cancelData()));
@ -212,6 +217,16 @@ EditSettings::EditSettings(QWidget *parent)
setText(edit_system->notificationAddress().toString());
edit_show_user_list_box->setChecked(edit_system->showUserList());
QString station=edit_system->rssProcessorStation();
for(int i=0;i<edit_rss_processor_box->count();i++) {
if(edit_rss_processor_box->text(i)==station) {
edit_rss_processor_box->setCurrentIndex(i);
}
}
for(int i=0;i<edit_sample_rate_box->count();i++) {
if(edit_sample_rate_box->text(i).toUInt()==edit_system->sampleRate()) {
edit_sample_rate_box->setCurrentItem(i);
@ -236,7 +251,7 @@ EditSettings::~EditSettings()
QSize EditSettings::sizeHint() const
{
return QSize(500,262+y_pos);
return QSize(500,284+y_pos);
}
@ -350,7 +365,7 @@ void EditSettings::okData()
setMinimumHeight(sizeHint().height());
setMaximumHeight(sizeHint().height());
edit_duplicate_carts_box->setChecked(true);
edit_duplicate_label->show();
edit_duplicate_hidden_label->show();
edit_duplicate_list->show();
edit_save_button->show();
edit_duplicate_list->clear();
@ -402,6 +417,12 @@ void EditSettings::okData()
setNotificationAddress(QHostAddress(edit_notification_address_edit->text()));
edit_system->setTempCartGroup(edit_temp_cart_group_box->currentText());
edit_system->setShowUserList(edit_show_user_list_box->isChecked());
if(edit_rss_processor_box->currentIndex()==0) {
edit_system->setRssProcessorStation();
}
else {
edit_system->setRssProcessorStation(edit_rss_processor_box->currentText());
}
done(0);
}
@ -433,3 +454,41 @@ void EditSettings::BuildDuplicatesList(std::map<unsigned,QString> *dups)
}
delete q;
}
void EditSettings::resizeEvent(QResizeEvent *e)
{
edit_sample_rate_box->setGeometry(250,10,70,20);
edit_sample_rate_label->setGeometry(10,10,235,20);
edit_duplicate_carts_box->setGeometry(20,32,15,15);
edit_duplicate_label->setGeometry(40,30,size().width()-50,20);
edit_fix_duplicate_carts_box->setGeometry(30,52,15,15);
edit_fix_duplicate_carts_label->setGeometry(50,50,size().width()-60,20);
edit_show_user_list_box->setGeometry(20,74,15,15);
edit_show_user_list_label->setGeometry(40,72,size().width()-50,20);
edit_isci_path_edit->setGeometry(250,98,size().width()-260,20);
edit_isci_path_label->setGeometry(10,98,235,20);
edit_notification_address_edit->setGeometry(250,120,150,20);
edit_notification_address_label->setGeometry(10,120,235,20);
edit_maxpost_spin->setGeometry(250,142,60,20);
edit_maxpost_label->setGeometry(10,142,235,20);
edit_maxpost_unit_label->setGeometry(315,142,60,20);
edit_temp_cart_group_box->setGeometry(250,163,100,20);
edit_temp_cart_group_label->setGeometry(10,163,235,20);
edit_rss_processor_label->setGeometry(10,185,235,20);
edit_rss_processor_box->setGeometry(250,185,200,20);
edit_duplicate_hidden_label->setGeometry(15,186,size().width()-30,50);
edit_duplicate_list->setGeometry(10,234,size().width()-20,215);
edit_save_button->setGeometry(size().width()-85,454,70,25);
edit_ok_button->setGeometry(size().width()-180,size().height()-60,80,50);
edit_cancel_button->setGeometry(size().width()-90,size().height()-60,80,50);
}

51
rdadmin/edit_settings.h

@ -2,7 +2,7 @@
//
// Edit Rivendell System-wide Settings.
//
// (C) Copyright 2009-2019 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2009-2020 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
@ -51,24 +51,39 @@ class EditSettings : public RDDialog
void okData();
void cancelData();
protected:
void resizeEvent(QResizeEvent *e);
private:
QComboBox *edit_sample_rate_box;
QCheckBox *edit_duplicate_carts_box;
QLabel *edit_duplicate_label;
QCheckBox *edit_fix_duplicate_carts_box;
QLabel *edit_fix_duplicate_carts_label;
QSpinBox *edit_maxpost_spin;
QLineEdit *edit_isci_path_edit;
QComboBox *edit_temp_cart_group_box;
QCheckBox *edit_show_user_list_box;
Q3ListView *edit_duplicate_list;
QLineEdit *edit_notification_address_edit;
QPushButton *edit_settings_button;
QPushButton *edit_save_button;
QPushButton *edit_ok_button;
QPushButton *edit_cancel_button;
RDSystem *edit_system;
int y_pos;
QLabel *edit_sample_rate_label;
QComboBox *edit_sample_rate_box;
QLabel *edit_sample_rate_unit_label;
QLabel *edit_duplicate_label;
QLabel *edit_duplicate_hidden_label;
QCheckBox *edit_duplicate_carts_box;
QCheckBox *edit_fix_duplicate_carts_box;
QLabel *edit_fix_duplicate_carts_label;
QLabel *edit_maxpost_label;
QSpinBox *edit_maxpost_spin;
QLabel *edit_maxpost_unit_label;
QLabel *edit_isci_path_label;
QLineEdit *edit_isci_path_edit;
QLabel *edit_temp_cart_group_label;
QComboBox *edit_temp_cart_group_box;
QComboBox *edit_rss_processor_station_box;
QLabel *edit_show_user_list_label;
QCheckBox *edit_show_user_list_box;
Q3ListView *edit_duplicate_list;
QLabel *edit_notification_address_label;
QLineEdit *edit_notification_address_edit;
QLabel *edit_rss_processor_label;
QComboBox *edit_rss_processor_box;
QPushButton *edit_settings_button;
QPushButton *edit_save_button;
QPushButton *edit_ok_button;
QPushButton *edit_cancel_button;
RDSystem *edit_system;
int y_pos;
};

8
rdadmin/rdadmin_cs.ts

@ -3817,6 +3817,14 @@ Přepsat?</translation>
<source>Progress</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[none]</source>
<translation type="unfinished">[žádný]</translation>
</message>
<message>
<source>Process RSS Updates On</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

8
rdadmin/rdadmin_de.ts

@ -3629,6 +3629,14 @@ Overwrite?</source>
<source>Progress</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[none]</source>
<translation type="unfinished">[keine]</translation>
</message>
<message>
<source>Process RSS Updates On</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

8
rdadmin/rdadmin_es.ts

@ -3824,6 +3824,14 @@ Overwrite?</source>
<source>Progress</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[none]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Process RSS Updates On</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

8
rdadmin/rdadmin_fr.ts

@ -3039,6 +3039,14 @@ Overwrite?</source>
<source>Progress</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[none]</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Process RSS Updates On</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

8
rdadmin/rdadmin_nb.ts

@ -3571,6 +3571,14 @@ Overwrite?</source>
<source>Progress</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[none]</source>
<translation type="unfinished">[ingen]</translation>
</message>
<message>
<source>Process RSS Updates On</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

8
rdadmin/rdadmin_nn.ts

@ -3571,6 +3571,14 @@ Overwrite?</source>
<source>Progress</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[none]</source>
<translation type="unfinished">[ingen]</translation>
</message>
<message>
<source>Process RSS Updates On</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

8
rdadmin/rdadmin_pt_BR.ts

@ -3620,6 +3620,14 @@ Overwrite?</source>
<source>Progress</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>[none]</source>
<translation type="unfinished">[Nenhum]</translation>
</message>
<message>
<source>Process RSS Updates On</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditStation</name>

114
rdcastmanager/edit_cast.cpp

@ -32,7 +32,6 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
cast_cast=new RDPodcast(rda->config(),cast_id);
cast_feed=new RDFeed(cast_cast->feedId(),rda->config());
cast_status=cast_cast->status();
setWindowTitle("RDCastManager - "+tr("Editing PodCast"));
//
// Active Checkbox
@ -43,6 +42,17 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
cast_active_label->setFont(labelFont());
cast_active_label->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
//
// Item Origin
//
cast_item_origin_edit=new QLineEdit(this);
cast_item_origin_edit->setReadOnly(true);
cast_item_origin_edit->setMaxLength(64);
cast_item_origin_label=
new QLabel(cast_item_origin_edit,tr("Posted At:"),this);
cast_item_origin_label->setFont(labelFont());
cast_item_origin_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
//
// Item Title
//
@ -127,18 +137,13 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
new QLabel(cast_item_effective_edit,tr("Air Date/Time:"),this);
cast_item_effective_label->setFont(labelFont());
cast_item_effective_label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
//
// Item Origin
//
cast_item_origin_edit=new QLineEdit(this);
cast_item_origin_edit->setReadOnly(true);
cast_item_origin_edit->setMaxLength(64);
cast_item_origin_label=
new QLabel(cast_item_origin_edit,tr("Posted At:"),this);
cast_item_origin_label->setFont(labelFont());
cast_item_origin_label->
cast_item_effective_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter);
cast_item_effective_button=new QPushButton(this);
cast_item_effective_button->setFont(subButtonFont());
cast_item_effective_button->setText(tr("&Select Date"));
connect(cast_item_effective_button,SIGNAL(clicked()),
this,SLOT(effectiveSelectData()));
//
// Item Expiration
@ -157,15 +162,15 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
cast_item_expiration_box_label->
setEnabled(cast_status!=RDPodcast::StatusExpired);
cast_item_expiration_edit=new QDateEdit(this);
cast_item_expiration_edit=new QDateTimeEdit(this);
cast_item_expiration_edit->setDisplayFormat("MM/dd/yyyy hh:mm:ss");
cast_item_expiration_label=
new QLabel(cast_item_expiration_edit,tr("Expires On")+":",this);
new QLabel(cast_item_expiration_edit,tr("at"),this);
cast_item_expiration_label->setFont(labelFont());
cast_item_expiration_label->
setAlignment(Qt::AlignRight|Qt::AlignVCenter);
cast_item_expiration_label->setAlignment(Qt::AlignCenter);
cast_item_expiration_button=new QPushButton(this);
cast_item_expiration_button->setFont(subButtonFont());
cast_item_expiration_button->setText(tr("&Select"));
cast_item_expiration_button->setText(tr("&Select Date"));
connect(cast_item_expiration_button,SIGNAL(clicked()),
this,SLOT(expirationSelectData()));
cast_item_expiration_edit->setEnabled(cast_status!=RDPodcast::StatusExpired);
@ -195,9 +200,11 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
//
// Populate Values
//
setWindowTitle("RDCastManager - "+tr("Editing PodCast")+
+" [ID: "+QString().sprintf("%u",cast_cast->id())+"]");
cast_item_title_edit->setText(cast_cast->itemTitle());
cast_item_author_edit->setText(cast_cast->itemAuthor());
cast_item_origin_edit->setText(RDUtcToLocal(cast_cast->originDateTime()).
cast_item_origin_edit->setText(cast_cast->originDateTime().
toString("MM/dd/yyyy - hh:mm:ss"));
cast_item_category_edit->setText(cast_cast->itemCategory());
cast_item_category_label->
@ -212,15 +219,18 @@ EditCast::EditCast(unsigned cast_id,QWidget *parent)
cast_item_image_box->setCategoryId(cast_feed->id());
cast_item_image_box->setCurrentImageId(cast_cast->itemImageId());
cast_item_comments_edit->setText(cast_cast->itemComments());
cast_item_effective_edit->
setDateTime(RDUtcToLocal(cast_cast->effectiveDateTime()));
if(cast_cast->shelfLife()>0) {
cast_item_effective_edit->setDateTime(cast_cast->effectiveDateTime());
if(!cast_cast->expirationDateTime().isNull()) {
cast_item_expiration_box->setCurrentItem(1);
}
cast_item_expiration_edit->setDateTime(cast_cast->expirationDateTime());
cast_item_expiration_edit->
setDate(RDUtcToLocal(cast_cast->originDateTime()).date().
addDays(cast_cast->shelfLife()));
expirationSelectedData(cast_item_expiration_box->currentItem());
setEnabled(cast_item_expiration_box->currentItem());
cast_item_expiration_button->
setEnabled(cast_item_expiration_box->currentItem());
cast_item_expiration_label->
setEnabled(cast_item_expiration_box->currentItem());
switch(cast_status) {
case RDPodcast::StatusActive:
cast_active_check->setChecked(true);
@ -252,7 +262,7 @@ EditCast::~EditCast()
QSize EditCast::sizeHint() const
{
return QSize(640,480);
return QSize(640,440);
}
@ -262,12 +272,29 @@ QSizePolicy EditCast::sizePolicy() const
}
void EditCast::effectiveSelectData()
{
QDate current_date=QDate::currentDate();
QDate date=cast_item_effective_edit->date();
RDDateDialog *dd=
new RDDateDialog(current_date.year(),current_date.year()+10,this);
if(dd->exec(&date)==0) {
cast_item_effective_edit->setDate(date);
}
delete dd;
}
void EditCast::expirationSelectedData(int state)
{
state=state&&(cast_status!=RDPodcast::StatusExpired);
cast_item_expiration_edit->setEnabled(state);
cast_item_expiration_button->setEnabled(state);
cast_item_expiration_label->setEnabled(state);
if(state) {
cast_item_expiration_edit->setDate(QDate::currentDate().addDays(1));
}
}
@ -275,9 +302,9 @@ void EditCast::expirationSelectData()
{
QDate current_date=QDate::currentDate();
QDate date=cast_item_expiration_edit->date();
RDDateDialog *dd=
new RDDateDialog(current_date.year(),current_date.year()+10,this);
new RDDateDialog(1970,current_date.year()+10,this);
if(dd->exec(&date)==0) {
cast_item_expiration_edit->setDate(date);
}
@ -297,19 +324,18 @@ void EditCast::okData()
cast_cast->setItemExplicit(cast_item_explicit_check->isChecked());
cast_cast->setItemImageId(cast_item_image_box->currentImageId());
cast_cast->setItemComments(cast_item_comments_edit->text());
cast_cast->
setEffectiveDateTime(RDLocalToUtc(cast_item_effective_edit->dateTime()));
cast_cast->setEffectiveDateTime(cast_item_effective_edit->dateTime());
if(cast_active_check->isEnabled()) {
if(cast_item_expiration_box->currentItem()) {
int shelf_life=RDUtcToLocal(cast_cast->originDateTime()).date().
int shelf_life=cast_cast->originDateTime().date().
daysTo(cast_item_expiration_edit->date());
if(shelf_life<1) {
shelf_life=1;
}
cast_cast->setShelfLife(shelf_life);
cast_cast->setExpirationDateTime(cast_item_expiration_edit->dateTime());
}
else {
cast_cast->setShelfLife(0);
cast_cast->setExpirationDateTime(QDateTime());
}
if(cast_active_check->isChecked()) {
cast_cast->setStatus(RDPodcast::StatusActive);
@ -319,10 +345,6 @@ void EditCast::okData()
}
}
cast_feed->
setLastBuildDateTime(RDLocalToUtc(QDateTime(QDate::currentDate(),
QTime::currentTime())));
if(!cast_feed->postXmlConditional("RDCastManager",this)) {
return;
}
@ -418,21 +440,19 @@ void EditCast::resizeEvent(QResizeEvent *e)
//
// Air Date/Time
//
cast_item_effective_edit->setGeometry(135,h-157,150,20);
cast_item_effective_label->setGeometry(20,h-157,110,20);
cast_item_effective_label->setGeometry(20,h-154,110,20);
cast_item_effective_edit->setGeometry(135,h-154,150,20);
cast_item_effective_button->setGeometry(295,h-156,75,24);
//
// Cast Expires
// Cast Expiration
//
cast_item_expiration_box->setGeometry(135,h-135,50,20);
cast_item_expiration_box_label->setGeometry(20,h-135,110,20);
cast_item_expiration_box_label->setGeometry(20,h-126,110,20);
cast_item_expiration_box->setGeometry(135,h-126,50,20);
//
// Expires On
//
cast_item_expiration_edit->setGeometry(135,h-113,95,20);
cast_item_expiration_label->setGeometry(20,h-113,110,20);
cast_item_expiration_button->setGeometry(240,h-113,50,20);
cast_item_expiration_label->setGeometry(190,h-126,20,20);
cast_item_expiration_edit->setGeometry(215,h-126,150,20);
cast_item_expiration_button->setGeometry(375,h-128,75,24);
//
// Buttons

8
rdcastmanager/edit_cast.h

@ -46,6 +46,7 @@ class EditCast : public RDDialog
QSizePolicy sizePolicy() const;
private slots:
void effectiveSelectData();
void expirationSelectedData(int state);
void expirationSelectData();
void okData();
@ -57,6 +58,8 @@ class EditCast : public RDDialog
private:
RDFeed *cast_feed;
RDPodcast *cast_cast;
QLabel *cast_item_origin_label;
QLineEdit *cast_item_origin_edit;
QLabel *cast_item_title_label;
QLineEdit *cast_item_title_edit;
QLabel *cast_item_author_label;
@ -73,17 +76,16 @@ class EditCast : public RDDialog
RDImagePickerBox *cast_item_image_box;
QLabel *cast_item_comments_label;
QLineEdit *cast_item_comments_edit;
QLabel *cast_item_origin_label;
QLineEdit *cast_item_origin_edit;
QLabel *cast_item_expiration_box_label;
QComboBox *cast_item_expiration_box;
QLabel *cast_item_expiration_label;
QCheckBox *cast_active_check;
QLabel *cast_active_label;
QPushButton *cast_item_expiration_button;
QDateEdit *cast_item_expiration_edit;
QDateTimeEdit *cast_item_expiration_edit;
QLabel *cast_item_effective_label;
QDateTimeEdit *cast_item_effective_edit;
QPushButton *cast_item_effective_button;
QPushButton *cast_ok_button;
QPushButton *cast_cancel_button;
RDPodcast::Status cast_status;

31
rdcastmanager/list_casts.cpp