2021-01-17 Fred Gleason <fredg@paravelsystems.com>

* Removed all global variables from rdairplay(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-01-17 13:43:44 -05:00
parent d18cfa89e5
commit 834ea996fd
9 changed files with 42 additions and 87 deletions

View File

@ -20816,3 +20816,5 @@
2021-01-17 Fred Gleason <fredg@paravelsystems.com>
* Restore support for cart notes in rdlibrary(1).
* Added support for cart notes in the 'RDCartDialog' dialog.
2021-01-17 Fred Gleason <fredg@paravelsystems.com>
* Removed all global variables from rdairplay(1).

View File

@ -2,7 +2,7 @@
##
## Automake.am for rivendell/rdairplay
##
## (C) 2002-2008,2016-2018 Fred Gleason <fredg@paravelsystems.com>
## (C) 2002-2021 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
@ -44,7 +44,6 @@ bin_PROGRAMS = rdairplay
dist_rdairplay_SOURCES = button_log.cpp button_log.h\
edit_event.cpp edit_event.h\
globals.h\
hourselector.cpp hourselector.h\
lib_listview.cpp lib_listview.h\
list_log.cpp list_log.h\

View File

@ -1,36 +0,0 @@
// globals.h
//
// Global Variable Declarations for RDAirPlay
//
// (C) Copyright 2002-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
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef GLOBALS_H
#define GLOBALS_H
#include <rdaudio_port.h>
#include <rdevent_player.h>
#include <rdcart_dialog.h>
//
// Global Resources
//
extern RDAudioPort *rdaudioport_conf;
extern RDEventPlayer *rdevent_player;
extern RDCartDialog *rdcart_dialog;
#endif // GLOBALS_H

View File

@ -25,7 +25,6 @@
#include <rddb.h>
#include <rdescape_string.h>
#include "globals.h"
#include "list_logs.h"
ListLogs::ListLogs(RDLogPlay *log,QWidget *parent)

View File

@ -25,7 +25,6 @@
#include <rdescape_string.h>
#include <rdmacro.h>
#include "globals.h"
#include "button_log.h"
#include "rdairplay.h"

View File

@ -18,12 +18,12 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#include <qpainter.h>
#include <QMouseEvent>
#include <QPainter>
#include <rdconf.h>
#include "colors.h"
#include "globals.h"
#include "loglinebox.h"
#include "../icons/play.xpm"

View File

@ -24,7 +24,6 @@
#include <rdapplication.h>
#include "colors.h"
#include "globals.h"
#include "post_counter.h"
PostCounter::PostCounter(QWidget *parent)

View File

@ -2,7 +2,7 @@
//
// The On Air Playout Utility for Rivendell.
//
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
// (C) Copyright 2002-2021 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,19 +32,9 @@
#include <rddatedecode.h>
#include <rdescape_string.h>
#include "globals.h"
#include "rdairplay.h"
#include "wall_clock.h"
//
// Global Resources
//
RDEventPlayer *rdevent_player;
RDCartDialog *rdcart_dialog;
MainWidget *prog_ptr;
RDHotKeyList *rdkeylist;
RDHotkeys *rdhotkeys;
//
// Icons
//
@ -59,7 +49,6 @@ void SigHandler(int signo);
MainWidget::MainWidget(RDConfig *config,QWidget *parent)
: RDWidget(config,parent)
{
prog_ptr=this;
QString str;
int cards[3];
int ports[3];
@ -271,7 +260,7 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
//
// Macro Player
//
rdevent_player=new RDEventPlayer(rda->ripc(),this);
air_event_player=new RDEventPlayer(rda->ripc(),this);
//
// Log Machines
@ -282,7 +271,7 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
connect(rename_mapper,SIGNAL(mapped(int)),this,SLOT(logRenamedData(int)));
QString default_svcname=rda->airplayConf()->defaultSvc();
for(int i=0;i<RDAIRPLAY_LOG_QUANTITY;i++) {
air_log[i]=new RDLogPlay(i,rdevent_player,this);
air_log[i]=new RDLogPlay(i,air_event_player,this);
air_log[i]->setDefaultServiceName(default_svcname);
air_log[i]->setNowCart(rda->airplayConf()->logNowCart(i));
air_log[i]->setNextCart(rda->airplayConf()->logNextCart(i));
@ -338,7 +327,7 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
//
// Cart Picker
//
rdcart_dialog=new RDCartDialog(&air_add_filter,&air_add_group,
air_cart_dialog=new RDCartDialog(&air_add_filter,&air_add_group,
&air_add_schedcode,"RDAirPlay",false,this);
//
@ -514,7 +503,7 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
rda->airplayConf()->flashPanel(),
"RDAirPlay",
rda->airplayConf()->buttonLabelTemplate(),false,
rdevent_player,rdcart_dialog,this);
air_event_player,air_cart_dialog,this);
air_panel->setGeometry(510,140,air_panel->sizeHint().width(),
air_panel->sizeHint().height());
air_panel->setPauseEnabled(rda->airplayConf()->panelPauseEnabled());
@ -730,8 +719,8 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
//
// Create the HotKeyList object
//
rdkeylist=new RDHotKeyList();
rdhotkeys=new RDHotkeys(rda->config()->stationName(),"rdairplay");
air_keylist=new RDHotKeyList();
air_hotkeys=new RDHotkeys(rda->config()->stationName(),"rdairplay");
AltKeyHit=false;
CtrlKeyHit=false;
@ -967,14 +956,14 @@ void MainWidget::logChannelStartedData(int id,int mport,int card,int port)
if(air_start_gpo_matrices[RDAirPlayConf::MainLog1Channel]>=0) {
switch(air_channel_gpio_types[RDAirPlayConf::MainLog1Channel]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 0!",
air_start_gpo_matrices[RDAirPlayConf::MainLog1Channel],
air_start_gpo_lines[RDAirPlayConf::MainLog1Channel]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_start_gpo_matrices[RDAirPlayConf::MainLog1Channel],
air_start_gpo_lines[RDAirPlayConf::MainLog1Channel]+1));
@ -987,14 +976,14 @@ void MainWidget::logChannelStartedData(int id,int mport,int card,int port)
if(air_start_gpo_matrices[RDAirPlayConf::MainLog2Channel]>=0) {
switch(air_channel_gpio_types[RDAirPlayConf::MainLog2Channel]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 0!",
air_start_gpo_matrices[RDAirPlayConf::MainLog2Channel],
air_start_gpo_lines[RDAirPlayConf::MainLog2Channel]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_start_gpo_matrices[RDAirPlayConf::MainLog2Channel],
air_start_gpo_lines[RDAirPlayConf::MainLog2Channel]+1));
@ -1009,14 +998,14 @@ void MainWidget::logChannelStartedData(int id,int mport,int card,int port)
if(air_start_gpo_matrices[RDAirPlayConf::AuxLog1Channel]>=0) {
switch(air_channel_gpio_types[RDAirPlayConf::AuxLog1Channel]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 0!",
air_start_gpo_matrices[RDAirPlayConf::AuxLog1Channel],
air_start_gpo_lines[RDAirPlayConf::AuxLog1Channel]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_start_gpo_matrices[RDAirPlayConf::AuxLog1Channel],
air_start_gpo_lines[RDAirPlayConf::AuxLog1Channel]+1));
@ -1029,14 +1018,14 @@ void MainWidget::logChannelStartedData(int id,int mport,int card,int port)
if(air_start_gpo_matrices[RDAirPlayConf::AuxLog2Channel]>=0) {
switch(air_channel_gpio_types[RDAirPlayConf::AuxLog2Channel]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 0!",
air_start_gpo_matrices[RDAirPlayConf::AuxLog2Channel],
air_start_gpo_lines[RDAirPlayConf::AuxLog2Channel]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_start_gpo_matrices[RDAirPlayConf::AuxLog2Channel],
air_start_gpo_lines[RDAirPlayConf::AuxLog2Channel]+1));
@ -1057,14 +1046,14 @@ void MainWidget::logChannelStoppedData(int id,int mport,int card,int port)
if(air_stop_gpo_matrices[RDAirPlayConf::MainLog1Channel]>=0) {
switch(air_channel_gpio_types[RDAirPlayConf::MainLog1Channel]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 0 0!",
air_stop_gpo_matrices[RDAirPlayConf::MainLog1Channel],
air_stop_gpo_lines[RDAirPlayConf::MainLog1Channel]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_stop_gpo_matrices[RDAirPlayConf::MainLog1Channel],
air_stop_gpo_lines[RDAirPlayConf::MainLog1Channel]+1));
@ -1077,14 +1066,14 @@ void MainWidget::logChannelStoppedData(int id,int mport,int card,int port)
if(air_stop_gpo_matrices[RDAirPlayConf::MainLog2Channel]>=0) {
switch(air_channel_gpio_types[RDAirPlayConf::MainLog2Channel]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 0 0!",
air_stop_gpo_matrices[RDAirPlayConf::MainLog2Channel],
air_stop_gpo_lines[RDAirPlayConf::MainLog2Channel]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_stop_gpo_matrices[RDAirPlayConf::MainLog2Channel],
air_stop_gpo_lines[RDAirPlayConf::MainLog2Channel]+1));
@ -1099,14 +1088,14 @@ void MainWidget::logChannelStoppedData(int id,int mport,int card,int port)
if(air_stop_gpo_matrices[RDAirPlayConf::AuxLog1Channel]>=0) {
switch(air_channel_gpio_types[RDAirPlayConf::AuxLog1Channel]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 0 0!",
air_stop_gpo_matrices[RDAirPlayConf::AuxLog1Channel],
air_stop_gpo_lines[RDAirPlayConf::AuxLog1Channel]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_stop_gpo_matrices[RDAirPlayConf::AuxLog1Channel],
air_stop_gpo_lines[RDAirPlayConf::AuxLog1Channel]+1));
@ -1119,14 +1108,14 @@ void MainWidget::logChannelStoppedData(int id,int mport,int card,int port)
if(air_stop_gpo_matrices[RDAirPlayConf::AuxLog2Channel]>=0) {
switch(air_channel_gpio_types[RDAirPlayConf::AuxLog2Channel]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 0 0!",
air_stop_gpo_matrices[RDAirPlayConf::AuxLog2Channel],
air_stop_gpo_lines[RDAirPlayConf::AuxLog2Channel]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_stop_gpo_matrices[RDAirPlayConf::AuxLog2Channel],
air_stop_gpo_lines[RDAirPlayConf::AuxLog2Channel]+1));
@ -1147,14 +1136,14 @@ void MainWidget::panelChannelStartedData(int mport,int card,int port)
if(air_start_gpo_matrices[chan]>=0) {
switch(air_channel_gpio_types[chan]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 0!",
air_start_gpo_matrices[chan],
air_start_gpo_lines[chan]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_start_gpo_matrices[chan],
air_start_gpo_lines[chan]+1));
@ -1171,14 +1160,14 @@ void MainWidget::panelChannelStoppedData(int mport,int card,int port)
if(air_stop_gpo_matrices[chan]>=0) {
switch(air_channel_gpio_types[chan]) {
case RDAirPlayConf::LevelGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 0 0!",
air_stop_gpo_matrices[chan],
air_stop_gpo_lines[chan]+1));
break;
case RDAirPlayConf::EdgeGpio:
rdevent_player->
air_event_player->
exec(QString().sprintf("GO %d %d 1 300!",
air_stop_gpo_matrices[chan],
air_stop_gpo_lines[chan]+1));
@ -1838,7 +1827,7 @@ void MainWidget::keyPressEvent(QKeyEvent *e)
void MainWidget::keyReleaseEvent(QKeyEvent *e)
{
int keyhit = e->key();
QString mystring=(*rdkeylist).GetKeyCode(keyhit);
QString mystring=(*air_keylist).GetKeyCode(keyhit);
QString hotkeystrokes;
QString hot_label;
QString temp_string;
@ -1888,16 +1877,16 @@ void MainWidget::keyReleaseEvent(QKeyEvent *e)
if (keystrokecount == 0)
hotkeystrokes = QString ("");
if (AltKeyHit) {
hotkeystrokes = (*rdkeylist).GetKeyCode(Qt::Key_Alt);
hotkeystrokes = (*air_keylist).GetKeyCode(Qt::Key_Alt);
hotkeystrokes += QString(" + ");
}
if (CtrlKeyHit) {
if (AltKeyHit) {
hotkeystrokes += (*rdkeylist).GetKeyCode(Qt::Key_Control);
hotkeystrokes += (*air_keylist).GetKeyCode(Qt::Key_Control);
hotkeystrokes += QString (" + ");
}
else {
hotkeystrokes = (*rdkeylist).GetKeyCode(Qt::Key_Control);
hotkeystrokes = (*air_keylist).GetKeyCode(Qt::Key_Control);
hotkeystrokes += QString (" + ");
}
}
@ -1910,7 +1899,7 @@ void MainWidget::keyReleaseEvent(QKeyEvent *e)
if (hotkeystrokes.length() > 0) {
hot_label=(*rdhotkeys).GetRowLabel(RDEscapeString(rda->config()->stationName()),
hot_label=(*air_hotkeys).GetRowLabel(RDEscapeString(rda->config()->stationName()),
(const char *)"airplay",(const char *)hotkeystrokes);
if (hot_label.length()>0) {
@ -2237,7 +2226,7 @@ void MainWidget::SetActionMode(StartButton::Mode mode)
if(air_panel!=NULL) {
air_panel->setActionMode(RDAirPlayConf::Normal);
}
if(rdcart_dialog->exec(&air_add_cart,RDCart::All,0,0,
if(air_cart_dialog->exec(&air_add_cart,RDCart::All,0,0,
rda->user()->name(),rda->user()->password())==0) {
SetActionMode(StartButton::AddTo);
}

View File

@ -192,6 +192,10 @@ class MainWidget : public RDWidget
RDAirPlayConf::GpioType air_channel_gpio_types[RDAirPlayConf::LastChannel];
std::map<unsigned,QTimer *> air_channel_timers[2];
RD3EmptyCart *air_empty_cart;
RDCartDialog *air_cart_dialog;
RDEventPlayer *air_event_player;
RDHotKeyList *air_keylist;
RDHotkeys *air_hotkeys;
};