mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 09:03:40 +02:00
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:
@@ -153,8 +153,6 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdgrouplistmodel.cpp rdgrouplistmodel.h\
|
||||
rdhash.cpp rdhash.h\
|
||||
rdhostvarlistmodel.cpp rdhostvarlistmodel.h\
|
||||
rdhotkeys.cpp rdhotkeys.h\
|
||||
rdhotkeylist.cpp rdhotkeylist.h\
|
||||
rdidvalidator.cpp rdidvalidator.h\
|
||||
rdiconengine.cpp rdiconengine.h\
|
||||
rdimagepickerbox.cpp rdimagepickerbox.h\
|
||||
|
@@ -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(""));
|
||||
}
|
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
@@ -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
|
Reference in New Issue
Block a user