Add integer-based theme scaling (#935)
Configurable over the options menu,
This commit is contained in:
parent
ff577255d3
commit
27726c9ce1
@ -66,6 +66,8 @@ public:
|
||||
Courtroom *w_courtroom;
|
||||
AttorneyOnline::Discord *discord;
|
||||
|
||||
QFont default_font;
|
||||
|
||||
bool lobby_constructed = false;
|
||||
bool courtroom_constructed = false;
|
||||
|
||||
|
@ -48,6 +48,9 @@ public:
|
||||
QString theme() const;
|
||||
void setTheme(QString value);
|
||||
|
||||
int themeScalingFactor() const;
|
||||
void setThemeScalingFactor(int value);
|
||||
|
||||
// Returns the value of oocname in config.ini
|
||||
QString oocName() const;
|
||||
void setOocName(QString value);
|
||||
|
@ -47,6 +47,7 @@ private:
|
||||
QWidget *ui_settings_widget;
|
||||
QComboBox *ui_theme_combobox;
|
||||
QComboBox *ui_subtheme_combobox;
|
||||
QSpinBox *ui_theme_scaling_factor_sb;
|
||||
QPushButton *ui_theme_reload_button;
|
||||
QPushButton *ui_theme_folder_button;
|
||||
QCheckBox *ui_evidence_double_click_cb;
|
||||
|
@ -41,18 +41,18 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>394</width>
|
||||
<height>826</height>
|
||||
<height>828</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="23" column="1">
|
||||
<item row="24" column="1">
|
||||
<widget class="QCheckBox" name="stickysounds_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="29" column="0">
|
||||
<item row="30" column="0">
|
||||
<widget class="QLabel" name="category_stop_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Stop music when double-clicking a category. If this is disabled, use the right-click context menu to stop music.</string>
|
||||
@ -62,7 +62,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="30" column="1">
|
||||
<item row="31" column="1">
|
||||
<widget class="QCheckBox" name="sfx_on_idle_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -72,7 +72,7 @@
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="theme_combobox"/>
|
||||
</item>
|
||||
<item row="18" column="0">
|
||||
<item row="19" column="0">
|
||||
<widget class="QLabel" name="scaling_label">
|
||||
<property name="toolTip">
|
||||
<string>Sets the default scaling method, if there is not one already defined specifically for the character.</string>
|
||||
@ -82,7 +82,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="0">
|
||||
<item row="27" column="0">
|
||||
<widget class="QLabel" name="customchat_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Turn this on to allow characters to define their own custom chat box designs.</string>
|
||||
@ -92,7 +92,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="0">
|
||||
<item row="21" column="0">
|
||||
<widget class="QLabel" name="effects_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures.</string>
|
||||
@ -102,7 +102,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="1">
|
||||
<item row="17" column="1">
|
||||
<widget class="QCheckBox" name="discord_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -119,7 +119,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="0">
|
||||
<item row="16" column="0">
|
||||
<widget class="QLabel" name="ms_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Overrides the base URL to retrieve server information from.</string>
|
||||
@ -129,14 +129,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="instant_objection_lbl">
|
||||
<property name="text">
|
||||
<string>Instant Objection:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<item row="9" column="1">
|
||||
<widget class="QSpinBox" name="text_crawl_spinbox">
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
@ -156,7 +156,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="1">
|
||||
<item row="18" column="1">
|
||||
<widget class="QComboBox" name="language_combobox">
|
||||
<item>
|
||||
<property name="text">
|
||||
@ -195,10 +195,10 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="15" column="1">
|
||||
<item row="16" column="1">
|
||||
<widget class="QLineEdit" name="ms_textbox"/>
|
||||
</item>
|
||||
<item row="21" column="0">
|
||||
<item row="22" column="0">
|
||||
<widget class="QLabel" name="framenetwork_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality.</string>
|
||||
@ -208,7 +208,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<item row="10" column="0">
|
||||
<widget class="QLabel" name="chat_ratelimit_lbl">
|
||||
<property name="text">
|
||||
<string>Chat Rate Limit:</string>
|
||||
@ -218,7 +218,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1">
|
||||
<item row="10" column="1">
|
||||
<widget class="QSpinBox" name="chat_ratelimit_spinbox">
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
@ -228,7 +228,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="animated_theme_lbl">
|
||||
<property name="toolTip">
|
||||
<string>If ticked, themes will be allowed to have animated elements.</string>
|
||||
@ -238,7 +238,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="text_crawl_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Amount of time (in miliseconds) spent on each letter when the in-character text is being displayed.</string>
|
||||
@ -258,17 +258,17 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="18" column="1">
|
||||
<item row="19" column="1">
|
||||
<widget class="QComboBox" name="scaling_combobox"/>
|
||||
</item>
|
||||
<item row="22" column="1">
|
||||
<item row="23" column="1">
|
||||
<widget class="QCheckBox" name="colorlog_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="0">
|
||||
<item row="14" column="0">
|
||||
<widget class="QLabel" name="default_showname_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Your showname will be automatically set to this value when you join a server.</string>
|
||||
@ -278,7 +278,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="28" column="1">
|
||||
<item row="29" column="1">
|
||||
<widget class="QCheckBox" name="continuous_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -288,7 +288,7 @@
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="subtheme_combobox"/>
|
||||
</item>
|
||||
<item row="27" column="0">
|
||||
<item row="28" column="0">
|
||||
<widget class="QLabel" name="sticker_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Turn this on to allow characters to define their own stickers (unique images that show up over the chatbox - like avatars or shownames).</string>
|
||||
@ -298,7 +298,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="0">
|
||||
<item row="26" column="0">
|
||||
<widget class="QLabel" name="stickypres_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Turn this on to prevent preanimation checkbox from clearing after playing the emote.</string>
|
||||
@ -308,7 +308,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="stay_time_spinbox">
|
||||
<property name="suffix">
|
||||
<string> ms</string>
|
||||
@ -318,7 +318,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="0">
|
||||
<item row="13" column="0">
|
||||
<widget class="QLabel" name="showname_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names.</string>
|
||||
@ -328,7 +328,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="24" column="0">
|
||||
<item row="25" column="0">
|
||||
<widget class="QLabel" name="stickyeffects_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Turn this on to prevent the effects dropdown from clearing the effect after playing it.</string>
|
||||
@ -338,14 +338,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="27" column="1">
|
||||
<item row="28" column="1">
|
||||
<widget class="QCheckBox" name="sticker_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="stay_time_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Minimum amount of time (in miliseconds) an IC message must stay on screen before the next IC message is shown, acting as a 'queue'. Set to 0 to disable this behavior.</string>
|
||||
@ -355,7 +355,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="17" column="0">
|
||||
<item row="18" column="0">
|
||||
<widget class="QLabel" name="language_label">
|
||||
<property name="toolTip">
|
||||
<string>Sets the language if you don't want to use your system language.</string>
|
||||
@ -365,35 +365,35 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="instant_objection_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="25" column="1">
|
||||
<item row="26" column="1">
|
||||
<widget class="QCheckBox" name="stickypres_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="13" column="1">
|
||||
<widget class="QCheckBox" name="showname_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="21" column="1">
|
||||
<item row="22" column="1">
|
||||
<widget class="QCheckBox" name="framenetwork_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="30" column="0">
|
||||
<item row="31" column="0">
|
||||
<widget class="QLabel" name="sfx_on_idle_lbl">
|
||||
<property name="toolTip">
|
||||
<string>If the SFX dropdown has an SFX selected, send the custom SFX alongside the message even if Preanim is OFF.</string>
|
||||
@ -403,7 +403,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="23" column="0">
|
||||
<item row="24" column="0">
|
||||
<widget class="QLabel" name="stickysounds_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Turn this on to prevent the sound dropdown from clearing the sound after playing it.</string>
|
||||
@ -413,14 +413,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="1">
|
||||
<item row="20" column="1">
|
||||
<widget class="QCheckBox" name="shake_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="0">
|
||||
<item row="12" column="0">
|
||||
<widget class="QLabel" name="username_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Your OOC name will be automatically set to this value when you join a server.</string>
|
||||
@ -430,7 +430,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="19" column="0">
|
||||
<item row="20" column="0">
|
||||
<widget class="QLabel" name="shake_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures.</string>
|
||||
@ -440,14 +440,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="animated_theme_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="16" column="0">
|
||||
<item row="17" column="0">
|
||||
<widget class="QLabel" name="discord_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for.</string>
|
||||
@ -457,7 +457,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="22" column="0">
|
||||
<item row="23" column="0">
|
||||
<widget class="QLabel" name="colorlog_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Use the markup colors in the server IC chatlog.</string>
|
||||
@ -477,31 +477,31 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="20" column="1">
|
||||
<item row="21" column="1">
|
||||
<widget class="QCheckBox" name="effects_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="29" column="1">
|
||||
<item row="30" column="1">
|
||||
<widget class="QCheckBox" name="category_stop_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="26" column="1">
|
||||
<item row="27" column="1">
|
||||
<widget class="QCheckBox" name="customchat_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<item row="14" column="1">
|
||||
<widget class="QLineEdit" name="default_showname_textbox"/>
|
||||
</item>
|
||||
<item row="14" column="1">
|
||||
<item row="15" column="1">
|
||||
<widget class="QFrame" name="net_divider">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::HLine</enum>
|
||||
@ -511,7 +511,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="6" column="1">
|
||||
<widget class="QFrame" name="theme_log_divider">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::HLine</enum>
|
||||
@ -521,14 +521,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="24" column="1">
|
||||
<item row="25" column="1">
|
||||
<widget class="QCheckBox" name="stickyeffects_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="31" column="0">
|
||||
<item row="32" column="0">
|
||||
<widget class="QLabel" name="evidence_double_click_lbl">
|
||||
<property name="toolTip">
|
||||
<string>If ticked, Evidence needs a double-click to view rather than a single click.</string>
|
||||
@ -538,7 +538,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<item row="11" column="1">
|
||||
<widget class="QFrame" name="log_names_divider">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::HLine</enum>
|
||||
@ -548,14 +548,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="31" column="1">
|
||||
<item row="32" column="1">
|
||||
<widget class="QCheckBox" name="evidence_double_click_cb">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="28" column="0">
|
||||
<item row="29" column="0">
|
||||
<widget class="QLabel" name="continuous_lbl">
|
||||
<property name="toolTip">
|
||||
<string>Whether or not to resume playing animations from where they left off. Turning off might reduce lag.</string>
|
||||
@ -565,13 +565,33 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="12" column="1">
|
||||
<widget class="QLineEdit" name="username_textbox">
|
||||
<property name="maxLength">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QSpinBox" name="theme_scaling_factor_sb">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>8</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="theme_scaling_factor_lbl">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>The factor by which to scale the size of the UI</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>UI Scaling Factor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -12,24 +12,28 @@ AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos,
|
||||
|
||||
taken = is_taken;
|
||||
|
||||
this->resize(60, 60);
|
||||
int size = 60 * Options::getInstance().themeScalingFactor();
|
||||
int selector_size = 62 * Options::getInstance().themeScalingFactor();
|
||||
|
||||
this->resize(size, size);
|
||||
this->move(x_pos, y_pos);
|
||||
|
||||
ui_taken = new AOImage(this, ao_app, true);
|
||||
ui_taken->resize(60, 60);
|
||||
ui_taken->resize(size, size);
|
||||
ui_taken->set_image("char_taken");
|
||||
ui_taken->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
ui_taken->hide();
|
||||
|
||||
ui_passworded = new AOImage(this, ao_app, true);
|
||||
ui_passworded->resize(60, 60);
|
||||
ui_passworded->resize(size, size);
|
||||
ui_passworded->set_image("char_passworded");
|
||||
ui_passworded->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
ui_passworded->hide();
|
||||
|
||||
ui_selector = new AOImage(parent, ao_app, true);
|
||||
ui_selector->resize(62, 62);
|
||||
ui_selector->move(x_pos - 1, y_pos - 1);
|
||||
ui_selector->resize(selector_size, selector_size);
|
||||
int offset = Options::getInstance().themeScalingFactor();
|
||||
ui_selector->move(x_pos - offset, y_pos - offset);
|
||||
ui_selector->set_image("char_selector");
|
||||
ui_selector->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
ui_selector->hide();
|
||||
@ -84,7 +88,8 @@ void AOCharButton::enterEvent(QEvent *e)
|
||||
void AOCharButton::enterEvent(QEnterEvent *e)
|
||||
#endif
|
||||
{
|
||||
ui_selector->move(this->x() - 1, this->y() - 1);
|
||||
int offset = Options::getInstance().themeScalingFactor();
|
||||
ui_selector->move(this->x() - offset, this->y() - offset);
|
||||
ui_selector->raise();
|
||||
ui_selector->show();
|
||||
|
||||
|
@ -151,11 +151,13 @@ void Courtroom::set_char_select_page()
|
||||
QPoint f_spacing =
|
||||
ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini");
|
||||
|
||||
int s_button_size = button_width * Options::getInstance().themeScalingFactor();
|
||||
|
||||
char_columns =
|
||||
((ui_char_buttons->width() - button_width) / (f_spacing.x() + button_width)) +
|
||||
((ui_char_buttons->width() - s_button_size) / (f_spacing.x() + s_button_size)) +
|
||||
1;
|
||||
char_rows = ((ui_char_buttons->height() - button_height) /
|
||||
(f_spacing.y() + button_height)) +
|
||||
char_rows = ((ui_char_buttons->height() - s_button_size) /
|
||||
(f_spacing.y() + s_button_size)) +
|
||||
1;
|
||||
|
||||
max_chars_on_page = char_columns * char_rows;
|
||||
@ -255,9 +257,10 @@ void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
|
||||
int y_mod_count = 0;
|
||||
|
||||
int startout = starting;
|
||||
int size = button_width * Options::getInstance().themeScalingFactor();
|
||||
for (int n = starting; n < startout + chars_on_this_page; ++n) {
|
||||
int x_pos = (button_width + f_spacing.x()) * x_mod_count;
|
||||
int y_pos = (button_height + f_spacing.y()) * y_mod_count;
|
||||
int x_pos = (size + f_spacing.x()) * x_mod_count;
|
||||
int y_pos = (size + f_spacing.y()) * y_mod_count;
|
||||
|
||||
ui_char_button_list_filtered.at(n)->move(x_pos, y_pos);
|
||||
ui_char_button_list_filtered.at(n)->show();
|
||||
|
@ -612,7 +612,7 @@ void Courtroom::set_courtroom_size()
|
||||
m_courtroom_width = f_courtroom.width;
|
||||
m_courtroom_height = f_courtroom.height;
|
||||
|
||||
this->setFixedSize(f_courtroom.width, f_courtroom.height);
|
||||
this->setFixedSize(m_courtroom_width, m_courtroom_height);
|
||||
}
|
||||
ui_background->move(0, 0);
|
||||
ui_background->resize(m_courtroom_width, m_courtroom_height);
|
||||
@ -1137,6 +1137,11 @@ void Courtroom::set_widgets()
|
||||
|
||||
void Courtroom::set_fonts(QString p_char)
|
||||
{
|
||||
QFont new_font = ao_app->default_font;
|
||||
int new_font_size = new_font.pointSize() * Options::getInstance().themeScalingFactor();
|
||||
new_font.setPointSize(new_font_size);
|
||||
ao_app->setFont(new_font);
|
||||
|
||||
set_font(ui_vp_showname, "", "showname", p_char);
|
||||
set_font(ui_vp_message, "", "message", p_char);
|
||||
set_font(ui_ic_chatlog, "", "ic_chatlog", p_char);
|
||||
@ -1159,7 +1164,7 @@ void Courtroom::set_font(QWidget *widget, QString class_name,
|
||||
QString design_file = "courtroom_fonts.ini";
|
||||
if (f_pointsize <= 0)
|
||||
f_pointsize =
|
||||
ao_app->get_design_element(p_identifier, design_file, ao_app->get_chat(p_char)).toInt();
|
||||
ao_app->get_design_element(p_identifier, design_file, ao_app->get_chat(p_char)).toInt() * Options::getInstance().themeScalingFactor();
|
||||
if (font_name == "")
|
||||
font_name =
|
||||
ao_app->get_design_element(p_identifier + "_font", design_file, ao_app->get_chat(p_char));
|
||||
|
@ -26,6 +26,14 @@ int main(int argc, char *argv[])
|
||||
AOApplication::addLibraryPath(AOApplication::applicationDirPath() + "/lib");
|
||||
QResource::registerResource(main_app.get_asset("themes/" + Options::getInstance().theme() + ".rcc"));
|
||||
|
||||
QFont main_font = main_app.font();
|
||||
main_app.default_font = main_font;
|
||||
|
||||
QFont new_font = main_font;
|
||||
int new_font_size = main_app.default_font.pointSize() * Options::getInstance().themeScalingFactor();
|
||||
new_font.setPointSize(new_font_size);
|
||||
main_app.setFont(new_font);
|
||||
|
||||
QFontDatabase fontDatabase;
|
||||
QDirIterator it(get_base_path() + "fonts",
|
||||
QDirIterator::Subdirectories);
|
||||
|
@ -87,6 +87,17 @@ QString Options::theme() const
|
||||
|
||||
void Options::setTheme(QString value) { config.setValue("theme", value); }
|
||||
|
||||
int Options::themeScalingFactor() const
|
||||
{
|
||||
int value = config.value("theme_scaling_factor", "1").toInt();
|
||||
if (value <= 0) {
|
||||
value = 1;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
void Options::setThemeScalingFactor(int value) { config.setValue("theme_scaling_factor", value); }
|
||||
|
||||
int Options::blipRate() const { return config.value("blip_rate", 2).toInt(); }
|
||||
|
||||
void Options::setBlipRate(int value) { config.setValue("blip_rate", value); }
|
||||
@ -480,7 +491,7 @@ void Options::setServerSubTheme(QString value) { m_server_subtheme = value; }
|
||||
|
||||
bool Options::animatedThemeEnabled() const
|
||||
{
|
||||
return config.value("animated_theme", true).toBool();
|
||||
return config.value("animated_theme", false).toBool();
|
||||
}
|
||||
|
||||
void Options::setAnimatedThemeEnabled(bool value)
|
||||
|
@ -173,9 +173,8 @@ QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file)
|
||||
|
||||
if (sub_line_elements.size() < 2)
|
||||
return return_value;
|
||||
|
||||
return_value.setX(sub_line_elements.at(0).toInt());
|
||||
return_value.setY(sub_line_elements.at(1).toInt());
|
||||
return_value.setX(sub_line_elements.at(0).toInt() * Options::getInstance().themeScalingFactor());
|
||||
return_value.setY(sub_line_elements.at(1).toInt() * Options::getInstance().themeScalingFactor());
|
||||
|
||||
return return_value;
|
||||
}
|
||||
@ -196,10 +195,12 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier,
|
||||
if (sub_line_elements.size() < 4)
|
||||
return return_value;
|
||||
|
||||
return_value.x = sub_line_elements.at(0).toInt();
|
||||
return_value.y = sub_line_elements.at(1).toInt();
|
||||
return_value.width = sub_line_elements.at(2).toInt();
|
||||
return_value.height = sub_line_elements.at(3).toInt();
|
||||
int scale = Options::getInstance().themeScalingFactor();
|
||||
|
||||
return_value.x = sub_line_elements.at(0).toInt() * scale;
|
||||
return_value.y = sub_line_elements.at(1).toInt() * scale;
|
||||
return_value.width = sub_line_elements.at(2).toInt() * scale;
|
||||
return_value.height = sub_line_elements.at(3).toInt() * scale;
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
@ -216,7 +216,10 @@ void AOOptionsDialog::updateValues()
|
||||
|
||||
void AOOptionsDialog::savePressed()
|
||||
{
|
||||
bool l_reload_theme_required = (ui_theme_combobox->currentText() != Options::getInstance().theme());
|
||||
bool l_reload_theme_required =
|
||||
(ui_theme_combobox->currentText() != Options::getInstance().theme()) ||
|
||||
(ui_theme_scaling_factor_sb->value() !=
|
||||
Options::getInstance().themeScalingFactor());
|
||||
for (const OptionEntry &entry : qAsConst(optionEntries)) {
|
||||
entry.save();
|
||||
}
|
||||
@ -337,6 +340,7 @@ void AOOptionsDialog::setupUI()
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(p_path));
|
||||
});
|
||||
|
||||
FROM_UI(QSpinBox, theme_scaling_factor_sb)
|
||||
FROM_UI(QCheckBox, animated_theme_cb)
|
||||
FROM_UI(QSpinBox, stay_time_spinbox)
|
||||
FROM_UI(QCheckBox, instant_objection_cb)
|
||||
@ -363,6 +367,9 @@ void AOOptionsDialog::setupUI()
|
||||
FROM_UI(QCheckBox, sfx_on_idle_cb)
|
||||
FROM_UI(QCheckBox, evidence_double_click_cb)
|
||||
|
||||
registerOption<QSpinBox, int>("theme_scaling_factor_sb",
|
||||
&Options::themeScalingFactor,
|
||||
&Options::setThemeScalingFactor);
|
||||
registerOption<QCheckBox, bool>("animated_theme_cb",
|
||||
&Options::animatedThemeEnabled,
|
||||
&Options::setAnimatedThemeEnabled);
|
||||
|
Loading…
Reference in New Issue
Block a user