diff --git a/ChangeLog b/ChangeLog index e28a58fe..310bd1d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19195,3 +19195,7 @@ 2019-10-08 Fred Gleason * Adjusted position of 'Origin' field in the 'Edit Log' dialog in rdlogedit(1). +2019-10-08 Fred Gleason + * Renamed the 'RDFontSet' class to 'RDFontEngine'. + * Modified the font calculation algorithm in + 'RDFontEngine::MakeFonts()' to use fixed defaults. diff --git a/conf/rd.conf-sample b/conf/rd.conf-sample index cbfb4a75..d6f4ad37 100644 --- a/conf/rd.conf-sample +++ b/conf/rd.conf-sample @@ -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 diff --git a/lib/Makefile.am b/lib/Makefile.am index 16af208c..beec3da2 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -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\ diff --git a/lib/lib.pro b/lib/lib.pro index b0f91d23..72c89c48 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -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 diff --git a/lib/rddialog.cpp b/lib/rddialog.cpp index 6a46bdfa..41b7dfe7 100644 --- a/lib/rddialog.cpp +++ b/lib/rddialog.cpp @@ -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()); diff --git a/lib/rddialog.h b/lib/rddialog.h index 6db4a0b7..dbbf255a 100644 --- a/lib/rddialog.h +++ b/lib/rddialog.h @@ -23,9 +23,9 @@ #include -#include +#include -class RDDialog : public QDialog, public RDFontSet +class RDDialog : public QDialog, public RDFontEngine { Q_OBJECT; public: diff --git a/lib/rdfontset.cpp b/lib/rdfontengine.cpp similarity index 73% rename from lib/rdfontset.cpp rename to lib/rdfontengine.cpp index 10341101..c1300589 100644 --- a/lib/rdfontset.cpp +++ b/lib/rdfontengine.cpp @@ -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 // @@ -20,9 +20,9 @@ #include -#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); diff --git a/lib/rdfontset.h b/lib/rdfontengine.h similarity index 86% rename from lib/rdfontset.h rename to lib/rdfontengine.h index a40d7c1f..07c3bb33 100644 --- a/lib/rdfontset.h +++ b/lib/rdfontengine.h @@ -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 // @@ -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 #include -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 diff --git a/lib/rdframe.cpp b/lib/rdframe.cpp index 0967c13f..771f3cf2 100644 --- a/lib/rdframe.cpp +++ b/lib/rdframe.cpp @@ -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()); } diff --git a/lib/rdframe.h b/lib/rdframe.h index c8dd6739..32a9c6ec 100644 --- a/lib/rdframe.h +++ b/lib/rdframe.h @@ -23,9 +23,9 @@ #include -#include +#include -class RDFrame : public QFrame, public RDFontSet +class RDFrame : public QFrame, public RDFontEngine { Q_OBJECT; public: diff --git a/lib/rdpushbutton.cpp b/lib/rdpushbutton.cpp index f0210fcd..1941e6a3 100644 --- a/lib/rdpushbutton.cpp +++ b/lib/rdpushbutton.cpp @@ -1,6 +1,6 @@ // rdpushbutton.cpp // -// An flashing button widget. +// A flashing button widget. // // (C) Copyright 2002-2019 Fred Gleason // @@ -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(); } diff --git a/lib/rdpushbutton.h b/lib/rdpushbutton.h index da0b6c21..51c9713d 100644 --- a/lib/rdpushbutton.h +++ b/lib/rdpushbutton.h @@ -1,6 +1,6 @@ // rdpushbutton.h // -// An flashing button widget. +// A flashing button widget. // // (C) Copyright 2002-2019 Fred Gleason // @@ -28,7 +28,7 @@ //Added by qt3to4: #include -#include +#include /* * 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: diff --git a/lib/rdwidget.cpp b/lib/rdwidget.cpp index b1a18c93..8c4ab480 100644 --- a/lib/rdwidget.cpp +++ b/lib/rdwidget.cpp @@ -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()); } diff --git a/lib/rdwidget.h b/lib/rdwidget.h index 1edf0df9..fe64b963 100644 --- a/lib/rdwidget.h +++ b/lib/rdwidget.h @@ -23,9 +23,9 @@ #include -#include +#include -class RDWidget : public QWidget, public RDFontSet +class RDWidget : public QWidget, public RDFontEngine { Q_OBJECT; public: diff --git a/rdairplay/mode_display.cpp b/rdairplay/mode_display.cpp index d83ec6a3..216c2e94 100644 --- a/rdairplay/mode_display.cpp +++ b/rdairplay/mode_display.cpp @@ -20,8 +20,6 @@ #include -#include - #include "colors.h" #include "mode_display.h" diff --git a/rdairplay/post_counter.cpp b/rdairplay/post_counter.cpp index c9229ccc..e2eed8c4 100644 --- a/rdairplay/post_counter.cpp +++ b/rdairplay/post_counter.cpp @@ -22,7 +22,6 @@ #include #include -#include #include "colors.h" #include "globals.h" diff --git a/utils/rdpopup/rdpopup.cpp b/utils/rdpopup/rdpopup.cpp index 58d1474e..72e04060 100644 --- a/utils/rdpopup/rdpopup.cpp +++ b/utils/rdpopup/rdpopup.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #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;