diff --git a/data/ui/options_dialog.ui b/data/ui/options_dialog.ui index bcdb7a4..882092e 100644 --- a/data/ui/options_dialog.ui +++ b/data/ui/options_dialog.ui @@ -39,73 +39,45 @@ 0 - -555 + -385 394 - 872 + 878 - - - - - - - - - + + - Stop music when double-clicking a category. If this is disabled, use the right-click context menu to stop music. + 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. - Stop Music w/ Category: - - - - - - - + Theme: - - + + - Sets the default scaling method, if there is not one already defined specifically for the character. + 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. - Scaling: + Subtheme: - - - - Turn this on to allow characters to define their own custom chat box designs. - - - Custom Chatboxes: - - + + - - + + - Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. + Refresh the theme and update all of the ui elements to match. - Allow Effects: - - - - - - - + Reload Theme @@ -119,13 +91,70 @@ - - + + - Overrides the base URL to retrieve server information from. + <html><head/><body><p>The factor by which to scale the size of the UI</p></body></html> - Alternate Server List: + UI Scaling Factor + + + + + + + 1 + + + 8 + + + + + + + If ticked, themes will be allowed to have animated elements. + + + Animated Theme: + + + + + + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + 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. + + + Text Stay Time: + + + + + + + ms + + + 10000 @@ -136,6 +165,23 @@ + + + + + + + + + + + Amount of time (in miliseconds) spent on each letter when the in-character text is being displayed. + + + Text crawl: + + + @@ -146,32 +192,6 @@ - - - - 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. - - - Theme: - - - - - - - - - - - - - Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. - - - Network Frame Effects: - - - @@ -192,195 +212,13 @@ - - - - If ticked, themes will be allowed to have animated elements. + + + + QFrame::HLine - - Animated Theme: - - - - - - - Amount of time (in miliseconds) spent on each letter when the in-character text is being displayed. - - - Text crawl: - - - - - - - Refresh the theme and update all of the ui elements to match. - - - Reload Theme - - - - - - - - - - - - - - - - - Your showname will be automatically set to this value when you join a server. - - - Default showname: - - - - - - - - - - - - - - - - - Turn this on to allow characters to define their own stickers (unique images that show up over the chatbox - like avatars or shownames). - - - Stickers: - - - - - - - Turn this on to prevent preanimation checkbox from clearing after playing the emote. - - - Sticky Preanims: - - - - - - - ms - - - 10000 - - - - - - - Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. - - - Custom shownames: - - - - - - - Turn this on to prevent the effects dropdown from clearing the effect after playing it. - - - Sticky Effects: - - - - - - - - - - - - - - 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. - - - Text Stay Time: - - - - - - - Sets the language if you don't want to use your system language. - - - Language: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - If the SFX dropdown has an SFX selected, send the custom SFX alongside the message even if Preanim is OFF. - - - Always Send SFX: - - - - - - - Turn this on to prevent the sound dropdown from clearing the sound after playing it. - - - Sticky Sounds: - - - - - - - + + QFrame::Sunken @@ -394,71 +232,37 @@ - - - - Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. - - - Allow Screenshake: + + + + 30 - - + + + + Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. + + + Custom shownames: + + + + + - - + + - Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. + Your showname will be automatically set to this value when you join a server. - Discord: - - - - - - - Use the markup colors in the server IC chatlog. - - - Colors in IC Log: - - - - - - - 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. - - - Subtheme: - - - - - - - - - - - - - - - - - - - - - + Default showname: @@ -475,13 +279,141 @@ - - - - QFrame::HLine + + + + Overrides the base URL to retrieve server information from. - - QFrame::Sunken + + Alternate Server List: + + + + + + + + + + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. + + + Discord: + + + + + + + + + + + + + + Sets the language if you don't want to use your system language. + + + Language: + + + + + + + + + + Allows screenshaking. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + + Allow Screenshake: + + + + + + + + + + + + + + Allows screen effects. Disable this if you have concerns or issues with photosensitivity and/or seizures. + + + Allow Effects: + + + + + + + + + + + + + + Send screen-shaking, flashes and sounds as defined in the char.ini over the network. Only works for servers that support this functionality. + + + Network Frame Effects: + + + + + + + + + + + + + + Use the markup colors in the server IC chatlog. + + + Colors in IC Log: + + + + + + + + + + + + + + Turn this on to prevent the sound dropdown from clearing the sound after playing it. + + + Sticky Sounds: + + + + + + + + + + + + + + Turn this on to prevent the effects dropdown from clearing the effect after playing it. + + + Sticky Effects: @@ -492,28 +424,52 @@ - - + + - If ticked, Evidence needs a double-click to view rather than a single click. + Turn this on to prevent preanimation checkbox from clearing after playing the emote. - Evidence Double Click: + Sticky Preanims: - - - - QFrame::HLine - - - QFrame::Sunken + + + + - - + + + + Turn this on to allow characters to define their own custom chat box designs. + + + Custom Chatboxes: + + + + + + + + + + + + + + Turn this on to allow characters to define their own stickers (unique images that show up over the chatbox - like avatars or shownames). + + + Stickers: + + + + + @@ -529,30 +485,61 @@ - - - - 30 + + + + - - - - 1 - - - 8 - - - - - + + - <html><head/><body><p>The factor by which to scale the size of the UI</p></body></html> + Stop music when double-clicking a category. If this is disabled, use the right-click context menu to stop music. - UI Scaling Factor + Stop Music w/ Category: + + + + + + + + + + + + + + If the SFX dropdown has an SFX selected, send the custom SFX alongside the message even if Preanim is OFF. + + + Always Send SFX: + + + + + + + + + + + + + + If ticked, Evidence needs a double-click to view rather than a single click. + + + Evidence Double Click: + + + + + + + @@ -573,14 +560,14 @@ - + - + If ticked, some windows restore their last known position where they were closed. @@ -590,6 +577,38 @@ + + + + <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> + + + Image Scaling + + + + + + + <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> + + + + Automatic + + + + + Pixelated + + + + + Smooth + + + + @@ -944,7 +963,7 @@ Use this when you have added an asset that takes precedence over another existin - If ticked, new messages will appear separated, with the message coming on the next line after the name. + 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'. @@ -962,7 +981,7 @@ When unticked, it displays it as 'name: message'. - The distance in pixels between each entry in the IC log. + The distance in pixels between each entry in the IC log. Default: 0. diff --git a/src/animationlayer.cpp b/src/animationlayer.cpp index 9e77124..a1084ed 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 c0d9332..79ffcfa 100644 --- a/src/animationlayer.h +++ b/src/animationlayer.h @@ -1,6 +1,7 @@ #pragma once #include "animationloader.h" +#include "datatypes.h" #include #include @@ -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 e90579d..d040408 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 6def0b5..cea7ba0 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 30b384e..0bc6b20 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 fbcf01e..3af8b5d 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(); @@ -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 f28dfcd..f96f994 100644 --- a/src/options.h +++ b/src/options.h @@ -1,5 +1,6 @@ #pragma once +#include "datatypes.h" #include "network/serverinfo.h" #include @@ -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 763efb5..97e632e 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 db3c878..2c7b4e2 100644 --- a/src/widgets/aooptionsdialog.cpp +++ b/src/widgets/aooptionsdialog.cpp @@ -111,12 +111,24 @@ void AOOptionsDialog::setWidgetData(QComboBox *widget, const QString &value) qWarning() << "value" << value << "not found for widget" << widget->objectName(); } +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) { @@ -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("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("resize_combobox", &Options::resizeMode, &Options::setResizeMode); registerOption("shake_cb", &Options::shakeEnabled, &Options::setShakeEnabled); registerOption("effects_cb", &Options::effectsEnabled, &Options::setEffectsEnabled); registerOption("framenetwork_cb", &Options::networkedFrameSfxEnabled, &Options::setNetworkedFrameSfxEnabled); diff --git a/src/widgets/aooptionsdialog.h b/src/widgets/aooptionsdialog.h index eb64a53..20c95a3 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;