2019-10-08 Fred Gleason <fredg@paravelsystems.com>

* Renamed the 'RDFontSet' class to 'RDFontEngine'.
	* Modified the font calculation algorithm in
	'RDFontEngine::MakeFonts()' to use fixed defaults.
This commit is contained in:
Fred Gleason 2019-10-08 09:54:36 -04:00
parent 8be7931c23
commit 13fe76b469
17 changed files with 81 additions and 65 deletions

View File

@ -19195,3 +19195,7 @@
2019-10-08 Fred Gleason <fredg@paravelsystems.com>
* Adjusted position of 'Origin' field in the 'Edit Log' dialog
in rdlogedit(1).
2019-10-08 Fred Gleason <fredg@paravelsystems.com>
* Renamed the 'RDFontSet' class to 'RDFontEngine'.
* Modified the font calculation algorithm in
'RDFontEngine::MakeFonts()' to use fixed defaults.

View File

@ -69,23 +69,22 @@ CaeHostname=
XportHostname=
[Fonts]
; Directives in the [Fonts] section allows the font used by Rivendell to
; be specified, with the default being to use the font specified by
; the underlying window manager. It should seldom be necessary to
; change these!
; Directives in the [Fonts] section allows the fonts used by Rivendell to
; be specified, with the default being to use the 'System' font. It should
; seldom be necessary to change these!
; 'Family=' can be used to specify the name of the font to use
; --e.g. 'Helvetica'.
Family=
;Family=System
; 'ButtonSize=' specifies the size of the font to be used for button labels.
ButtonSize=
;ButtonSize=12
; 'LabelSize=' specifies the size of the font to be used for field labels.
LabelSize=
;LabelSize=11
; 'DefaultSize=' specifies the size of the font to be used for field data.
DefaultSize=
;DefaultSize=11
[Provisioning]
; If CreateHost=Yes, a Host entry will be automatically created in the DB

View File

@ -124,7 +124,7 @@ dist_librd_la_SOURCES = dbversion.h\
rdexport_settings_dialog.cpp rdexport_settings_dialog.h\
rdfeed.cpp rdfeed.h\
rdfeedlog.cpp rdfeedlog.h\
rdfontset.cpp rdfontset.h\
rdfontengine.cpp rdfontengine.h\
rdformpost.cpp rdformpost.h\
rdflacdecode.cpp rdflacdecode.h\
rdframe.cpp rdframe.h\

View File

@ -89,7 +89,7 @@ SOURCES += rdevent_line.cpp
SOURCES += rdeventimportlist.cpp
SOURCES += rdexport_settings_dialog.cpp
SOURCES += rdframe.cpp
SOURCES += rdfontset.cpp
SOURCES += rdfontengine.cpp
SOURCES += rdget_ath.cpp
SOURCES += rdgetpasswd.cpp
SOURCES += rdgpioselector.cpp
@ -221,7 +221,7 @@ HEADERS += rdevent_line.h
HEADERS += rdeventimportlist.h
HEADERS += rdexport_settings_dialog.h
HEADERS += rdframe.h
HEADERS += rdfontset.h
HEADERS += rdfontengine.h
HEADERS += rdget_ath.h
HEADERS += rdgetpasswd.h
HEADERS += rdgpioselector.h

View File

