diff options
| author | Leifa <26681464+TrickyLeifa@users.noreply.github.com> | 2024-07-13 15:31:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-13 15:31:51 +0200 |
| commit | 23077d0291426037b6b120cf765664b4487c9330 (patch) | |
| tree | b1835d2d97791a99feb6d428ea6d3c2c941960d7 | |
| parent | a09712cc4d11ace7ae0476a1d1f060abfa8de445 (diff) | |
Resize mode patch (#1019)
* Fix transformation mode for layers
Resolve #997
* always use smooth transform resampling for stretched images
* Used fixed frame size
* Implemented resize mode changes
Resolve #999
* Added alias to pixel resize mode
* Added user option
---------
Co-authored-by: in1tiate <32779090+in1tiate@users.noreply.github.com>
| -rw-r--r-- | data/ui/options_dialog.ui | 503 | ||||
| -rw-r--r-- | src/animationlayer.cpp | 28 | ||||
| -rw-r--r-- | src/animationlayer.h | 5 | ||||
| -rw-r--r-- | src/aoapplication.h | 4 | ||||
| -rw-r--r-- | src/courtroom.cpp | 6 | ||||
| -rw-r--r-- | src/datatypes.h | 7 | ||||
| -rw-r--r-- | src/options.cpp | 20 | ||||
| -rw-r--r-- | src/options.h | 9 | ||||
| -rw-r--r-- | src/text_file_functions.cpp | 31 | ||||
| -rw-r--r-- | src/widgets/aooptionsdialog.cpp | 22 | ||||
| -rw-r--r-- | src/widgets/aooptionsdialog.h | 3 |
11 files changed, 341 insertions, 297 deletions
diff --git a/data/ui/options_dialog.ui b/data/ui/options_dialog.ui index bcdb7a44..882092ea 100644 --- a/data/ui/options_dialog.ui +++ b/data/ui/options_dialog.ui @@ -39,93 +39,122 @@ <property name="geometry"> <rect> <x>0</x> - <y>-555</y> + <y>-385</y> <width>394</width> - <height>872</height> + <height>878</height> </rect> </property> <layout class="QFormLayout" name="formLayout"> - <item row="24" column="1"> - <widget class="QCheckBox" name="stickysounds_cb"> + <item row="0" column="0"> + <widget class="QLabel" name="theme_label"> + <property name="toolTip"> + <string>Sets the theme used in-game. If the new theme changes the lobby's look as well, you'll need to reload the Lobby for the changes to take effect, such as by joining a server and leaving it.</string> + </property> <property name="text"> - <string/> + <string>Theme:</string> </property> </widget> </item> - <item row="30" column="0"> - <widget class="QLabel" name="category_stop_lbl"> + <item row="0" column="1"> + <widget class="QComboBox" name="theme_combobox"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="subtheme_label"> <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> + <string>Sets a 'subtheme', which will stack on top of the current theme and replace anything it can. Keep it at 'server' to let the server decide. Keep it at 'default' to keep it unchanging.</string> </property> <property name="text"> - <string>Stop Music w/ Category:</string> + <string>Subtheme:</string> </property> </widget> </item> - <item row="31" column="1"> - <widget class="QCheckBox" name="sfx_on_idle_cb"> + <item row="1" column="1"> + <widget class="QComboBox" name="subtheme_combobox"/> + </item> + <item row="2" column="1"> + <widget class="QPushButton" name="theme_reload_button"> + <property name="toolTip"> + <string>Refresh the theme and update all of the ui elements to match.</string> + </property> <property name="text"> - <string/> + <string>Reload Theme</string> </property> </widget> </item> - <item row="0" column="1"> - <widget class="QComboBox" name="theme_combobox"/> - </item> - <item row="19" column="0"> - <widget class="QLabel" name="scaling_label"> + <item row="3" column="1"> + <widget class="QPushButton" name="theme_folder_button"> <property name="toolTip"> - <string>Sets the default scaling method, if there is not one already defined specifically for the character.</string> + <string>Open the theme folder of the currently selected theme.</string> </property> <property name="text"> - <string>Scaling:</string> + <string>Open Theme Folder</string> </property> </widget> </item> - <item row="27" column="0"> - <widget class="QLabel" name="customchat_lbl"> + <item row="4" column="0"> + <widget class="QLabel" name="theme_scaling_factor_lbl"> <property name="toolTip"> - <string>Turn this on to allow characters to define their own custom chat box designs.</string> + <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>Custom Chatboxes:</string> + <string>UI Scaling Factor</string> </property> </widget> </item> - <item row="21" column="0"> - <widget class="QLabel" name="effects_lbl"> + <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="5" column="0"> + <widget class="QLabel" name="animated_theme_lbl"> <property name="toolTip"> - <string>Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures.</string> + <string>If ticked, themes will be allowed to have animated elements.</string> </property> <property name="text"> - <string>Allow Effects:</string> + <string>Animated Theme:</string> </property> </widget> </item> - <item row="17" column="1"> - <widget class="QCheckBox" name="discord_cb"> + <item row="5" column="1"> + <widget class="QCheckBox" name="animated_theme_cb"> <property name="text"> <string/> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QPushButton" name="theme_folder_button"> - <property name="toolTip"> - <string>Open the theme folder of the currently selected theme.</string> + <item row="6" column="1"> + <widget class="QFrame" name="theme_log_divider"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> </property> - <property name="text"> - <string>Open Theme Folder</string> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> </property> </widget> </item> - <item row="16" column="0"> - <widget class="QLabel" name="ms_lbl"> + <item row="7" column="0"> + <widget class="QLabel" name="stay_time_lbl"> <property name="toolTip"> - <string>Overrides the base URL to retrieve server information from.</string> + <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> </property> <property name="text"> - <string>Alternate Server List:</string> + <string>Text Stay Time:</string> + </property> + </widget> + </item> + <item row="7" column="1"> + <widget class="QSpinBox" name="stay_time_spinbox"> + <property name="suffix"> + <string> ms</string> + </property> + <property name="maximum"> + <number>10000</number> </property> </widget> </item> @@ -136,39 +165,30 @@ </property> </widget> </item> - <item row="9" column="1"> - <widget class="QSpinBox" name="text_crawl_spinbox"> - <property name="suffix"> - <string> ms</string> - </property> - <property name="maximum"> - <number>500</number> + <item row="8" column="1"> + <widget class="QCheckBox" name="instant_objection_cb"> + <property name="text"> + <string/> </property> </widget> </item> - <item row="0" column="0"> - <widget class="QLabel" name="theme_label"> + <item row="9" column="0"> + <widget class="QLabel" name="text_crawl_lbl"> <property name="toolTip"> - <string>Sets the theme used in-game. If the new theme changes the lobby's look as well, you'll need to reload the Lobby for the changes to take effect, such as by joining a server and leaving it.</string> + <string>Amount of time (in miliseconds) spent on each letter when the in-character text is being displayed.</string> </property> <property name="text"> - <string>Theme:</string> + <string>Text crawl:</string> </property> </widget> </item> - <item row="18" column="1"> - <widget class="QComboBox" name="language_combobox"/> - </item> - <item row="16" column="1"> - <widget class="QLineEdit" name="ms_textbox"/> - </item> - <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> + <item row="9" column="1"> + <widget class="QSpinBox" name="text_crawl_spinbox"> + <property name="suffix"> + <string> ms</string> </property> - <property name="text"> - <string>Network Frame Effects:</string> + <property name="maximum"> + <number>500</number> </property> </widget> </item> @@ -192,41 +212,45 @@ </property> </widget> </item> - <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> + <item row="11" column="1"> + <widget class="QFrame" name="log_names_divider"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> </property> - <property name="text"> - <string>Animated Theme:</string> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> </property> </widget> </item> - <item row="9" column="0"> - <widget class="QLabel" name="text_crawl_lbl"> + <item row="12" column="0"> + <widget class="QLabel" name="username_lbl"> <property name="toolTip"> - <string>Amount of time (in miliseconds) spent on each letter when the in-character text is being displayed.</string> + <string>Your OOC name will be automatically set to this value when you join a server.</string> </property> <property name="text"> - <string>Text crawl:</string> + <string>Default username:</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QPushButton" name="theme_reload_button"> + <item row="12" column="1"> + <widget class="QLineEdit" name="username_textbox"> + <property name="maxLength"> + <number>30</number> + </property> + </widget> + </item> + <item row="13" column="0"> + <widget class="QLabel" name="showname_lbl"> <property name="toolTip"> - <string>Refresh the theme and update all of the ui elements to match.</string> + <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> </property> <property name="text"> - <string>Reload Theme</string> + <string>Custom shownames:</string> </property> </widget> </item> - <item row="19" column="1"> - <widget class="QComboBox" name="scaling_combobox"/> - </item> - <item row="23" column="1"> - <widget class="QCheckBox" name="colorlog_cb"> + <item row="13" column="1"> + <widget class="QCheckBox" name="showname_cb"> <property name="text"> <string/> </property> @@ -242,111 +266,103 @@ </property> </widget> </item> - <item row="29" column="1"> - <widget class="QCheckBox" name="continuous_cb"> - <property name="text"> - <string/> + <item row="14" column="1"> + <widget class="QLineEdit" name="default_showname_textbox"/> + </item> + <item row="15" column="1"> + <widget class="QFrame" name="net_divider"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> + </property> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QComboBox" name="subtheme_combobox"/> - </item> - <item row="28" column="0"> - <widget class="QLabel" name="sticker_lbl"> + <item row="16" column="0"> + <widget class="QLabel" name="ms_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> + <string>Overrides the base URL to retrieve server information from.</string> </property> <property name="text"> - <string>Stickers:</string> + <string>Alternate Server List:</string> </property> </widget> </item> - <item row="26" column="0"> - <widget class="QLabel" name="stickypres_lbl"> + <item row="16" column="1"> + <widget class="QLineEdit" name="ms_textbox"/> + </item> + <item row="17" column="0"> + <widget class="QLabel" name="discord_lbl"> <property name="toolTip"> - <string>Turn this on to prevent preanimation checkbox from clearing after playing the emote.</string> + <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> </property> <property name="text"> - <string>Sticky Preanims:</string> + <string>Discord:</string> </property> </widget> </item> - <item row="7" column="1"> - <widget class="QSpinBox" name="stay_time_spinbox"> - <property name="suffix"> - <string> ms</string> - </property> - <property name="maximum"> - <number>10000</number> + <item row="17" column="1"> + <widget class="QCheckBox" name="discord_cb"> + <property name="text"> + <string/> </property> </widget> </item> - <item row="13" column="0"> - <widget class="QLabel" name="showname_lbl"> + <item row="18" column="0"> + <widget class="QLabel" name="language_label"> <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> + <string>Sets the language if you don't want to use your system language.</string> </property> <property name="text"> - <string>Custom shownames:</string> + <string>Language:</string> </property> </widget> </item> - <item row="25" column="0"> - <widget class="QLabel" name="stickyeffects_lbl"> + <item row="18" column="1"> + <widget class="QComboBox" name="language_combobox"/> + </item> + <item row="20" column="0"> + <widget class="QLabel" name="shake_lbl"> <property name="toolTip"> - <string>Turn this on to prevent the effects dropdown from clearing the effect after playing it.</string> + <string>Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures.</string> </property> <property name="text"> - <string>Sticky Effects:</string> + <string>Allow Screenshake:</string> </property> </widget> </item> - <item row="28" column="1"> - <widget class="QCheckBox" name="sticker_cb"> + <item row="20" column="1"> + <widget class="QCheckBox" name="shake_cb"> <property name="text"> <string/> </property> </widget> </item> - <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> - </property> - <property name="text"> - <string>Text Stay Time:</string> - </property> - </widget> - </item> - <item row="18" column="0"> - <widget class="QLabel" name="language_label"> + <item row="21" column="0"> + <widget class="QLabel" name="effects_lbl"> <property name="toolTip"> - <string>Sets the language if you don't want to use your system language.</string> + <string>Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures.</string> </property> <property name="text"> - <string>Language:</string> + <string>Allow Effects:</string> </property> </widget> </item> - <item row="8" column="1"> - <widget class="QCheckBox" name="instant_objection_cb"> + <item row="21" column="1"> + <widget class="QCheckBox" name="effects_cb"> <property name="text"> <string/> </property> </widget> </item> - <item row="26" column="1"> - <widget class="QCheckBox" name="stickypres_cb"> - <property name="text"> - <string/> + <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> </property> - </widget> - </item> - <item row="13" column="1"> - <widget class="QCheckBox" name="showname_cb"> <property name="text"> - <string/> + <string>Network Frame Effects:</string> </property> </widget> </item> @@ -357,13 +373,20 @@ </property> </widget> </item> - <item row="31" column="0"> - <widget class="QLabel" name="sfx_on_idle_lbl"> + <item row="23" column="0"> + <widget class="QLabel" name="colorlog_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> + <string>Use the markup colors in the server IC chatlog.</string> </property> <property name="text"> - <string>Always Send SFX:</string> + <string>Colors in IC Log:</string> + </property> + </widget> + </item> + <item row="23" column="1"> + <widget class="QCheckBox" name="colorlog_cb"> + <property name="text"> + <string/> </property> </widget> </item> @@ -377,182 +400,146 @@ </property> </widget> </item> - <item row="20" column="1"> - <widget class="QCheckBox" name="shake_cb"> + <item row="24" column="1"> + <widget class="QCheckBox" name="stickysounds_cb"> <property name="text"> <string/> </property> </widget> </item> - <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> - </property> - <property name="text"> - <string>Default username:</string> - </property> - </widget> - </item> - <item row="20" column="0"> - <widget class="QLabel" name="shake_lbl"> + <item row="25" column="0"> + <widget class="QLabel" name="stickyeffects_lbl"> <property name="toolTip"> - <string>Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures.</string> + <string>Turn this on to prevent the effects dropdown from clearing the effect after playing it.</string> </property> <property name="text"> - <string>Allow Screenshake:</string> + <string>Sticky Effects:</string> </property> </widget> </item> - <item row="5" column="1"> - <widget class="QCheckBox" name="animated_theme_cb"> + <item row="25" column="1"> + <widget class="QCheckBox" name="stickyeffects_cb"> <property name="text"> <string/> </property> </widget> </item> - <item row="17" column="0"> - <widget class="QLabel" name="discord_lbl"> + <item row="26" column="0"> + <widget class="QLabel" name="stickypres_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> + <string>Turn this on to prevent preanimation checkbox from clearing after playing the emote.</string> </property> <property name="text"> - <string>Discord:</string> + <string>Sticky Preanims:</string> </property> </widget> </item> - <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> - </property> + <item row="26" column="1"> + <widget class="QCheckBox" name="stickypres_cb"> <property name="text"> - <string>Colors in IC Log:</string> + <string/> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="subtheme_label"> + <item row="27" column="0"> + <widget class="QLabel" name="customchat_lbl"> <property name="toolTip"> - <string>Sets a 'subtheme', which will stack on top of the current theme and replace anything it can. Keep it at 'server' to let the server decide. Keep it at 'default' to keep it unchanging.</string> + <string>Turn this on to allow characters to define their own custom chat box designs.</string> </property> <property name="text"> - <string>Subtheme:</string> + <string>Custom Chatboxes:</string> </property> </widget> </item> - <item row="21" column="1"> - <widget class="QCheckBox" name="effects_cb"> + <item row="27" column="1"> + <widget class="QCheckBox" name="customchat_cb"> <property name="text"> <string/> </property> </widget> </item> - <item row="30" column="1"> - <widget class="QCheckBox" name="category_stop_cb"> + <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> + </property> <property name="text"> - <string/> + <string>Stickers:</string> </property> </widget> </item> - <item row="27" column="1"> - <widget class="QCheckBox" name="customchat_cb"> + <item row="28" column="1"> + <widget class="QCheckBox" name="sticker_cb"> <property name="text"> <string/> </property> </widget> </item> - <item row="14" column="1"> - <widget class="QLineEdit" name="default_showname_textbox"/> - </item> - <item row="15" column="1"> - <widget class="QFrame" name="net_divider"> - <property name="frameShape"> - <enum>QFrame::HLine</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> - </property> - </widget> - </item> - <item row="6" column="1"> - <widget class="QFrame" name="theme_log_divider"> - <property name="frameShape"> - <enum>QFrame::HLine</enum> + <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> </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> + <property name="text"> + <string>Continuous Playback:</string> </property> </widget> </item> - <item row="25" column="1"> - <widget class="QCheckBox" name="stickyeffects_cb"> + <item row="29" column="1"> + <widget class="QCheckBox" name="continuous_cb"> <property name="text"> <string/> </property> </widget> </item> - <item row="32" column="0"> - <widget class="QLabel" name="evidence_double_click_lbl"> + <item row="30" column="0"> + <widget class="QLabel" name="category_stop_lbl"> <property name="toolTip"> - <string>If ticked, Evidence needs a double-click to view rather than a single click.</string> + <string>Stop music when double-clicking a category. If this is disabled, use the right-click context menu to stop music.</string> </property> <property name="text"> - <string>Evidence Double Click:</string> - </property> - </widget> - </item> - <item row="11" column="1"> - <widget class="QFrame" name="log_names_divider"> - <property name="frameShape"> - <enum>QFrame::HLine</enum> - </property> - <property name="frameShadow"> - <enum>QFrame::Sunken</enum> + <string>Stop Music w/ Category:</string> </property> </widget> </item> - <item row="32" column="1"> - <widget class="QCheckBox" name="evidence_double_click_cb"> + <item row="30" column="1"> + <widget class="QCheckBox" name="category_stop_cb"> <property name="text"> <string/> </property> </widget> </item> - <item row="29" column="0"> - <widget class="QLabel" name="continuous_lbl"> + <item row="31" column="0"> + <widget class="QLabel" name="sfx_on_idle_lbl"> <property name="toolTip"> - <string>Whether or not to resume playing animations from where they left off. Turning off might reduce lag.</string> + <string>If the SFX dropdown has an SFX selected, send the custom SFX alongside the message even if Preanim is OFF.</string> </property> <property name="text"> - <string>Continuous Playback:</string> + <string>Always Send SFX:</string> </property> </widget> </item> - <item row="12" column="1"> - <widget class="QLineEdit" name="username_textbox"> - <property name="maxLength"> - <number>30</number> + <item row="31" column="1"> + <widget class="QCheckBox" name="sfx_on_idle_cb"> + <property name="text"> + <string/> </property> </widget> </item> - <item row="4" column="1"> - <widget class="QSpinBox" name="theme_scaling_factor_sb"> - <property name="minimum"> - <number>1</number> + <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> </property> - <property name="maximum"> - <number>8</number> + <property name="text"> + <string>Evidence Double Click:</string> </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> + <item row="32" column="1"> + <widget class="QCheckBox" name="evidence_double_click_cb"> <property name="text"> - <string>UI Scaling Factor</string> + <string/> </property> </widget> </item> @@ -573,14 +560,14 @@ </property> </widget> </item> - <item row="34" column="1"> + <item row="35" column="1"> <widget class="QCheckBox" name="restoreposition_cb"> <property name="text"> <string/> </property> </widget> </item> - <item row="34" column="0"> + <item row="35" column="0"> <widget class="QLabel" name="restoreposition_lbl"> <property name="toolTip"> <string>If ticked, some windows restore their last known position where they were closed.</string> @@ -590,6 +577,38 @@ </property> </widget> </item> + <item row="19" column="0"> + <widget class="QLabel" name="resize_lbl"> + <property name="toolTip"> + <string><html><head/><body><p>The scaling algorithm to be used when upscaling or downscaling images.</p><p>Automatic: The image will be scaled based on the image's predetermined scaling algorithm.<br/>Pixelated: The image will be scaled using a nearest neighbor algorithm.<br/>Smooth: The image will be scaled using a bilinear algorithm.</p></body></html></string> + </property> + <property name="text"> + <string>Image Scaling</string> + </property> + </widget> + </item> + <item row="19" column="1"> + <widget class="QComboBox" name="resize_combobox"> + <property name="toolTip"> + <string><html><head/><body><p>The scaling algorithm to be used when upscaling or downscaling images.</p><p>Automatic: The image will be scaled based on the image's predetermined scaling algorithm.<br/>Pixelated: The image will be scaled using a nearest neighbor algorithm.<br/>Smooth: The image will be scaled using a bilinear algorithm.</p></body></html></string> + </property> + <item> + <property name="text"> + <string>Automatic</string> + </property> + </item> + <item> + <property name="text"> + <string>Pixelated</string> + </property> + </item> + <item> + <property name="text"> + <string>Smooth</string> + </property> + </item> + </widget> + </item> </layout> </widget> </widget> @@ -944,7 +963,7 @@ Use this when you have added an asset that takes precedence over another existin <item row="2" column="0"> <widget class="QLabel" name="log_newline_lbl"> <property name="toolTip"> - <string>If ticked, new messages will appear separated, with the message coming on the next line after the name. + <string>If ticked, new messages will appear separated, with the message coming on the next line after the name. When unticked, it displays it as 'name: message'.</string> </property> <property name="text"> @@ -962,7 +981,7 @@ When unticked, it displays it as 'name: message'.</string> <item row="3" column="0"> <widget class="QLabel" name="log_margin_lbl"> <property name="toolTip"> - <string>The distance in pixels between each entry in the IC log. + <string>The distance in pixels between each entry in the IC log. Default: 0.</string> </property> <property name="text"> diff --git a/src/animationlayer.cpp b/src/animationlayer.cpp index 9e771246..a1084eda 100644 --- a/src/animationlayer.cpp +++ b/src/animationlayer.cpp @@ -168,9 +168,9 @@ void AnimationLayer::setFlipped(bool enabled) m_flipped = enabled; } -void AnimationLayer::setTransformationMode(Qt::TransformationMode mode) +void AnimationLayer::setResizeMode(RESIZE_MODE mode) { - m_transformation_mode_hint = mode; + m_resize_mode = mode; } void AnimationLayer::setMinimumDurationPerFrame(int duration) @@ -229,7 +229,7 @@ void AnimationLayer::calculateFrameGeometry() { m_mask_rect = QRect(); m_scaled_frame_size = QSize(); - m_transformation_mode = m_transformation_mode_hint; + m_transformation_mode = Qt::SmoothTransformation; QSize widget_size = size(); if (!widget_size.isValid() || !m_frame_size.isValid()) @@ -240,7 +240,6 @@ void AnimationLayer::calculateFrameGeometry() if (m_stretch_to_fit) { m_scaled_frame_size = widget_size; - m_transformation_mode = Qt::SmoothTransformation; } else { @@ -253,11 +252,20 @@ void AnimationLayer::calculateFrameGeometry() double scale = double(widget_size.height()) / double(m_scaled_frame_size.height()); m_scaled_frame_size *= scale; + + if (m_frame_size.height() < widget_size.height()) + { + m_transformation_mode = Qt::FastTransformation; + } } - if (m_transformation_mode_hint == Qt::FastTransformation) + if (m_resize_mode == PIXEL_RESIZE_MODE) { - m_transformation_mode = widget_size.height() < m_frame_size.height() ? Qt::SmoothTransformation : Qt::FastTransformation; + m_transformation_mode = Qt::FastTransformation; + } + else if (m_resize_mode == SMOOTH_RESIZE_MODE) + { + m_transformation_mode = Qt::SmoothTransformation; } displayCurrentFrame(); @@ -451,7 +459,7 @@ void CharacterAnimationLayer::loadCharacterEmote(QString character, QString file setFileName(file_path); setPlayOnce(play_once); - setTransformationMode(ao_app->get_scaling(ao_app->get_emote_property(character, fileName, "scaling"))); + setResizeMode(ao_app->get_scaling(ao_app->get_emote_property(character, fileName, "scaling"))); setStretchToFit(ao_app->get_emote_property(character, fileName, "stretch").startsWith("true")); if (synchronize_frame && previous_frame_count == frameCount()) { @@ -600,7 +608,7 @@ void BackgroundAnimationLayer::loadAndPlayAnimation(QString fileName) } VPath design_path = ao_app->get_background_path("design.ini"); - setTransformationMode(ao_app->get_scaling(ao_app->read_design_ini("scaling", design_path))); + setResizeMode(ao_app->get_scaling(ao_app->read_design_ini("scaling", design_path))); setStretchToFit(ao_app->read_design_ini("stretch", design_path).startsWith("true")); if (is_different_file) @@ -621,7 +629,7 @@ void SplashAnimationLayer::loadAndPlayAnimation(QString p_filename, QString p_ch { QString file_path = ao_app->get_image(p_filename, Options::getInstance().theme(), Options::getInstance().subTheme(), ao_app->default_theme, p_miscname, p_charname, "placeholder"); setFileName(file_path); - setTransformationMode(ao_app->get_misc_scaling(p_miscname)); + setResizeMode(ao_app->get_misc_scaling(p_miscname)); startPlayback(); } @@ -688,7 +696,7 @@ void StickerAnimationLayer::loadAndPlayAnimation(QString fileName) QString file_path = ao_app->get_image("sticker/" + fileName, Options::getInstance().theme(), Options::getInstance().subTheme(), ao_app->default_theme, misc_file); setFileName(file_path); - setTransformationMode(ao_app->get_misc_scaling(misc_file)); + setResizeMode(ao_app->get_misc_scaling(misc_file)); startPlayback(); } } // namespace kal diff --git a/src/animationlayer.h b/src/animationlayer.h index c0d9332f..79ffcfa6 100644 --- a/src/animationlayer.h +++ b/src/animationlayer.h @@ -1,6 +1,7 @@ #pragma once #include "animationloader.h" +#include "datatypes.h" #include <QBitmap> #include <QDebug> @@ -68,7 +69,7 @@ public: void setStretchToFit(bool enabled); void setResetCacheWhenStopped(bool enabled); void setFlipped(bool enabled); - void setTransformationMode(Qt::TransformationMode mode); + void setResizeMode(RESIZE_MODE mode); void setMinimumDurationPerFrame(int duration); void setMaximumDurationPerFrame(int duration); @@ -92,7 +93,7 @@ private: bool m_flipped = false; int m_minimum_duration = 0; int m_maximum_duration = 0; - Qt::TransformationMode m_transformation_mode_hint = Qt::FastTransformation; + RESIZE_MODE m_resize_mode = AUTO_RESIZE_MODE; Qt::TransformationMode m_transformation_mode = Qt::FastTransformation; AnimationLoader *m_loader = nullptr; QSize m_frame_size; diff --git a/src/aoapplication.h b/src/aoapplication.h index e90579de..d040408d 100644 --- a/src/aoapplication.h +++ b/src/aoapplication.h @@ -307,10 +307,10 @@ public: QString get_emote_property(QString p_char, QString p_emote, QString p_property); // Return a transformation mode from a string ("smooth" for smooth, anything else for fast) - Qt::TransformationMode get_scaling(QString p_scaling); + RESIZE_MODE get_scaling(QString p_scaling); // Returns the scaling type for p_miscname - Qt::TransformationMode get_misc_scaling(QString p_miscname); + RESIZE_MODE get_misc_scaling(QString p_miscname); // ====== // These are all casing-related settings. diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6def0b5e..cea7ba07 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -159,7 +159,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) ui_music_list->setObjectName("ui_music_list"); ui_music_display = new kal::InterfaceAnimationLayer(ao_app, this); - ui_music_display->setTransformationMode(Qt::SmoothTransformation); + ui_music_display->setResizeMode(SMOOTH_RESIZE_MODE); ui_music_display->setAttribute(Qt::WA_TransparentForMouseEvents); ui_music_display->setObjectName("ui_music_display"); @@ -3152,8 +3152,8 @@ void Courtroom::do_effect(QString fx_path, QString fx_sound, QString p_char, QSt { return; } - ui_vp_effect->setTransformationMode(ao_app->get_scaling(ao_app->get_effect_property(fx_path, p_char, p_folder, "scaling"))); ui_vp_effect->setStretchToFit(ao_app->get_effect_property(fx_path, p_char, p_folder, "stretch").startsWith("true")); + ui_vp_effect->setResizeMode(ao_app->get_scaling(ao_app->get_effect_property(fx_path, p_char, p_folder, "scaling"))); ui_vp_effect->setFlipped(ao_app->get_effect_property(fx_path, p_char, p_folder, "respect_flip").startsWith("true") && m_chatmessage[FLIP].toInt() == 1); bool looping = ao_app->get_effect_property(fx_path, p_char, p_folder, "loop").startsWith("true"); @@ -4221,7 +4221,7 @@ void Courtroom::chat_tick() f_char = m_chatmessage[CHAR_NAME]; f_custom_theme = ao_app->get_chat(f_char); } - ui_vp_chat_arrow->setTransformationMode(ao_app->get_misc_scaling(f_custom_theme)); + ui_vp_chat_arrow->setResizeMode(ao_app->get_misc_scaling(f_custom_theme)); ui_vp_chat_arrow->loadAndPlayAnimation("chat_arrow", f_custom_theme); // Chat stopped being processed, indicate that. QString f_message_filtered = filter_ic_text(f_message, true, -1, m_chatmessage[TEXT_COLOR].toInt()); if (Options::getInstance().customChatboxEnabled()) diff --git a/src/datatypes.h b/src/datatypes.h index 30b384e8..0bc6b20f 100644 --- a/src/datatypes.h +++ b/src/datatypes.h @@ -99,6 +99,13 @@ enum MUSIC_EFFECT SYNC_POS = 4 }; +enum RESIZE_MODE +{ + AUTO_RESIZE_MODE, + PIXEL_RESIZE_MODE, + SMOOTH_RESIZE_MODE, +}; + class PlayerData { public: diff --git a/src/options.cpp b/src/options.cpp index fbcf01e2..3af8b5d7 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -550,16 +550,6 @@ void Options::setAnimatedThemeEnabled(bool value) config.setValue("animated_theme", value); } -QString Options::defaultScalingMode() const -{ - return config.value("default_scaling", "fast").toString(); -} - -void Options::setDefaultScalingMode(QString value) -{ - config.setValue("default_scaling", value); -} - QStringList Options::mountPaths() const { return config.value("mount_paths").value<QStringList>(); @@ -620,6 +610,16 @@ void Options::setLanguage(QString value) config.setValue("language", value); } +RESIZE_MODE Options::resizeMode() const +{ + return RESIZE_MODE(config.value("resize_mode", AUTO_RESIZE_MODE).toInt()); +} + +void Options::setResizeMode(RESIZE_MODE value) +{ + config.setValue("resize_mode", value); +} + QStringList Options::callwords() const { QStringList l_callwords = config.value("callwords", QStringList{}).toStringList(); diff --git a/src/options.h b/src/options.h index f28dfcd3..f96f994b 100644 --- a/src/options.h +++ b/src/options.h @@ -1,5 +1,6 @@ #pragma once +#include "datatypes.h" #include "network/serverinfo.h" #include <QCoreApplication> @@ -224,10 +225,6 @@ public: bool animatedThemeEnabled() const; void setAnimatedThemeEnabled(bool value); - // Get the default scaling method - QString defaultScalingMode() const; - void setDefaultScalingMode(QString value); - // Get a list of custom mount paths QStringList mountPaths() const; void setMountPaths(QStringList value); @@ -252,6 +249,10 @@ public: QString language() const; void setLanguage(QString value); + // The scaling algorithm to use on images. + RESIZE_MODE resizeMode() const; + void setResizeMode(RESIZE_MODE value); + // Callwords notify the user when the word/words are used in a game message. QStringList callwords() const; void setCallwords(QStringList value); diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 763efb58..97e632e3 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -175,18 +175,22 @@ QString AOApplication::read_design_ini(QString p_identifier, QString p_design_pa return ""; } -Qt::TransformationMode AOApplication::get_scaling(QString p_scaling) +RESIZE_MODE AOApplication::get_scaling(QString p_scaling) { - if (p_scaling.isEmpty()) + RESIZE_MODE mode = Options::getInstance().resizeMode(); + if (mode == AUTO_RESIZE_MODE) { - p_scaling = Options::getInstance().defaultScalingMode(); + if (p_scaling == "smooth") + { + mode = SMOOTH_RESIZE_MODE; + } + else if (p_scaling == "pixel" || p_scaling == "fast") + { + mode = PIXEL_RESIZE_MODE; + } } - if (p_scaling == "smooth") - { - return Qt::SmoothTransformation; - } - return Qt::FastTransformation; + return mode; } QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file) @@ -536,7 +540,7 @@ QString AOApplication::get_emote_property(QString p_char, QString p_emote, QStri return f_result; } -Qt::TransformationMode AOApplication::get_misc_scaling(QString p_miscname) +RESIZE_MODE AOApplication::get_misc_scaling(QString p_miscname) { if (p_miscname != "") { @@ -545,12 +549,11 @@ Qt::TransformationMode AOApplication::get_misc_scaling(QString p_miscname) { misc_transform_mode = read_design_ini("scaling", get_misc_path(p_miscname, "config.ini")); } - if (misc_transform_mode == "smooth") - { - return Qt::SmoothTransformation; - } + + return get_scaling(misc_transform_mode); } - return Qt::FastTransformation; + + return AUTO_RESIZE_MODE; } QString AOApplication::get_category(QString p_char) diff --git a/src/widgets/aooptionsdialog.cpp b/src/widgets/aooptionsdialog.cpp index db3c8788..2c7b4e28 100644 --- a/src/widgets/aooptionsdialog.cpp +++ b/src/widgets/aooptionsdialog.cpp @@ -112,12 +112,24 @@ void AOOptionsDialog::setWidgetData(QComboBox *widget, const QString &value) } template <> +void AOOptionsDialog::setWidgetData(QComboBox *widget, const RESIZE_MODE &value) +{ + widget->setCurrentIndex(value); +} + +template <> QString AOOptionsDialog::widgetData(QComboBox *widget) const { return widget->currentData().toString(); } template <> +RESIZE_MODE AOOptionsDialog::widgetData(QComboBox *widget) const +{ + return RESIZE_MODE(widget->currentIndex()); +} + +template <> void AOOptionsDialog::setWidgetData(QGroupBox *widget, const bool &value) { widget->setChecked(value); @@ -344,7 +356,7 @@ void AOOptionsDialog::setupUI() FROM_UI(QLineEdit, ms_textbox); FROM_UI(QCheckBox, discord_cb); FROM_UI(QComboBox, language_combobox); - FROM_UI(QComboBox, scaling_combobox); + FROM_UI(QComboBox, resize_combobox); FROM_UI(QCheckBox, shake_cb); FROM_UI(QCheckBox, effects_cb); FROM_UI(QCheckBox, framenetwork_cb); @@ -382,13 +394,7 @@ void AOOptionsDialog::setupUI() ui_language_combobox->addItem("日本語", "jp"); ui_language_combobox->addItem("Русский", "ru"); - registerOption<QComboBox, QString>("scaling_combobox", &Options::defaultScalingMode, &Options::setDefaultScalingMode); - - // Populate scaling dropdown. This is necessary as we need the user data - // embeeded into the entry. - ui_scaling_combobox->addItem(tr("Pixel"), "fast"); - ui_scaling_combobox->addItem(tr("Smooth"), "smooth"); - + registerOption<QComboBox, RESIZE_MODE>("resize_combobox", &Options::resizeMode, &Options::setResizeMode); registerOption<QCheckBox, bool>("shake_cb", &Options::shakeEnabled, &Options::setShakeEnabled); registerOption<QCheckBox, bool>("effects_cb", &Options::effectsEnabled, &Options::setEffectsEnabled); registerOption<QCheckBox, bool>("framenetwork_cb", &Options::networkedFrameSfxEnabled, &Options::setNetworkedFrameSfxEnabled); diff --git a/src/widgets/aooptionsdialog.h b/src/widgets/aooptionsdialog.h index eb64a539..20c95a3f 100644 --- a/src/widgets/aooptionsdialog.h +++ b/src/widgets/aooptionsdialog.h @@ -63,8 +63,7 @@ private: QCheckBox *ui_discord_cb; QLabel *ui_language_label; QComboBox *ui_language_combobox; - QLabel *ui_scaling_label; - QComboBox *ui_scaling_combobox; + QComboBox *ui_resize_combobox; QCheckBox *ui_shake_cb; QCheckBox *ui_effects_cb; QCheckBox *ui_framenetwork_cb; |
