2021-09-16 Fred Gleason <fredg@paravelsystems.com>

* Removed the vestigal 'Hot Keys' capability.
	* Modified the 'Start on SpaceBar' action in rdairplay(1) so as to
	activate upon *release* of the spacebar.
	* Fixed a regression that broke the Alt-X keybinding in
	rdairplay(1).

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-09-16 15:12:38 -04:00
parent db8652b13e
commit 6ec4cd86e7
9 changed files with 17 additions and 515 deletions

View File

@ -22436,3 +22436,9 @@
'RDAirPlayConf::setLogoPath()' methods. 'RDAirPlayConf::setLogoPath()' methods.
* Added a 'Logo Image' control to the 'Configure RDAirPlay' dialog * Added a 'Logo Image' control to the 'Configure RDAirPlay' dialog
in rdadmin(1). in rdadmin(1).
2021-09-16 Fred Gleason <fredg@paravelsystems.com>
* Removed the vestigal 'Hot Keys' capability.
* Modified the 'Start on SpaceBar' action in rdairplay(1) so as to
activate upon *release* of the spacebar.
* Fixed a regression that broke the Alt-X keybinding in
rdairplay(1).

View File

@ -1,6 +1,7 @@
This note lists DB fields that are currently unused and may be removed This note lists DB structures that are currently unused and may be removed
in future. in future.
GROUPS.ENABLE_NOW_NEXT GROUPS.ENABLE_NOW_NEXT
LOGS.INCLUDE_IMPORT_MARKERS LOGS.INCLUDE_IMPORT_MARKERS
SERVICES.INCLUDE_IMPORT_MARKERS SERVICES.INCLUDE_IMPORT_MARKERS
RDHOTKEYS

View File

@ -153,8 +153,6 @@ dist_librd_la_SOURCES = dbversion.h\
rdgrouplistmodel.cpp rdgrouplistmodel.h\ rdgrouplistmodel.cpp rdgrouplistmodel.h\
rdhash.cpp rdhash.h\ rdhash.cpp rdhash.h\
rdhostvarlistmodel.cpp rdhostvarlistmodel.h\ rdhostvarlistmodel.cpp rdhostvarlistmodel.h\
rdhotkeys.cpp rdhotkeys.h\
rdhotkeylist.cpp rdhotkeylist.h\
rdidvalidator.cpp rdidvalidator.h\ rdidvalidator.cpp rdidvalidator.h\
rdiconengine.cpp rdiconengine.h\ rdiconengine.cpp rdiconengine.h\
rdimagepickerbox.cpp rdimagepickerbox.h\ rdimagepickerbox.cpp rdimagepickerbox.h\

View File

@ -1,125 +0,0 @@
// rdhotkeylist.cpp
//
// An Abstract of the rdhotkeylist
//
// (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
// 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.
//
#include<rdhotkeylist.h>
RDHotKeyList::RDHotKeyList( )
{
hotkeylist.resize(0);
BuildKeyList();
}
RDHotKeyList::~RDHotKeyList()
{
hotkeylist.clear();
}
void RDHotKeyList::BuildKeyList( )
{
char qtpath[256];
char keyfile[256];
char line[256];
FILE *hkeyfile;
char enumstring[11] = "enum Key {";
QString KeyString;
QString KeyHex;
QString Filestring;
keyList CurKey;
char *p = {0};
if(getenv("QTDIR")==NULL) {
return;
}
strcpy(qtpath, (const char *) getenv("QTDIR"));
strcpy(keyfile,qtpath);
strcat(keyfile,"/include/qnamespace.h");
hkeyfile = fopen(keyfile,"r");
if (hkeyfile==NULL) {
return;
}
if (fgets(line,256,hkeyfile) !=NULL) {
while ((p = strstr(line,enumstring))== NULL ) {
if (fgets(line,256,hkeyfile) == NULL) {
break;
}
}
if (p != NULL) {
while ( ( fgets(line,256,hkeyfile) != NULL) && (!(strstr(line,"}")) ) ) {
QString buf = cleanStrings(line);
int acomment = buf.indexOf("//");
int eqsign = buf.indexOf("=");
if ((eqsign != -1) && (acomment != 0) ) {
KeyString = buf.left((eqsign ));
KeyString = KeyString.mid(4); // Remove 'Key_'
int comma = buf.indexOf(",");
if (comma != -1) {
KeyHex = buf.mid((eqsign + 1),
(comma - eqsign)-1 );
}
else {
int comment = buf.indexOf("//");
if (comment != -1) {
KeyHex = buf.mid( (eqsign+1),
(comment - eqsign) );
}
else {
KeyHex = buf.mid( (eqsign+1),
(buf.length() - eqsign) );
}
}
bool ok;
int hotkey_int = KeyHex.toInt(&ok,16); //Convert to decimal
if (ok) {
CurKey.decvalue = hotkey_int;
CurKey.stringvalue = KeyString;
hotkeylist.push_back(CurKey) ;
}
}
}
}
}
fclose(hkeyfile);
}
QString RDHotKeyList::cleanStrings( const QString sent)
{
QString ret;
for(int i=0;i<sent.length();i++) {
if((sent.at(i)!=QChar('\n'))&&(sent.at(i)!=QChar('\t'))) {
ret+=sent.at(i);
}
}
return ret;
}
QString RDHotKeyList::GetKeyCode(int number)
{
for (unsigned i = 0; i < hotkeylist.size(); i++) {
if ((hotkeylist.at(i).decvalue) == number){
return hotkeylist.at(i).stringvalue;
}
}
return (QString(""));
}

