mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2026-01-15 17:11:33 +01:00
2019-10-01 Fred Gleason <fredg@paravelsystems.com>
* Added an 'RDDialog' class. * Added an 'RDWidget' class. * Refactored rdadmin(1) to use 'RDDialog' and 'RDWidget' base classes.
This commit is contained in:
@@ -111,6 +111,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rddebug.cpp rddebug.h\
|
||||
rddeck.cpp rddeck.h\
|
||||
rddelete.cpp rddelete.h\
|
||||
rddialog.cpp rddialog.h\
|
||||
rddownload.cpp rddownload.h\
|
||||
rddropbox.cpp rddropbox.h\
|
||||
rdedit_audio.cpp rdedit_audio.h\
|
||||
@@ -240,6 +241,7 @@ dist_librd_la_SOURCES = dbversion.h\
|
||||
rdwavepainter.cpp rdwavepainter.h\
|
||||
rdweb.cpp rdweb.h\
|
||||
rdwebresult.cpp rdwebresult.h\
|
||||
rdwidget.cpp rdwidget.h\
|
||||
rdxport_interface.h
|
||||
|
||||
|
||||
@@ -272,6 +274,7 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
||||
moc_rddatepicker.cpp\
|
||||
moc_rddbheartbeat.cpp\
|
||||
moc_rddelete.cpp\
|
||||
moc_rddialog.cpp\
|
||||
moc_rddownload.cpp\
|
||||
moc_rdedit_audio.cpp\
|
||||
moc_rdedit_panel_name.cpp\
|
||||
@@ -333,7 +336,8 @@ nodist_librd_la_SOURCES = moc_rdadd_cart.cpp\
|
||||
moc_rdunixserver.cpp\
|
||||
moc_rdunixsocket.cpp\
|
||||
moc_rdupload.cpp\
|
||||
moc_rdwavedata_dialog.cpp
|
||||
moc_rdwavedata_dialog.cpp\
|
||||
moc_rdwidget.cpp
|
||||
|
||||
librd_la_LDFLAGS = -release $(VERSION)
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ SOURCES += rddb.cpp
|
||||
SOURCES += rddbheartbeat.cpp
|
||||
SOURCES += rddebug.cpp
|
||||
SOURCES += rddeck.cpp
|
||||
SOURCES += rddialog.cpp
|
||||
SOURCES += rddropbox.cpp
|
||||
SOURCES += rdedit_audio.cpp
|
||||
SOURCES += rdedit_panel_name.cpp
|
||||
@@ -163,6 +164,7 @@ SOURCES += rdversion.cpp
|
||||
SOURCES += rdwavedata.cpp
|
||||
SOURCES += rdwavefile.cpp
|
||||
SOURCES += rdweb.cpp
|
||||
SOURCES += rdwidget.cpp
|
||||
SOURCES += schedcartlist.cpp
|
||||
SOURCES += schedruleslist.cpp
|
||||
|
||||
@@ -211,6 +213,7 @@ HEADERS += rddb.h
|
||||
HEADERS += rddbheartbeat.h
|
||||
HEADERS += rddebug.h
|
||||
HEADERS += rddeck.h
|
||||
HEADERS += rddialog.h
|
||||
HEADERS += rddropbox.h
|
||||
HEADERS += rdedit_audio.h
|
||||
HEADERS += rdedit_panel_name.h
|
||||
@@ -297,6 +300,7 @@ HEADERS += rduser.h
|
||||
HEADERS += rdversion.h
|
||||
HEADERS += rdwavedata.h
|
||||
HEADERS += rdweb.h
|
||||
HEADERS += rdwidget.h
|
||||
|
||||
TRANSLATIONS += librd_cs.ts
|
||||
TRANSLATIONS += librd_de.ts
|
||||
|
||||
@@ -153,6 +153,30 @@ QString RDConfig::audioStoreXportHostname() const
|
||||
}
|
||||
|
||||
|
||||
QString RDConfig::fontFamily() const
|
||||
{
|
||||
return conf_font_family;
|
||||
}
|
||||
|
||||
|
||||
int RDConfig::fontButtonSize() const
|
||||
{
|
||||
return conf_font_button_size;
|
||||
}
|
||||
|
||||
|
||||
int RDConfig::fontLabelSize() const
|
||||
{
|
||||
return conf_font_label_size;
|
||||
}
|
||||
|
||||
|
||||
int RDConfig::fontDataSize() const
|
||||
{
|
||||
return conf_font_data_size;
|
||||
}
|
||||
|
||||
|
||||
QString RDConfig::mysqlHostname() const
|
||||
{
|
||||
return conf_mysql_hostname;
|
||||
@@ -509,6 +533,11 @@ bool RDConfig::load()
|
||||
conf_audio_store_xport_hostname=
|
||||
profile->stringValue("AudioStore","XportHostname","localhost");
|
||||
|
||||
conf_font_family=profile->stringValue("Fonts","Family");
|
||||
conf_font_button_size=profile->intValue("Fonts","ButtonSize",-1);
|
||||
conf_font_label_size=profile->intValue("Fonts","LabelSize",-1);
|
||||
conf_font_data_size=profile->intValue("Fonts","DataSize",-1);
|
||||
|
||||
conf_provisioning_create_host=
|
||||
profile->boolValue("Provisioning","CreateHost");
|
||||
conf_provisioning_host_template=
|
||||
@@ -675,6 +704,10 @@ void RDConfig::clear()
|
||||
conf_audio_store_mount_type="";
|
||||
conf_audio_store_mount_options=RD_DEFAULT_AUDIO_STORE_MOUNT_OPTIONS;
|
||||
conf_audio_store_xport_hostname="";
|
||||
conf_font_family="";
|
||||
conf_font_button_size=-1;
|
||||
conf_font_label_size=-1;
|
||||
conf_font_data_size=-1;
|
||||
conf_audio_store_cae_hostname="";
|
||||
conf_jack_ports[0].clear();
|
||||
conf_jack_ports[1].clear();
|
||||
|
||||
@@ -92,6 +92,10 @@ class RDConfig
|
||||
QString audioStoreMountOptions() const;
|
||||
QString audioStoreCaeHostname() const;
|
||||
QString audioStoreXportHostname() const;
|
||||
QString fontFamily() const;
|
||||
int fontButtonSize() const;
|
||||
int fontLabelSize() const;
|
||||
int fontDataSize() const;
|
||||
int jackConnections() const;
|
||||
QString jackPort(int num,int endpt) const;
|
||||
bool disableMaintChecks() const;
|
||||
@@ -159,6 +163,10 @@ class RDConfig
|
||||
QString conf_audio_store_mount_options;
|
||||
QString conf_audio_store_xport_hostname;
|
||||
QString conf_audio_store_cae_hostname;
|
||||
QString conf_font_family;
|
||||
int conf_font_button_size;
|
||||
int conf_font_label_size;
|
||||
int conf_font_data_size;
|
||||
QString conf_http_user_agent;
|
||||
bool conf_disable_maint_checks;
|
||||
bool conf_lock_rdairplay_memory;
|
||||
|
||||
113
lib/rddialog.cpp
Normal file
113
lib/rddialog.cpp
Normal file
@@ -0,0 +1,113 @@
|
||||
// rddialog.cpp
|
||||
//
|
||||
// Base class for Rivendell modal dialogs.
|
||||
//
|
||||
// (C) Copyright 2019 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 "rddialog.h"
|
||||
|
||||
RDDialog::RDDialog(QWidget *parent,Qt::WindowFlags f)
|
||||
: QDialog(parent,f)
|
||||
{
|
||||
dialog_config=rda->config();
|
||||
MakeFonts();
|
||||
setFont(dataFont());
|
||||
}
|
||||
|
||||
|
||||
RDDialog::RDDialog(RDConfig *config,QWidget *parent,Qt::WindowFlags f)
|
||||
: QDialog(parent,f)
|
||||
{
|
||||
dialog_config=config;
|
||||
MakeFonts();
|
||||
}
|
||||
|
||||
|
||||
QFont RDDialog::buttonFont() const
|
||||
{
|
||||
return dialog_button_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDDialog::subButtonFont() const
|
||||
{
|
||||
return dialog_sub_button_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDDialog::sectionLabelFont() const
|
||||
{
|
||||
return dialog_section_label_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDDialog::labelFont() const
|
||||
{
|
||||
return dialog_label_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDDialog::subLabelFont() const
|
||||
{
|
||||
return dialog_sub_label_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDDialog::dataFont() const
|
||||
{
|
||||
return dialog_data_font;
|
||||
}
|
||||
|
||||
|
||||
void RDDialog::MakeFonts()
|
||||
{
|
||||
QString family=font().family();
|
||||
int button_size=font().pixelSize();
|
||||
int label_size=font().pixelSize();
|
||||
int data_size=font().pixelSize();
|
||||
|
||||
if(!dialog_config->fontFamily().isEmpty()) {
|
||||
family=dialog_config->fontFamily();
|
||||
}
|
||||
if(dialog_config->fontButtonSize()>0) {
|
||||
button_size=dialog_config->fontButtonSize();
|
||||
}
|
||||
if(dialog_config->fontLabelSize()>0) {
|
||||
label_size=dialog_config->fontLabelSize();
|
||||
}
|
||||
if(dialog_config->fontDataSize()>0) {
|
||||
data_size=dialog_config->fontDataSize();
|
||||
}
|
||||
|
||||
dialog_button_font=QFont(family,button_size,QFont::Bold);
|
||||
dialog_button_font.setPixelSize(button_size);
|
||||
|
||||
dialog_sub_button_font=QFont(family,button_size-2,QFont::Normal);
|
||||
dialog_sub_button_font.setPixelSize(button_size-2);
|
||||
|
||||
dialog_section_label_font=QFont(family,label_size+2,QFont::Bold);
|
||||
dialog_section_label_font.setPixelSize(label_size+2);
|
||||
|
||||
dialog_label_font=QFont(family,label_size,QFont::Bold);
|
||||
dialog_label_font.setPixelSize(label_size);
|
||||
|
||||
dialog_sub_label_font=QFont(family,label_size,QFont::Normal);
|
||||
dialog_sub_label_font.setPixelSize(label_size);
|
||||
|
||||
dialog_data_font=QFont(family,data_size,QFont::Normal);
|
||||
dialog_data_font.setPixelSize(data_size);
|
||||
}
|
||||
54
lib/rddialog.h
Normal file
54
lib/rddialog.h
Normal file
@@ -0,0 +1,54 @@
|
||||
// rddialog.h
|
||||
//
|
||||
// Base class for Rivendell modal dialogs.
|
||||
//
|
||||
// (C) Copyright 2019 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 RDDIALOG_H
|
||||
#define RDDIALOG_H
|
||||
|
||||
#include <qdialog.h>
|
||||
#include <qfont.h>
|
||||
|
||||
#include <rdapplication.h>
|
||||
|
||||
class RDDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
RDDialog(QWidget *parent=0,Qt::WindowFlags f=0);
|
||||
RDDialog(RDConfig *config,QWidget *parent=0,Qt::WindowFlags f=0);
|
||||
QFont buttonFont() const;
|
||||
QFont subButtonFont() const;
|
||||
QFont sectionLabelFont() const;
|
||||
QFont labelFont() const;
|
||||
QFont subLabelFont() const;
|
||||
QFont dataFont() const;
|
||||
|
||||
private:
|
||||
void MakeFonts();
|
||||
QFont dialog_button_font;
|
||||
QFont dialog_sub_button_font;
|
||||
QFont dialog_section_label_font;
|
||||
QFont dialog_label_font;
|
||||
QFont dialog_sub_label_font;
|
||||
QFont dialog_data_font;
|
||||
RDConfig *dialog_config;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDDIALOG_H
|
||||
@@ -99,8 +99,8 @@ RDLiveWire::RDLiveWire(unsigned id,QObject *parent)
|
||||
connect(live_socket,SIGNAL(connectionClosed()),
|
||||
this,SLOT(connectionClosedData()));
|
||||
connect(live_socket,SIGNAL(readyRead()),this,SLOT(readyReadData()));
|
||||
connect(live_socket,SIGNAL(error(QAbstracketSocket::SocketError)),
|
||||
this,SLOT(errorData(QAbstrackSocket::SocketError)));
|
||||
connect(live_socket,SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
this,SLOT(errorData(QAbstractSocket::SocketError)));
|
||||
|
||||
//
|
||||
// Watchdog Timers
|
||||
|
||||
114
lib/rdwidget.cpp
Normal file
114
lib/rdwidget.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
// rdwidget.cpp
|
||||
//
|
||||
// Base class for Rivendell modal widgets.
|
||||
//
|
||||
// (C) Copyright 2019 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 "rdwidget.h"
|
||||
|
||||
RDWidget::RDWidget(QWidget *parent,Qt::WindowFlags f)
|
||||
: QWidget(parent,f)
|
||||
{
|
||||
widget_config=rda->config();
|
||||
MakeFonts();
|
||||
setFont(dataFont());
|
||||
}
|
||||
|
||||
|
||||
RDWidget::RDWidget(RDConfig *config,QWidget *parent,Qt::WindowFlags f)
|
||||
: QWidget(parent,f)
|
||||
{
|
||||
widget_config=config;
|
||||
MakeFonts();
|
||||
setFont(dataFont());
|
||||
}
|
||||
|
||||
|
||||
QFont RDWidget::buttonFont() const
|
||||
{
|
||||
return widget_button_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDWidget::subButtonFont() const
|
||||
{
|
||||
return widget_sub_button_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDWidget::sectionLabelFont() const
|
||||
{
|
||||
return widget_section_label_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDWidget::labelFont() const
|
||||
{
|
||||
return widget_label_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDWidget::subLabelFont() const
|
||||
{
|
||||
return widget_sub_label_font;
|
||||
}
|
||||
|
||||
|
||||
QFont RDWidget::dataFont() const
|
||||
{
|
||||
return widget_data_font;
|
||||
}
|
||||
|
||||
|
||||
void RDWidget::MakeFonts()
|
||||
{
|
||||
QString family=font().family();
|
||||
int button_size=font().pixelSize();
|
||||
int label_size=font().pixelSize();
|
||||
int data_size=font().pixelSize();
|
||||
|
||||
if(!widget_config->fontFamily().isEmpty()) {
|
||||
family=widget_config->fontFamily();
|
||||
}
|
||||
if(widget_config->fontButtonSize()>0) {
|
||||
button_size=widget_config->fontButtonSize();
|
||||
}
|
||||
if(widget_config->fontLabelSize()>0) {
|
||||
label_size=widget_config->fontLabelSize();
|
||||
}
|
||||
if(widget_config->fontDataSize()>0) {
|
||||
data_size=widget_config->fontDataSize();
|
||||
}
|
||||
|
||||
widget_button_font=QFont(family,button_size,QFont::Bold);
|
||||
widget_button_font.setPixelSize(button_size);
|
||||
|
||||
widget_sub_button_font=QFont(family,button_size-2,QFont::Normal);
|
||||
widget_sub_button_font.setPixelSize(button_size-2);
|
||||
|
||||
widget_section_label_font=QFont(family,label_size+2,QFont::Bold);
|
||||
widget_section_label_font.setPixelSize(label_size+2);
|
||||
|
||||
widget_label_font=QFont(family,label_size,QFont::Bold);
|
||||
widget_label_font.setPixelSize(label_size);
|
||||
|
||||
widget_sub_label_font=QFont(family,label_size,QFont::Normal);
|
||||
widget_sub_label_font.setPixelSize(label_size);
|
||||
|
||||
widget_data_font=QFont(family,data_size,QFont::Normal);
|
||||
widget_data_font.setPixelSize(data_size);
|
||||
}
|
||||
54
lib/rdwidget.h
Normal file
54
lib/rdwidget.h
Normal file
@@ -0,0 +1,54 @@
|
||||
// rdwidget.h
|
||||
//
|
||||
// Base class for Rivendell widgets.
|
||||
//
|
||||
// (C) Copyright 2019 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 RDWIDGET_H
|
||||
#define RDWIDGET_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qfont.h>
|
||||
|
||||
#include <rdapplication.h>
|
||||
|
||||
class RDWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT;
|
||||
public:
|
||||
RDWidget(QWidget *parent=0,Qt::WindowFlags f=0);
|
||||
RDWidget(RDConfig *config,QWidget *parent=0,Qt::WindowFlags f=0);
|
||||
QFont buttonFont() const;
|
||||
QFont subButtonFont() const;
|
||||
QFont sectionLabelFont() const;
|
||||
QFont labelFont() const;
|
||||
QFont subLabelFont() const;
|
||||
QFont dataFont() const;
|
||||
|
||||
private:
|
||||
void MakeFonts();
|
||||
QFont widget_button_font;
|
||||
QFont widget_sub_button_font;
|
||||
QFont widget_section_label_font;
|
||||
QFont widget_label_font;
|
||||
QFont widget_sub_label_font;
|
||||
QFont widget_data_font;
|
||||
RDConfig *widget_config;
|
||||
};
|
||||
|
||||
|
||||
#endif // RDWIDGET_H
|
||||
Reference in New Issue
Block a user