@ -21,7 +21,7 @@
#include "rddialog.h"
RDDialog::RDDialog(QWidget *parent,Qt::WindowFlags f)
: QDialog(parent,f), RDFontSet(font())
: QDialog(parent,f), RDFontEngine(font())
{
setModal(true);
setFont(defaultFont());
@ -29,7 +29,7 @@ RDDialog::RDDialog(QWidget *parent,Qt::WindowFlags f)
RDDialog::RDDialog(RDConfig *config,QWidget *parent,Qt::WindowFlags f)
: QDialog(parent,f), RDFontSet(font(),config)
: QDialog(parent,f), RDFontEngine(font(),config)
{
setModal(true);
setFont(defaultFont());

View File

@ -23,9 +23,9 @@
#include <qdialog.h>
#include <rdfontset.h>
#include <rdfontengine.h>
class RDDialog : public QDialog, public RDFontSet
class RDDialog : public QDialog, public RDFontEngine
{
Q_OBJECT;
public:

View File

@ -1,6 +1,6 @@
// rdfontset.cpp
// rdfontengine.cpp
//
// Base set of fonts for Rivendell UIs
// Engine for calculating fonts in Rivnedell UIs
//
// (C) Copyright 2019 Fred Gleason <fredg@paravelsystems.com>
//
@ -20,9 +20,9 @@
#include <rdapplication.h>
#include "rdfontset.h"
#include "rdfontengine.h"
RDFontSet::RDFontSet(const QFont &default_font,RDConfig *c)
RDFontEngine::RDFontEngine(const QFont &default_font,RDConfig *c)
{
if(c==NULL) {
font_config=rda->config();
@ -34,7 +34,7 @@ RDFontSet::RDFontSet(const QFont &default_font,RDConfig *c)
}
RDFontSet::RDFontSet(RDConfig *c)
RDFontEngine::RDFontEngine(RDConfig *c)
{
if(c==NULL) {
font_config=rda->config();
@ -47,85 +47,98 @@ RDFontSet::RDFontSet(RDConfig *c)
}
QFont RDFontSet::buttonFont() const
QFont RDFontEngine::buttonFont() const
{
return font_button_font;
}
QFont RDFontSet::hugeButtonFont() const
QFont RDFontEngine::hugeButtonFont() const
{
return font_huge_button_font;
}
QFont RDFontSet::bigButtonFont() const
QFont RDFontEngine::bigButtonFont() const
{
return font_big_button_font;
}
QFont RDFontSet::subButtonFont() const
QFont RDFontEngine::subButtonFont() const
{
return font_sub_button_font;
}
QFont RDFontSet::sectionLabelFont() const
QFont RDFontEngine::sectionLabelFont() const
{
return font_section_label_font;
}
QFont RDFontSet::labelFont() const
QFont RDFontEngine::labelFont() const
{
return font_label_font;
}
QFont RDFontSet::subLabelFont() const
QFont RDFontEngine::subLabelFont() const
{
return font_sub_label_font;
}
QFont RDFontSet::progressFont() const
QFont RDFontEngine::progressFont() const
{
return font_progress_font;
}
QFont RDFontSet::bannerFont() const
QFont RDFontEngine::bannerFont() const
{
return font_banner_font;
}
QFont RDFontSet::timerFont() const
QFont RDFontEngine::timerFont() const
{
return font_timer_font;
}
QFont RDFontSet::smallTimerFont() const
QFont RDFontEngine::smallTimerFont() const
{
return font_small_timer_font;
}
QFont RDFontSet::defaultFont() const
QFont RDFontEngine::defaultFont() const
{
return font_default_font;
}
void RDFontSet::MakeFonts(const QFont &default_font)
void RDFontEngine::MakeFonts(const QFont &default_font)
{
QString family=default_font.family();
int button_size=default_font.pixelSize();
int label_size=default_font.pixelSize();
int default_size=default_font.pixelSize();
/*
printf("family: %s pixelSize: %d pointSize: %d\n",
(const char *)default_font.family().toUtf8(),
default_font.pixelSize(),
default_font.pointSize());
*/
//
// Default Font Values
//
QString family="System";
int button_size=12;
int label_size=11;
int default_size=11;
//
// Overrides from rd.conf(5)
//
if(!font_config->fontFamily().isEmpty()) {
family=font_config->fontFamily();
}
@ -139,6 +152,9 @@ void RDFontSet::MakeFonts(const QFont &default_font)
default_size=font_config->fontDefaultSize();
}
//
// Generate Fonts
//
font_button_font=QFont(family,button_size,QFont::Bold);
font_button_font.setPixelSize(button_size);

View File

@ -1,6 +1,6 @@
// rdfontset.h
// rdfontengine.h
//
// Base set of fonts for Rivendell UIs
// Engine for calculating fonts in Rivnedell UIs
//
// (C) Copyright 2019 Fred Gleason <fredg@paravelsystems.com>
//
@ -18,18 +18,18 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
#ifndef RDFONTSET_H
#define RDFONTSET_H
#ifndef RDFONTENGINE_H
#define RDFONTENGINE_H
#include <qfont.h>
#include <rdapplication.h>
class RDFontSet
class RDFontEngine
{
public:
RDFontSet(const QFont &default_font,RDConfig *c=NULL);
RDFontSet(RDConfig *c=NULL);
RDFontEngine(const QFont &default_font,RDConfig *c=NULL);
RDFontEngine(RDConfig *c=NULL);
QFont buttonFont() const;
QFont hugeButtonFont() const;
QFont bigButtonFont() const;
@ -61,4 +61,4 @@ class RDFontSet
};
#endif // RDFONTSET_H
#endif // RDFONTENGINE_H

View File

@ -21,14 +21,14 @@
#include "rdframe.h"
RDFrame::RDFrame(QWidget *parent,Qt::WindowFlags f)
: QFrame(parent,f), RDFontSet(font())
: QFrame(parent,f), RDFontEngine(font())
{
setFont(defaultFont());
}
RDFrame::RDFrame(RDConfig *config,QWidget *parent,Qt::WindowFlags f)
: QFrame(parent,f), RDFontSet(font(),config)
: QFrame(parent,f), RDFontEngine(font(),config)
{
setFont(defaultFont());
}

View File

@ -23,9 +23,9 @@
#include <qwidget.h>
#include <rdfontset.h>
#include <rdfontengine.h>
class RDFrame : public QFrame, public RDFontSet
class RDFrame : public QFrame, public RDFontEngine
{
Q_OBJECT;
public:

View File

@ -1,6 +1,6 @@
// rdpushbutton.cpp
//
// An flashing button widget.
// A flashing button widget.
//
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
//
@ -31,21 +31,21 @@
RDPushButton::RDPushButton(QWidget *parent=0)
: QPushButton(parent), RDFontSet(font())
: QPushButton(parent), RDFontEngine(font())
{
Init();
}
RDPushButton::RDPushButton(const QString &text,QWidget *parent)
: QPushButton(text,parent), RDFontSet(font())
: QPushButton(text,parent), RDFontEngine(font())
{
Init();
}
RDPushButton::RDPushButton(const QIcon &icon,const QString &text,
QWidget *parent)
: QPushButton(text,parent), RDFontSet(font())
: QPushButton(text,parent), RDFontEngine(font())
{
Init();
}

View File

@ -1,6 +1,6 @@
// rdpushbutton.h
//
// An flashing button widget.
// A flashing button widget.
//
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
//
@ -28,7 +28,7 @@
//Added by qt3to4:
#include <QMouseEvent>
#include <rdfontset.h>
#include <rdfontengine.h>
/*
* Widget Defaults
@ -36,7 +36,7 @@
#define RDPUSHBUTTON_DEFAULT_FLASH_PERIOD 300
#define RDPUSHBUTTON_DEFAULT_FLASH_COLOR Qt::blue
class RDPushButton : public QPushButton, public RDFontSet
class RDPushButton : public QPushButton, public RDFontEngine
{
Q_OBJECT
public:

View File

@ -21,14 +21,14 @@
#include "rdwidget.h"
RDWidget::RDWidget(QWidget *parent,Qt::WindowFlags f)
: QWidget(parent,f), RDFontSet(font())
: QWidget(parent,f), RDFontEngine(font())
{
setFont(defaultFont());
}
RDWidget::RDWidget(RDConfig *config,QWidget *parent,Qt::WindowFlags f)
: QWidget(parent,f), RDFontSet(font(),config)
: QWidget(parent,f), RDFontEngine(font(),config)
{
setFont(defaultFont());
}

View File

@ -23,9 +23,9 @@
#include <qwidget.h>
#include <rdfontset.h>
#include <rdfontengine.h>
class RDWidget : public QWidget, public RDFontSet
class RDWidget : public QWidget, public RDFontEngine
{
Q_OBJECT;
public:

View File

@ -20,8 +20,6 @@
#include <qpainter.h>
#include <rdfontset.h>
#include "colors.h"
#include "mode_display.h"

View File

@ -22,7 +22,6 @@
#include <qpainter.h>
#include <rdapplication.h>
#include <rdfontset.h>
#include "colors.h"
#include "globals.h"

View File

@ -27,7 +27,7 @@
#include <rdapplication.h>
#include <rdcmd_switch.h>
#include <rdconfig.h>
#include <rdfontset.h>
#include <rdfontengine.h>
#include "rdpopup.h"
@ -121,7 +121,7 @@ int main(int argc,char *argv[])
}
mb->setWindowIcon(QPixmap(rivendell_22x22_xpm));
RDFontSet *fs=new RDFontSet(config);
RDFontEngine *fs=new RDFontEngine(config);
mb->setFont(fs->progressFont());
mb->exec();
delete mb;