diff options
| author | oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> | 2019-07-20 16:33:34 +0000 |
|---|---|---|
| committer | oldmud0 <3421260-oldmud0@users.noreply.gitlab.com> | 2019-07-20 16:33:34 +0000 |
| commit | e5c2898bac03c478b468afd765ecbf3ceaa19a46 (patch) | |
| tree | 13f61c9e36ab88a707deefcd321f47e82844c559 | |
| parent | 2a5d569511af7d9411cd73f2dfd329da38730dc0 (diff) | |
| parent | 82db3e226353183cf8337d993ba89ea265014d3a (diff) | |
Merge branch 'trojanAO' into 'master'
Added ability to set fonts on widgets.
See merge request AttorneyOnline/AO2-Client!76
| -rw-r--r-- | include/aoapplication.h | 4 | ||||
| -rw-r--r-- | src/courtroom.cpp | 4 | ||||
| -rw-r--r-- | src/text_file_functions.cpp | 12 |
3 files changed, 18 insertions, 2 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h index 60856ee4..2eed7f23 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -195,6 +195,10 @@ public: //Returns the dimensions of widget with specified identifier from p_file pos_size_type get_element_dimensions(QString p_identifier, QString p_file); + //Returns the name of the font with p_identifier from p_file + QString get_font_name(QString p_identifier, QString p_file); + + //Returns the value of font_size with p_identifier from p_file int get_font_size(QString p_identifier, QString p_file); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index a8e97392..237bedc5 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -724,7 +724,9 @@ void Courtroom::set_font(QWidget *widget, QString p_identifier) int f_weight = ao_app->get_font_size(p_identifier, design_file); QString class_name = widget->metaObject()->className(); - widget->setFont(QFont("Sans", f_weight)); + QString fontt = ao_app->get_font_name(p_identifier + "_font", design_file); + widget->setFont(QFont(fontt, f_weight)); + QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 1e920d73..18c43ac4 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -224,7 +224,17 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QStrin return return_value; } - +QString AOApplication::get_font_name(QString p_identifier, QString p_file) +{ + QString design_ini_path = get_theme_path(p_file); + QString f_result = read_design_ini(p_identifier, design_ini_path); + QString default_path = get_default_theme_path(p_file); + if(f_result == "") + { + f_result = read_design_ini(p_identifier, default_path); + } + return f_result; +} int AOApplication::get_font_size(QString p_identifier, QString p_file) { QString design_ini_path = get_theme_path(p_file); |