View File

@ -1,48 +0,0 @@
// rdhotkeylist.h
//
// Abstract a Rivendell HotKey List from QT Key Library entries
//
// (C) Copyright 2010,2016 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.
//
// written by Todd Baker bakert@rfa.org
#ifndef RDHOTKEYLIST_H
#define RDHOTKEYLIST_H
#include <vector>
#include <qstring.h>
#include <qfile.h>
struct keyList {
int decvalue ;
QString stringvalue;
};
class RDHotKeyList
{
public:
RDHotKeyList( );
~RDHotKeyList( ) ;
void BuildKeyList( );
QString GetKeyCode(int);
private:
std::vector<keyList> hotkeylist;
QString cleanStrings(const QString cleanstring);
};
#endif

View File

@ -1,116 +0,0 @@
// rdhotkeys.cpp
//
// Abstract an RDHotKeys Configuration.
//
// (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
// 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.
//
#include "rdconf.h"
#include "rddb.h"
#include "rdescape_string.h"
#include "rdhotkeys.h"
RDHotkeys::RDHotkeys(const QString &station,const QString &module)
{
QString sql;
RDSqlQuery *q;
station_hotkeys=station;
module_name=module;
sql=QString("select `STATION_NAME` from `RDHOTKEYS` where ")+
"`STATION_NAME`='"+RDEscapeString(station_hotkeys)+"' && "+
"`MODULE_NAME`='"+RDEscapeString(module_name)+"'";
q=new RDSqlQuery(sql);
if(!q->first()) {
InsertHotkeys();
}
delete q;
}
QString RDHotkeys::station() const
{
return station_hotkeys;
}
QString RDHotkeys::GetRowLabel(const QString &station,const QString &module,const QString &value) const
{
RDSqlQuery *q;
QString sql;
QString hotkey_label;
sql=QString::asprintf("select `KEY_LABEL` from `RDHOTKEYS` where ")+
"`STATION_NAME`='"+RDEscapeString(station)+"' && "+
"`MODULE_NAME`='"+RDEscapeString(module)+"' && "+
"`KEY_VALUE`='"+RDEscapeString(value)+"'";
q=new RDSqlQuery(sql);
if(!q->first()) {
hotkey_label=QString("");
}
else {
hotkey_label=q->value(0).toString();
}
delete q;
return hotkey_label;
}
void RDHotkeys::InsertHotkeys() const
{
QString sql;
QStringList labels;
labels.push_back(QObject::tr("Start Line 1"));
labels.push_back(QObject::tr("Stop Line 1"));
labels.push_back(QObject::tr("Pause Line 1"));
labels.push_back(QObject::tr("Start Line 2"));
labels.push_back(QObject::tr("Stop Line 2"));
labels.push_back(QObject::tr("Pause Line 2"));
labels.push_back(QObject::tr("Start Line 3"));
labels.push_back(QObject::tr("Stop Line 3"));
labels.push_back(QObject::tr("Pause Line 3"));
labels.push_back(QObject::tr("Start Line 4"));
labels.push_back(QObject::tr("Stop Line 4"));
labels.push_back(QObject::tr("Pause Line 4"));
labels.push_back(QObject::tr("Start Line 5"));
labels.push_back(QObject::tr("Stop Line 5"));
labels.push_back(QObject::tr("Pause Line 5"));
labels.push_back(QObject::tr("Start Line 6"));
labels.push_back(QObject::tr("Stop Line 6"));
labels.push_back(QObject::tr("Pause Line 6"));
labels.push_back(QObject::tr("Start Line 7"));
labels.push_back(QObject::tr("Stop Line 7"));
labels.push_back(QObject::tr("Pause Line 7"));
labels.push_back(QObject::tr("Add"));
labels.push_back(QObject::tr("Delete"));
labels.push_back(QObject::tr("Copy"));
labels.push_back(QObject::tr("Move"));
labels.push_back(QObject::tr("Sound Panel"));
labels.push_back(QObject::tr("Main Log"));
labels.push_back(QObject::tr("Aux Log 1"));
labels.push_back(QObject::tr("Aux Log 2"));
for(int i=0;i<labels.size();i++) {
sql=QString("insert into `RDHOTKEYS` set ")+
"`STATION_NAME`='"+RDEscapeString(station_hotkeys)+"',"+
"`MODULE_NAME`='airplay',"+
QString::asprintf("`KEY_ID`=%u,",i+1)+
"`KEY_LABEL`='"+RDEscapeString(labels[i])+"'";
RDSqlQuery::apply(sql);
}
}

