mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-12 09:33:37 +02:00
2018-01-31 Fred Gleason <fredg@paravelsystems.com>
* Converted rdcartslots(1) to use RDApplication.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Dedicated Cart Slot Utility for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2012,2016-2018 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
|
||||
@@ -18,6 +18,8 @@
|
||||
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
//
|
||||
|
||||
#include <rdapplication.h>
|
||||
|
||||
#include "rdcartslots.h"
|
||||
|
||||
void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
@@ -36,7 +38,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if(rml->argQuantity()!=2) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -44,7 +46,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if((!ok)||(slotnum>=panel_slots.size())) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -52,7 +54,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
RDSlotOptions::CartDeckMode) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -60,7 +62,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if((!ok)||(cartnum>999999)) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -71,14 +73,14 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if(!panel_slots[slotnum]->load(cartnum)) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -86,7 +88,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if(rml->argQuantity()!=1) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -94,7 +96,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if((!ok)||(slotnum>=panel_slots.size())) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -102,20 +104,20 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
RDSlotOptions::CartDeckMode) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!panel_slots[slotnum]->play()) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -123,7 +125,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if(rml->argQuantity()!=1) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -131,7 +133,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if((!ok)||(slotnum>=panel_slots.size())) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -139,20 +141,20 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
RDSlotOptions::CartDeckMode) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!panel_slots[slotnum]->stop()) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -160,7 +162,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if(rml->argQuantity()!=2) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -168,7 +170,7 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if((!ok)||(slotnum>=panel_slots.size())) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -176,20 +178,20 @@ void MainWidget::RunLocalMacros(RDMacro *rml)
|
||||
if(!ok) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!panel_slots[slotnum]->breakAway(len)) {
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
panel_ripc->sendRml(rml);
|
||||
rda->ripc()->sendRml(rml);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Dedicated Cart Slot Utility for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2012,2016-2018 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
|
||||
@@ -32,12 +32,14 @@
|
||||
#include <qpainter.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
#include <rdcartslots.h>
|
||||
#include <rd.h>
|
||||
#include <rdcheck_daemons.h>
|
||||
#include <rddbheartbeat.h>
|
||||
#include <rdcmd_switch.h>
|
||||
#include <dbversion.h>
|
||||
#include <rd.h>
|
||||
#include <rdapplication.h>
|
||||
#include <rdcheck_daemons.h>
|
||||
#include <rdcmd_switch.h>
|
||||
#include <rddbheartbeat.h>
|
||||
|
||||
#include "rdcartslots.h"
|
||||
|
||||
//
|
||||
// Icons
|
||||
@@ -47,8 +49,7 @@
|
||||
MainWidget::MainWidget(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
bool skip_db_check=false;
|
||||
unsigned schema=0;
|
||||
QString err_msg;
|
||||
|
||||
//
|
||||
// Force a reasonable default font.
|
||||
@@ -57,12 +58,11 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
mfont.setPixelSize(12);
|
||||
qApp->setFont(mfont);
|
||||
|
||||
//
|
||||
// Load Local Configs
|
||||
//
|
||||
panel_config=new RDConfig(RD_CONF_FILE);
|
||||
panel_config->load();
|
||||
panel_config->setModuleName("RDCartSlots");
|
||||
rda=new RDApplication("RDCartSlots",this);
|
||||
if(!rda->open(&err_msg)) {
|
||||
QMessageBox::critical(this,"RDCartSlots - "+tr("Error"),err_msg);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
//
|
||||
// Load the command-line arguments
|
||||
@@ -71,7 +71,6 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
RDCARTSLOTS_USAGE);
|
||||
for(unsigned i=0;i<cmd->keys();i++) {
|
||||
if(cmd->key(i)=="--skip-db-check") {
|
||||
skip_db_check=true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,53 +85,18 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
//
|
||||
RDInitializeDaemons();
|
||||
|
||||
//
|
||||
// Open Database
|
||||
//
|
||||
QString err;
|
||||
QSqlDatabase *db=RDInitDb(&schema,&err);
|
||||
if(!db) {
|
||||
QMessageBox::warning(this,tr("Can't Connect"),err);
|
||||
exit(0);
|
||||
}
|
||||
if((schema!=RD_VERSION_DATABASE)&&(!skip_db_check)) {
|
||||
fprintf(stderr,
|
||||
"rdcastmanager: database version mismatch, should be %u, is %u\n",
|
||||
RD_VERSION_DATABASE,schema);
|
||||
exit(256);
|
||||
}
|
||||
new RDDbHeartbeat(panel_config->mysqlHeartbeatInterval(),this);
|
||||
|
||||
//
|
||||
// Allocate Global Resources
|
||||
//
|
||||
panel_station=new RDStation(panel_config->stationName());
|
||||
panel_system=new RDSystem();
|
||||
|
||||
//
|
||||
// RDAirPlay Configuration
|
||||
//
|
||||
panel_airplay_conf=new RDAirPlayConf(panel_config->stationName(),"RDAIRPLAY");
|
||||
|
||||
//
|
||||
// CAE Connection
|
||||
//
|
||||
panel_cae=new RDCae(panel_station,panel_config,parent);
|
||||
panel_cae->connectHost();
|
||||
rda->cae()->connectHost();
|
||||
|
||||
//
|
||||
// RIPC Connection
|
||||
//
|
||||
panel_ripc=new RDRipc(panel_station,panel_config,this);
|
||||
connect(panel_ripc,SIGNAL(userChanged()),this,SLOT(userData()));
|
||||
connect(panel_ripc,SIGNAL(rmlReceived(RDMacro *)),
|
||||
connect(rda->ripc(),SIGNAL(userChanged()),this,SLOT(userData()));
|
||||
connect(rda->ripc(),SIGNAL(rmlReceived(RDMacro *)),
|
||||
this,SLOT(rmlReceivedData(RDMacro *)));
|
||||
|
||||
//
|
||||
// User
|
||||
//
|
||||
panel_user=NULL;
|
||||
|
||||
//
|
||||
// Service Picker
|
||||
//
|
||||
@@ -141,32 +105,32 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
//
|
||||
// Macro Player
|
||||
//
|
||||
panel_player=new RDEventPlayer(panel_ripc,this);
|
||||
panel_player=new RDEventPlayer(rda->ripc(),this);
|
||||
|
||||
//
|
||||
// Dialogs
|
||||
//
|
||||
panel_cart_dialog=new RDCartDialog(&panel_filter,&panel_group,
|
||||
&panel_schedcode,panel_cae,panel_ripc,
|
||||
panel_station,panel_system,panel_config,
|
||||
&panel_schedcode,rda->cae(),rda->ripc(),
|
||||
rda->station(),rda->system(),rda->config(),
|
||||
this);
|
||||
panel_slot_dialog=new RDSlotDialog(tr("RDCartSlots"),this);
|
||||
panel_cue_dialog=new RDCueEditDialog(panel_cae,panel_station->cueCard(),
|
||||
panel_station->cuePort(),
|
||||
panel_cue_dialog=new RDCueEditDialog(rda->cae(),rda->station()->cueCard(),
|
||||
rda->station()->cuePort(),
|
||||
tr("RDCartSlots"),this);
|
||||
|
||||
//
|
||||
// Cart Slots
|
||||
//
|
||||
QTimer *timer=new QTimer(this);
|
||||
for(int i=0;i<panel_station->cartSlotColumns();i++) {
|
||||
for(int j=0;j<panel_station->cartSlotRows();j++) {
|
||||
for(int i=0;i<rda->station()->cartSlotColumns();i++) {
|
||||
for(int j=0;j<rda->station()->cartSlotRows();j++) {
|
||||
panel_slots.
|
||||
push_back(new RDCartSlot(panel_slots.size(),panel_ripc,panel_cae,
|
||||
panel_station,panel_config,panel_svcs_dialog,
|
||||
push_back(new RDCartSlot(panel_slots.size(),rda->ripc(),rda->cae(),
|
||||
rda->station(),rda->config(),panel_svcs_dialog,
|
||||
panel_slot_dialog,panel_cart_dialog,
|
||||
panel_cue_dialog,tr("RDCartSlots"),
|
||||
panel_airplay_conf,this));
|
||||
rda->airplayConf(),this));
|
||||
panel_slots.back()->
|
||||
setGeometry(10+i*(panel_slots.back()->sizeHint().width()+10),
|
||||
10+j*(panel_slots.back()->sizeHint().height()+5),
|
||||
@@ -177,7 +141,7 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
}
|
||||
}
|
||||
timer->start(METER_INTERVAL);
|
||||
panel_ripc->connectHost("localhost",RIPCD_TCP_PORT,panel_config->password());
|
||||
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
|
||||
|
||||
//
|
||||
// Fix the Window Size
|
||||
@@ -193,9 +157,9 @@ MainWidget::MainWidget(QWidget *parent)
|
||||
|
||||
QSize MainWidget::sizeHint() const
|
||||
{
|
||||
return QSize(10+panel_station->cartSlotColumns()*
|
||||
return QSize(10+rda->station()->cartSlotColumns()*
|
||||
(10+panel_slots[0]->size().width()),
|
||||
10+panel_station->cartSlotRows()*
|
||||
10+rda->station()->cartSlotRows()*
|
||||
(5+panel_slots[0]->size().height()));
|
||||
}
|
||||
|
||||
@@ -214,15 +178,12 @@ QSizePolicy MainWidget::sizePolicy() const
|
||||
|
||||
void MainWidget::userData()
|
||||
{
|
||||
if(panel_user!=NULL) {
|
||||
delete panel_user;
|
||||
}
|
||||
panel_user=new RDUser(panel_ripc->user());
|
||||
rda->user()->setName(rda->ripc()->user());
|
||||
for(unsigned i=0;i<panel_slots.size();i++) {
|
||||
panel_slots[i]->setUser(panel_user);
|
||||
panel_slots[i]->setUser(rda->user());
|
||||
}
|
||||
SetCaption();
|
||||
panel_ripc->sendOnairFlag();
|
||||
rda->ripc()->sendOnairFlag();
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +192,7 @@ void MainWidget::paintEvent(QPaintEvent *e)
|
||||
QPainter *p=new QPainter(this);
|
||||
p->setPen(Qt::black);
|
||||
p->setBrush(Qt::black);
|
||||
for(int i=1;i<panel_station->cartSlotColumns();i++) {
|
||||
for(int i=1;i<rda->station()->cartSlotColumns();i++) {
|
||||
p->fillRect(i*(panel_slots[0]->size().width()+10),10,
|
||||
5,size().height()-15,Qt::black);
|
||||
}
|
||||
@@ -252,8 +213,8 @@ void MainWidget::SetCaption()
|
||||
{
|
||||
QString service=tr("[None]");
|
||||
setCaption(tr("RDCartSlots")+" v"+VERSION+" - "+tr("Station")+": "+
|
||||
panel_config->stationName()+" "+tr("User")+": "+
|
||||
panel_ripc->user());
|
||||
rda->config()->stationName()+" "+tr("User")+": "+
|
||||
rda->ripc()->user());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// A Dedicated Cart Slot Utility for Rivendell.
|
||||
//
|
||||
// (C) Copyright 2012,2016 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2012,2016-2018 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
|
||||
@@ -66,12 +66,12 @@ class MainWidget : public QWidget
|
||||
private:
|
||||
void RunLocalMacros(RDMacro *rml);
|
||||
void SetCaption();
|
||||
RDConfig *panel_config;
|
||||
RDCae *panel_cae;
|
||||
RDRipc *panel_ripc;
|
||||
RDUser *panel_user;
|
||||
RDStation *panel_station;
|
||||
RDSystem *panel_system;
|
||||
// RDConfig *panel_config;
|
||||
// RDCae *panel_cae;
|
||||
// RDRipc *panel_ripc;
|
||||
// RDUser *panel_user;
|
||||
// RDStation *panel_station;
|
||||
// RDSystem *panel_system;
|
||||
RDEventPlayer *panel_player;
|
||||
QPixmap *lib_rivendell_map;
|
||||
QString panel_filter;
|
||||
@@ -82,7 +82,7 @@ class MainWidget : public QWidget
|
||||
RDSlotDialog *panel_slot_dialog;
|
||||
RDCueEditDialog *panel_cue_dialog;
|
||||
RDListSvcs *panel_svcs_dialog;
|
||||
RDAirPlayConf *panel_airplay_conf;
|
||||
// RDAirPlayConf *panel_airplay_conf;
|
||||
};
|
||||
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
@@ -18,7 +18,7 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Can't Connect</source>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
|
Reference in New Issue
Block a user