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

* Refactored rdairplay(1) to use the 'RDDialog' and 'RDWidget'
	base classes.
This commit is contained in:
Fred Gleason
2019-10-02 16:08:48 -04:00
parent 8ca15c773d
commit 44a0941df9
45 changed files with 465 additions and 711 deletions

View File

@@ -21,103 +21,14 @@
#include "rdwidget.h"
RDWidget::RDWidget(QWidget *parent,Qt::WindowFlags f)
: QWidget(parent,f)
: QWidget(parent,f), RDFontSet(font())
{
widget_config=rda->config();
MakeFonts();
setFont(dataFont());
setFont(defaultFont());
}
RDWidget::RDWidget(RDConfig *config,QWidget *parent,Qt::WindowFlags f)
: QWidget(parent,f)
: QWidget(parent,f), RDFontSet(font(),config)
{
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::progressFont() const
{
return widget_progress_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_progress_font=QFont(family,label_size+4,QFont::Bold);
widget_progress_font.setPixelSize(label_size+4);
widget_data_font=QFont(family,data_size,QFont::Normal);
widget_data_font.setPixelSize(data_size);
setFont(defaultFont());
}