View File

@ -1,41 +0,0 @@
// rdlogedit_conf.h
//
// Abstract RDHotkeys Configuration
//
// (C) Copyright 2002-2003,2016 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 RDHOTKEYS_H
#define RDHOTKEYS_H
#include <qsqldatabase.h>
class RDHotkeys
{
public:
RDHotkeys(const QString &station,const QString &module);
QString station() const;
int inputCard() const;
QString GetRowLabel(const QString &station,const QString &value,const QString &module) const;
private:
void InsertHotkeys() const;
QString station_hotkeys;
QString module_name;
};
#endif // RDHOTKEYS_H

View File

@ -727,14 +727,6 @@ MainWidget::MainWidget(RDConfig *config,QWidget *parent)
} }
} }
//
// Create the HotKeyList object
//
air_keylist=new RDHotKeyList();
air_hotkeys=new RDHotkeys(rda->config()->stationName(),"rdairplay");
AltKeyHit=false;
CtrlKeyHit=false;
// //
// Set Signal Handlers // Set Signal Handlers
// //
@ -1790,50 +1782,8 @@ void MainWidget::transportChangedData()
} }
void MainWidget::keyPressEvent(QKeyEvent *e)
{
switch(e->key()) {
case Qt::Key_Space:
if(rda->airplayConf()->barAction()&&(air_log[0]->nextLine()>=0)) {
air_log[0]->play(air_log[0]->nextLine(),RDLogLine::StartManual);
}
break;
case Qt::Key_X:
if(((e->modifiers()&Qt::AltModifier)!=0)&&
((e->modifiers()&Qt::ShiftModifier)==0)&&
((e->modifiers()&Qt::ControlModifier)==0)) {
QCloseEvent *ce=new QCloseEvent();
closeEvent(ce);
delete ce;
}
break;
case Qt::Key_Alt:
keystrokecount++;
AltKeyHit = true;
break;
case Qt::Key_Control:
keystrokecount++;
CtrlKeyHit = true;
break;
default:
QWidget::keyPressEvent(e);
break;
}
}
void MainWidget::keyReleaseEvent(QKeyEvent *e) void MainWidget::keyReleaseEvent(QKeyEvent *e)
{ {
int keyhit = e->key();
QString mystring=(*air_keylist).GetKeyCode(keyhit);
QString hotkeystrokes;
QString hot_label;
QString temp_string;
switch(e->key()) { switch(e->key()) {
case Qt::Key_Space: case Qt::Key_Space:
switch(air_bar_action) { switch(air_bar_action) {
@ -1848,131 +1798,16 @@ void MainWidget::keyReleaseEvent(QKeyEvent *e)
break; break;
} }
break; break;
}
// Try to figure out if this is a hot key combination
if ( (e->key() == Qt::Key_Shift) ||
(e->key() == Qt::Key_Up) ||
(e->key() == Qt::Key_Left) ||
(e->key() == Qt::Key_Right) ||
(e->key() == Qt::Key_Down) ) {
QWidget::keyReleaseEvent(e);
keystrokecount = 0;
hotkeystrokes = QString ("");
return;
}
if ((e->key() == Qt::Key_Alt) || case Qt::Key_X:
(e->key() == Qt::Key_Control)) { if(((e->modifiers()&Qt::AltModifier)!=0)&&
if (keystrokecount != 0 ) hotkeystrokes = QString (""); ((e->modifiers()&Qt::ShiftModifier)==0)&&
if (AltKeyHit) { ((e->modifiers()&Qt::ControlModifier)==0)) {
AltKeyHit = false; QCloseEvent *ce=new QCloseEvent();
if (keystrokecount > 0) keystrokecount--; closeEvent(ce);
} delete ce;
if (CtrlKeyHit) { }
CtrlKeyHit = false; break;
if (keystrokecount > 0) keystrokecount--;
}
return;
}
if (!e->isAutoRepeat()) {
if (keystrokecount == 0)
hotkeystrokes = QString ("");
if (AltKeyHit) {
hotkeystrokes = (*air_keylist).GetKeyCode(Qt::Key_Alt);
hotkeystrokes += QString(" + ");
}
if (CtrlKeyHit) {
if (AltKeyHit) {
hotkeystrokes += (*air_keylist).GetKeyCode(Qt::Key_Control);
hotkeystrokes += QString (" + ");
}
else {
hotkeystrokes = (*air_keylist).GetKeyCode(Qt::Key_Control);
hotkeystrokes += QString (" + ");
}
}
hotkeystrokes += mystring;
keystrokecount = 0 ;
}
// Have any Hot Key Combinations now...
if (hotkeystrokes.length() > 0) {
hot_label=(*air_hotkeys).GetRowLabel(RDEscapeString(rda->config()->stationName()),
"airplay",hotkeystrokes.toUtf8().constData());
if (hot_label.length()>0) {
// "we found a keystroke label
if (hot_label=="Add")
{
addButtonData();
return;
}
if (hot_label=="Delete")
{
deleteButtonData();
return;
}
if (hot_label=="Copy")
{
copyButtonData();
return;
}
if (hot_label=="Move")
{
moveButtonData();
return;
}
if (hot_label=="Sound Panel")
{
panelButtonData();
return;
}
if (hot_label=="Main Log")
{
fullLogButtonData(0);
return;
}
if ((hot_label=="Aux Log 1") &&
(rda->airplayConf()->showAuxButton(0) ) )
{
fullLogButtonData(1);
return;
}
if ((hot_label=="Aux Log 2") &&
(rda->airplayConf()->showAuxButton(1) ) )
{
fullLogButtonData(2);
return;
}
for (int i = 1; i < 8 ; i++)
{
temp_string = QString::asprintf("Start Line %d",i);
if (hot_label==temp_string)
air_button_list->startButton(i-1);
temp_string = QString::asprintf("Stop Line %d",i);
if (hot_label==temp_string)
air_button_list->stopButtonHotkey(i-1);
temp_string = QString::asprintf("Pause Line %d",i);
if (hot_label==temp_string)
air_button_list->pauseButtonHotkey(i-1);
}
}
} }
QWidget::keyReleaseEvent(e); QWidget::keyReleaseEvent(e);
} }

