mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-14 01:30:49 +00:00
Add font debugging, add setApplicationFont to Daily::Load(date)
This commit is contained in:
parent
142220c16c
commit
f05320e725
oscar
@ -332,8 +332,8 @@ void validateFont (QString which, int size, bool bold, bool italic) {
|
|||||||
QFontDatabase fontdatabase;
|
QFontDatabase fontdatabase;
|
||||||
if (installedFontFamilies.isEmpty()) {
|
if (installedFontFamilies.isEmpty()) {
|
||||||
installedFontFamilies = fontdatabase.families();
|
installedFontFamilies = fontdatabase.families();
|
||||||
qDebug() << "validateFont found" << installedFontFamilies.count() << "installed font families";
|
|
||||||
}
|
}
|
||||||
|
qDebug() << "validateFont found" << installedFontFamilies.count() << "installed font families";
|
||||||
|
|
||||||
QString prefPrefix = "Fonts_" + which + "_";
|
QString prefPrefix = "Fonts_" + which + "_";
|
||||||
|
|
||||||
@ -345,15 +345,19 @@ void validateFont (QString which, int size, bool bold, bool italic) {
|
|||||||
if (p_pref->contains(prefPrefix + "Name")) {
|
if (p_pref->contains(prefPrefix + "Name")) {
|
||||||
// We already have a font, so it becomes desired font (if valid)
|
// We already have a font, so it becomes desired font (if valid)
|
||||||
QString testFont = (*p_pref)[prefPrefix + "Name"].toString();
|
QString testFont = (*p_pref)[prefPrefix + "Name"].toString();
|
||||||
|
int prefSize = (*p_pref)[prefPrefix+"Size"].toInt();
|
||||||
// Is this a good font?
|
// Is this a good font?
|
||||||
if (testFont.length() > 0 && installedFontFamilies.indexOf(testFont) >= 0) {
|
if (testFont.length() > 0 ) {
|
||||||
desiredFont = testFont;
|
qDebug() << which << "Preferences font is" << testFont;
|
||||||
forceFont = false;
|
if ( installedFontFamilies.indexOf(testFont) >= 0) {
|
||||||
} else {
|
desiredFont = testFont;
|
||||||
qDebug() << testFont << size << "not found, substituting" << desiredFont << size;
|
forceFont = false;
|
||||||
for (int i = 0; i< installedFontFamilies.size(); i++)
|
} else {
|
||||||
qDebug() << installedFontFamilies.at(i);
|
qDebug() << testFont << prefSize << "not found, substituting" << desiredFont << size;
|
||||||
}
|
for (int i = 0; i< installedFontFamilies.size(); i++)
|
||||||
|
qDebug() << installedFontFamilies.at(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
@ -371,9 +375,11 @@ void validateFont (QString which, int size, bool bold, bool italic) {
|
|||||||
(*p_pref)[prefPrefix + "Bold"] = bold;
|
(*p_pref)[prefPrefix + "Bold"] = bold;
|
||||||
(*p_pref)[prefPrefix + "Italic"] = italic;
|
(*p_pref)[prefPrefix + "Italic"] = italic;
|
||||||
}
|
}
|
||||||
|
qDebug() << which << "font set to" << desiredFont << "at size" << (*p_pref)[prefPrefix + "Size"];
|
||||||
}
|
}
|
||||||
|
|
||||||
void setApplicationFont () {
|
void setApplicationFont () {
|
||||||
|
qDebug() << "Application font starts out as" << QApplication::font();
|
||||||
QFont font = QFont(((*p_pref)["Fonts_Application_Name"]).toString());
|
QFont font = QFont(((*p_pref)["Fonts_Application_Name"]).toString());
|
||||||
font.setPointSize(((*p_pref)["Fonts_Application_Size"]).toInt());
|
font.setPointSize(((*p_pref)["Fonts_Application_Size"]).toInt());
|
||||||
font.setWeight(((*p_pref)["Fonts_Application_Bold"]).toBool() ? QFont::Bold : QFont::Normal);
|
font.setWeight(((*p_pref)["Fonts_Application_Bold"]).toBool() ? QFont::Bold : QFont::Normal);
|
||||||
|
@ -1529,6 +1529,11 @@ QVariant MyTextBrowser::loadResource(int type, const QUrl &url)
|
|||||||
|
|
||||||
void Daily::Load(QDate date)
|
void Daily::Load(QDate date)
|
||||||
{
|
{
|
||||||
|
qDebug() << "Daily::Load called for" << date.toString() << "using" << QApplication::font().toString();
|
||||||
|
|
||||||
|
qDebug() << "Setting App font in Daily::Load";
|
||||||
|
setApplicationFont();
|
||||||
|
|
||||||
dateDisplay->setText("<i>"+date.toString(Qt::SystemLocaleLongDate)+"</i>");
|
dateDisplay->setText("<i>"+date.toString(Qt::SystemLocaleLongDate)+"</i>");
|
||||||
previous_date=date;
|
previous_date=date;
|
||||||
|
|
||||||
@ -1643,6 +1648,10 @@ void Daily::Load(QDate date)
|
|||||||
|
|
||||||
if (hours>0) {
|
if (hours>0) {
|
||||||
htmlLeftAHI="<table cellspacing=0 cellpadding=0 border=0 width='100%'>\n";
|
htmlLeftAHI="<table cellspacing=0 cellpadding=0 border=0 width='100%'>\n";
|
||||||
|
|
||||||
|
QString appFont = QApplication::font().toString();
|
||||||
|
htmlLeftAHI+=QString("<tr><td colspan=5 align=center>%1</td></tr>").arg(appFont);
|
||||||
|
|
||||||
htmlLeftAHI+="<tr>";
|
htmlLeftAHI+="<tr>";
|
||||||
if (!isBrick) {
|
if (!isBrick) {
|
||||||
ChannelID ahichan=CPAP_AHI;
|
ChannelID ahichan=CPAP_AHI;
|
||||||
@ -1651,10 +1660,10 @@ void Daily::Load(QDate date)
|
|||||||
ahichan=CPAP_RDI;
|
ahichan=CPAP_RDI;
|
||||||
ahiname=STR_TR_RDI;
|
ahiname=STR_TR_RDI;
|
||||||
}
|
}
|
||||||
htmlLeftAHI+=QString("<td colspan=4 bgcolor='%1' align=center><p title='%4'><font size=+4 color='%2'><b>%3</b></font></p> <font size=+4 color='%2'><b>%5</b></font></td>\n")
|
htmlLeftAHI+=QString("<td colspan=5 bgcolor='%1' align=center><p title='%4'><font size=+2 color='%2'><b>%3</b></font></p> <font size=+4 color='%2'><b>%5</b></font></td>\n")
|
||||||
.arg("#F88017").arg(COLOR_Text.name()).arg(ahiname).arg(schema::channel[ahichan].fullname()).arg(ahi,0,'f',2);
|
.arg("#F88017").arg(COLOR_Text.name()).arg(ahiname).arg(schema::channel[ahichan].fullname()).arg(ahi,0,'f',2);
|
||||||
} else {
|
} else {
|
||||||
htmlLeftAHI+=QString("<td colspan=5 bgcolor='%1' align=center><font size=+4 color='yellow'>%2</font></td>\n")
|
htmlLeftAHI+=QString("<td colspan=5 bgcolor='%1' align=center><font size=+2 color='yellow'>%2</font></td>\n")
|
||||||
.arg("#F88017").arg(tr("BRICK! :("));
|
.arg("#F88017").arg(tr("BRICK! :("));
|
||||||
}
|
}
|
||||||
htmlLeftAHI+="</tr>\n";
|
htmlLeftAHI+="</tr>\n";
|
||||||
|
@ -592,6 +592,7 @@ int main(int argc, char *argv[]) {
|
|||||||
AppSetting->setLanguage(language);
|
AppSetting->setLanguage(language);
|
||||||
|
|
||||||
// Set fonts from preferences file
|
// Set fonts from preferences file
|
||||||
|
qDebug() << "App font before Prefs setting" << QApplication::font();
|
||||||
validateAllFonts();
|
validateAllFonts();
|
||||||
setApplicationFont();
|
setApplicationFont();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user