From d7653465e99ed8b5b27dccd9db8b5508511b22e7 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Sat, 31 Mar 2018 22:45:19 +0200 Subject: [PATCH] Made global font setting at app start. --- gui/mainwindow.ui | 82 ++++++++++++++++++++++++++-- gui/newDialogs/newfoodgroupdialog.ui | 5 +- gui/newDialogs/newtagdialog.ui | 8 ++- gui/newDialogs/newunitdialog.ui | 17 ++++-- gui/newrecipedialog.ui | 14 +++-- gui/openrecipedialog.ui | 10 ++-- main.cpp | 10 +++- 7 files changed, 118 insertions(+), 28 deletions(-) diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index a220c32..266c9b1 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -19,6 +19,11 @@ 0 + + + Noto Sans + + false @@ -32,7 +37,13 @@ 1.000000000000000 + + + + + + 0 @@ -111,6 +122,11 @@ 80 + + + 20 + + false @@ -148,6 +164,11 @@ QPushButton#newButton:pressed{ 80 + + + 20 + + QPushButton#openButton { background-color: rgb(222, 226, 255); @@ -176,6 +197,11 @@ QPushButton#openButton:pressed{ 80 + + + 20 + + false @@ -213,6 +239,11 @@ QPushButton#editButton:pressed{ 80 + + + 20 + + false @@ -317,11 +348,7 @@ font: "Noto Sans CJK KR"; - Noto Sans CJK KR Light 30 - 50 - false - false PreferAntialias @@ -344,6 +371,11 @@ font: "Noto Sans CJK KR"; 0 + + + 20 + + By Unknown Author @@ -405,6 +437,11 @@ font: "Noto Sans CJK KR"; + + + 14 + + Prep Time: @@ -418,6 +455,11 @@ font: "Noto Sans CJK KR"; true + + + 14 + + Cook Time: @@ -428,6 +470,11 @@ font: "Noto Sans CJK KR"; + + + 14 + + Servings: @@ -507,6 +554,11 @@ font: "Noto Sans CJK KR"; 40 + + + 14 + + background-color: rgb(194, 196, 233); @@ -526,6 +578,11 @@ font: "Noto Sans CJK KR"; 0 + + + 12 + + background-color: rgb(232, 232, 232); @@ -605,6 +662,11 @@ font: "Noto Sans CJK KR"; 40 + + + 14 + + background-color: rgb(218, 219, 234); @@ -618,6 +680,11 @@ font: "Noto Sans CJK KR"; + + + 12 + + background-color: rgb(244, 244, 244); @@ -649,7 +716,7 @@ font: "Noto Sans CJK KR"; <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Liberation Serif Bold'; font-size:11pt; font-weight:400; font-style:normal;"> +</style></head><body style=" font-family:'Liberation Serif Bold'; font-size:12pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; color:#00ff40;">This is some </span><span style=" font-family:'MS Shell Dlg 2'; font-size:16pt; color:#a33c3e;">colored text and </span><a href="https://www.google.com"><span style=" font-family:'MS Shell Dlg 2'; font-size:8pt; text-decoration: underline; color:#0000ff;">link</span></a></p></body></html> @@ -771,6 +838,11 @@ p, li { white-space: pre-wrap; } + + + 14 + + Tags diff --git a/gui/newDialogs/newfoodgroupdialog.ui b/gui/newDialogs/newfoodgroupdialog.ui index cbe9c53..42d9030 100644 --- a/gui/newDialogs/newfoodgroupdialog.ui +++ b/gui/newDialogs/newfoodgroupdialog.ui @@ -22,12 +22,14 @@ :/images/images/icon.png:/images/images/icon.png + + + - Noto Sans CJK KR Light 12 @@ -43,7 +45,6 @@ - Noto Sans CJK KR Light 12 diff --git a/gui/newDialogs/newtagdialog.ui b/gui/newDialogs/newtagdialog.ui index 04ac9c6..92b8d62 100644 --- a/gui/newDialogs/newtagdialog.ui +++ b/gui/newDialogs/newtagdialog.ui @@ -18,7 +18,7 @@ :/images/images/icon.png:/images/images/icon.png - font: 25 "Noto Sans CJK KR Light"; + true @@ -31,7 +31,8 @@ - 3 + 13 + 50 false false @@ -48,7 +49,8 @@ - 3 + 12 + 50 false false diff --git a/gui/newDialogs/newunitdialog.ui b/gui/newDialogs/newunitdialog.ui index 443ffc3..fd3ada6 100644 --- a/gui/newDialogs/newunitdialog.ui +++ b/gui/newDialogs/newunitdialog.ui @@ -18,7 +18,7 @@ :/images/images/icon.png:/images/images/icon.png - font: 25 "Noto Sans CJK KR Light"; + true @@ -31,7 +31,8 @@ - 3 + 12 + 50 false false @@ -51,7 +52,8 @@ - 3 + 12 + 50 false false @@ -71,7 +73,8 @@ - 3 + 12 + 50 false false @@ -112,7 +115,8 @@ - 3 + 12 + 50 false false @@ -142,7 +146,8 @@ - 3 + 12 + 50 false false diff --git a/gui/newrecipedialog.ui b/gui/newrecipedialog.ui index 56ab137..9759320 100644 --- a/gui/newrecipedialog.ui +++ b/gui/newrecipedialog.ui @@ -27,7 +27,7 @@ :/images/images/icon.png:/images/images/icon.png - font: 25 "Noto Sans CJK KR"; + true @@ -103,7 +103,8 @@ - 3 + 14 + 50 false false @@ -126,7 +127,8 @@ - 3 + 12 + 50 false false @@ -626,7 +628,7 @@ QPushButton#deleteTagButton:pressed{ - 3 + 50 false false @@ -898,7 +900,7 @@ QPushButton#removeIngredientButton:pressed{ - 3 + 50 false false @@ -918,7 +920,7 @@ QPushButton#removeIngredientButton:pressed{ - 3 + 50 false false diff --git a/gui/openrecipedialog.ui b/gui/openrecipedialog.ui index a9b407f..89ae5ea 100644 --- a/gui/openrecipedialog.ui +++ b/gui/openrecipedialog.ui @@ -18,7 +18,7 @@ :/images/images/icon.png:/images/images/icon.png - font: 25 "Noto Sans CJK KR Light"; + true @@ -63,7 +63,7 @@ QTabWidget::Rounded - 1 + 2 @@ -237,7 +237,8 @@ - 3 + 12 + 50 false false @@ -369,7 +370,8 @@ QPushButton#exitButton:pressed{ - 3 + 14 + 50 false false diff --git a/main.cpp b/main.cpp index 00a49af..bed054e 100644 --- a/main.cpp +++ b/main.cpp @@ -41,9 +41,11 @@ Recipe checkForFirstRun(RecipeDatabase *recipeDB){ } void loadAndSetFonts(){ - int id = QFontDatabase::addApplicationFont(":/fonts/NotoSans-Light.ttf"); + int id = QFontDatabase::addApplicationFont(":/fonts/fonts/NotoSans-Light.ttf"); + if (id == -1){ + return; + } QString family = QFontDatabase::applicationFontFamilies(id).at(0); - printf("%s\n", family.toStdString().c_str()); } int main(int argc, char *argv[]) @@ -53,6 +55,10 @@ int main(int argc, char *argv[]) QApplication a(argc, argv); loadAndSetFonts(); + QFont notoFont("Noto Sans"); + notoFont.setStyleHint(QFont::SansSerif); + notoFont.setWeight(QFont::Thin); + a.setFont(notoFont); MainWindow w(&recipeDB); w.loadFromRecipe(checkForFirstRun(&recipeDB));