View File

@ -22,8 +22,6 @@
#define RDAIRPLAY_H #define RDAIRPLAY_H
#include <rdemptycart.h> #include <rdemptycart.h>
#include <rdhotkeylist.h>
#include <rdhotkeys.h>
#include <rdinstancelock.h> #include <rdinstancelock.h>
#include <rdmainwindow.h> #include <rdmainwindow.h>
#include <rdmeterstrip.h> #include <rdmeterstrip.h>
@ -86,7 +84,6 @@ class MainWidget : public RDMainWindow
void transportChangedData(); void transportChangedData();
protected: protected:
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e); void keyReleaseEvent(QKeyEvent *e);
void closeEvent(QCloseEvent *); void closeEvent(QCloseEvent *);
void resizeEvent(QResizeEvent *e); void resizeEvent(QResizeEvent *e);
@ -158,9 +155,6 @@ class MainWidget : public RDMainWindow
QDateTime air_startup_datetime; QDateTime air_startup_datetime;
QPixmap *air_refresh_pixmap; QPixmap *air_refresh_pixmap;
QString air_editor_cmd; QString air_editor_cmd;
int keystrokecount;
bool AltKeyHit ;
bool CtrlKeyHit;
QFont air_message_fonts[AIR_MESSAGE_FONT_QUANTITY]; QFont air_message_fonts[AIR_MESSAGE_FONT_QUANTITY];
QFontMetrics *air_message_metrics[AIR_MESSAGE_FONT_QUANTITY]; QFontMetrics *air_message_metrics[AIR_MESSAGE_FONT_QUANTITY];
int air_audio_channels[RDAirPlayConf::LastChannel]; int air_audio_channels[RDAirPlayConf::LastChannel];
@ -177,8 +171,6 @@ class MainWidget : public RDMainWindow
RDEmptyCart *air_empty_cart; RDEmptyCart *air_empty_cart;
RDCartDialog *air_cart_dialog; RDCartDialog *air_cart_dialog;
RDEventPlayer *air_event_player; RDEventPlayer *air_event_player;
RDHotKeyList *air_keylist;
RDHotkeys *air_hotkeys;
TopStrip *air_top_strip; TopStrip *air_top_strip;
QLabel *air_bug_label; QLabel *air_bug_label;
}; };