diff options
| author | Salanto <62221668+Salanto@users.noreply.github.com> | 2023-05-31 20:17:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-31 20:17:30 +0200 |
| commit | 7c1fe80d4cbece55149b6fd52e3e90515f440446 (patch) | |
| tree | 2fc87a7cfb5bf9dbb81f52c857a769a6413e8b14 /src/text_file_functions.cpp | |
| parent | 2915f4cc04c75f02d5c6c89e497193bb981c34b5 (diff) | |
2.10.1 Changes (#888)
* Utilise .ui file to create settings dialog (#858)
* Remove config loading from AOApplications
Removes most, but not all config functions from AOApplication and moves them into their own class.
Not even remotely done here. but holy shit I'm tired.
* First steps towards UI file
* Fixed your UI layout issue
* Leifa bullies me
* Set all the setters
Reminder : Figure out why username and ooc_name exist. Are they the same? Maybe. Maybe not. Gonna have to look at it and migrate the key.
Todo : Cleanup key naming. Most of these are terrible, imprecise or I just don't like them.
* Make layout appear proper
* Minor option dialog update
* Hookup AOOptionsdialogue to Options Getter/setter
Not done yet, but parts of the options interactions work again.
* More settings menu working
* Mostly working settings dialogue
Restore default and cancel still need work
* Fix asset widget
* Tooltips
Also removes the commented out tooltip code
* Finish Tooltips
Move widget implementation to its own folder
* Migrate callwords to config.ini
Also correct sleep deprived code.
* Fix widget translation
* Language dropdown changes
We might want to look into doing this a bit better.
* Remove QSettings from AOApplication
Try cleaning up stray references to said object anymore
* Fix constructor order to prevent runtime crash
* Slightly sort implementation file
* Remove unused label declarations from header
Fix some comments
* Formatting
* Fix buttons
Also fixes restore settings when a restore to default is aborted.
* Raise pair list after courtroom construction (#859)
* Don't reset evidence selection (#860)
They are defaulted in the header. This SHOULD not affect the client negatively.
* Hitting the emergency exit (#861)
Don't change the widget state when the ID exceeds the current widget list due to pages being changed while evidence is being edited.
* add CI and license badge
* add contributors
* Handle config.temp after confirmation
* Deletes config.temp when the user has confirmed they want to keep the current settings.
* Make reset to default destructive
Don't worry, we ask first! :)
* Fix case of self_offset received without a y offset (#864)
caused by typos in #701
it's possible for older clients to send x offsets without a y
offset. if you think this case is annoying you can remove it in
the next version and handle it server-side instead
* Change default settings (#839)
* Make default config enable features for most cases except for Continuous Playback due to it introducing performance issues according to tooltip and confirmed in testing
* Increase log size to 1000
* Default disable animated themes
Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com>
Co-authored-by: stonedDiscord <Tukz@gmx.de>
* Make it a singleton? Maybe? I dunno? Ask Longbyte
* Commit suggestions
* More suggestions
Also try fixing a memory leak. Not going to well.
* Return to dialog
Otherwise we don't have Exec.
* Cleanup
* Deprecate ooc_name, implement username
* Remove ooc_name key and copy its value to default_showname if its empty.
* Consistent naming in AOOptionsDialog
* Clang format
* Don't write the username to the showname
* Fix theme dropdown being incorrectly set
* Bandaid callword playing every message
* Remove unused or duplicate includes
* More include removals
Removes lobby and courtroom direct includes from the dialog source
* Burn baby, burn!
* Remove reload_theme function
* Remove "Case Alert Supported Message"
All servers I tested on master supported it. The text is redundant in operation.
Co-authored-by: TrickyLeifa <date.epoch@gmail.com>
Co-authored-by: stonedDiscord <Tukz@gmx.de>
Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
Co-authored-by: Crystalwarrior <Varsash@Gmail.com>
* Cleanup lobby (#880)
* Remove config loading from AOApplications
Removes most, but not all config functions from AOApplication and moves them into their own class.
Not even remotely done here. but holy shit I'm tired.
* First steps towards UI file
* Fixed your UI layout issue
* Leifa bullies me
* Set all the setters
Reminder : Figure out why username and ooc_name exist. Are they the same? Maybe. Maybe not. Gonna have to look at it and migrate the key.
Todo : Cleanup key naming. Most of these are terrible, imprecise or I just don't like them.
* Make layout appear proper
* Minor option dialog update
* Hookup AOOptionsdialogue to Options Getter/setter
Not done yet, but parts of the options interactions work again.
* More settings menu working
* Mostly working settings dialogue
Restore default and cancel still need work
* Fix asset widget
* Tooltips
Also removes the commented out tooltip code
* Finish Tooltips
Move widget implementation to its own folder
* Migrate callwords to config.ini
Also correct sleep deprived code.
* Fix widget translation
* Language dropdown changes
We might want to look into doing this a bit better.
* Remove QSettings from AOApplication
Try cleaning up stray references to said object anymore
* Fix constructor order to prevent runtime crash
* Slightly sort implementation file
* Remove unused label declarations from header
Fix some comments
* Formatting
* Fix buttons
Also fixes restore settings when a restore to default is aborted.
* Raise pair list after courtroom construction (#859)
* Don't reset evidence selection (#860)
They are defaulted in the header. This SHOULD not affect the client negatively.
* Hitting the emergency exit (#861)
Don't change the widget state when the ID exceeds the current widget list due to pages being changed while evidence is being edited.
* add CI and license badge
* add contributors
* Handle config.temp after confirmation
* Deletes config.temp when the user has confirmed they want to keep the current settings.
* Make reset to default destructive
Don't worry, we ask first! :)
* Fix case of self_offset received without a y offset (#864)
caused by typos in #701
it's possible for older clients to send x offsets without a y
offset. if you think this case is annoying you can remove it in
the next version and handle it server-side instead
* Change default settings (#839)
* Make default config enable features for most cases except for Continuous Playback due to it introducing performance issues according to tooltip and confirmed in testing
* Increase log size to 1000
* Default disable animated themes
Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com>
Co-authored-by: stonedDiscord <Tukz@gmx.de>
* Make it a singleton? Maybe? I dunno? Ask Longbyte
* Commit suggestions
* More suggestions
Also try fixing a memory leak. Not going to well.
* Return to dialog
Otherwise we don't have Exec.
* Cleanup
* Deprecate ooc_name, implement username
* Remove ooc_name key and copy its value to default_showname if its empty.
* Consistent naming in AOOptionsDialog
* Clang format
* Don't write the username to the showname
* Fix theme dropdown being incorrectly set
* Bandaid callword playing every message
* Remove unused or duplicate includes
* More include removals
Removes lobby and courtroom direct includes from the dialog source
* Burn baby, burn!
* Remove reload_theme function
* Remove "Case Alert Supported Message"
All servers I tested on master supported it. The text is redundant in operation.
* Create preliminary lobby design
Attempts to slightly modernize the aging lobby to a scheme more akin to modern server browsers.
* Fix missing header, add necessary search lineedits
* More UI changes
* Start hooking up new UI elements
* Hookup Serverbrowser to new UI frontend
Still need to fix the favorites AND implement the NEW demolist
* Fixup demo ui and make demoserver functional
* More demoserver cleanup
* Remove jarring ao_app pointer shenigans
Still a bit to do before we can safely remove that pointer, but hey, its something.
* *unholy screeches*
Tried to untangle the tange of dependencies that is connection behaviour
* Rip out loading screen
Some servers are not even sending proper values anymore, like vanilla, so why keep it?
* Optimise includes, format header
Lobby should not even have to know what an AOPacket is, smh
* Formatting fixes
and turn settings menu opening into a signal
* Why does netmanager never emit when the server is connected
* Fixup final parts
About as well implemented as I can do rn. Missing the load screen, but that was more flair than anything else
* Correct start page
* demo qol
Co-authored-by: TrickyLeifa <date.epoch@gmail.com>
Co-authored-by: stonedDiscord <Tukz@gmx.de>
Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
Co-authored-by: Crystalwarrior <Varsash@Gmail.com>
* Delete rebase artifact
* only set setting codec on qt5
* fix old regex
* qlocale include was missing
* Add default soundfont value + cleaup stream checks
* Remove Case Announcement
* Add add_server dialog and move logic to options.h
* Add Direction Connection Widget and function
* Visual Fluff, don't show direct connection on demo screen
* Implement ui-file reload and RCC mounting.
* Add edit menu to favorites
* Add Server remains active when no server is selected
* Hack together window title for courtroom
I hate this.
* Fix incorrect subtheme location code
* Cleanup
* Make all charicons appear on first join
This entire system needs a rework, but this will do for now.
Also slightly improves performance by not making it load the character list 4 times, only 2 now :^)
closes #854
* Fix evidence hover selector under Qt5
#closes #890
* Remove options calling itself trough pointer
* Fix Android CI (#891)
* pro gamer move
* remove pregenerated android files
* version
* install old ass android platform
* Revert "remove pregenerated android files"
This reverts commit c81a94c6fd337e187af61e9dd706fac5cd51bcc0.
* switch to 24
* CharButton - Fix enterEvent override in Qt5
Also mark them as override. Also make the preprocessor if a bit less copypastey.
* version bump
* Update embeeded lobby ui color sheme
Shoutout to Dumb Fuck (That is their real discord name).
Co-Authored-By: Crystalwarrior <3470436+Crystalwarrior@users.noreply.github.com>
* Add changelog.md loading logic from main mount path
* Expand tabbar of optional Tabbar widget
* Fix order column being incorrectly sized
* missed a space
* remove fonts
* change margins
* fix minimum sizes
* Allow theme overwrite of settings menu
* Cleanup iterator for subthemes
* Allow reload of settings menu
Might aswell do them all :shrug:
* AO base path (#893)
* make get_base_path global
and move parts that use base to use it
* options uses base
* sal moved a bunch of code
* fix creating case folder
---------
Co-authored-by: stonedDiscord <10584181+stonedDiscord@users.noreply.github.com>
* Android 2 10 1 (#894)
* ask for file permissions before trying to load a file
* create armv7 gitignore
* extract all the abis
* don't fail if the dir exists
* Clear options map before reloading the UI
* Fix runtime warning for theme/subtheme combobox
Shouldn't do the job of something that the template can do for me.
Also fix formatting cause it was busted.
Also made the subtheme/theme load code not give me cancer.
* Sort dropdown numerically to match explorer preview
closes #793
* fuck bass
* copy mingw
* copy other dll
* wrong folder
* Account for server subtheme
* Replace incorrect subtheme check
* Settings, not server
* Remove debug
* Add compatibility code, suppress compiler warning (#896)
lobby.cpp:
* Added compatibility code so 2.10.1 can run on Qt versions older than 5.14, such as the version that ships with Ubuntu 20.04
courtroom.cpp:
* Used a Q_UNUSED macro on an unused variable to suppress a compiler warning
* Resolve Qt6(.5.0) compiler errors
* Undo incompetence.
* Force theme reload on theme change
If a user saves a new theme and does not reload the UI it will cause misplacement of widgets inside of courtroom.
This is mitigated by forcing a reload.
* make speedlines stretch by default (in *actually* non-stupid way this time) (#901)
* Rework default volume settings (#903)
* rework volume default settings
* remove default volume settings in options dialog
* make client remember last volume settings instead
* fix options starting tab
* Reworked direct connect (#906)
Resolve issue #905
Works as advertised.
* Set join text when double-click on connected server
Good enough. I would handle this a bit smarter and lock based on the connection state of NetworkManager, but NetworkManager sucks and I refuse to fix it this close before 2.10.1 is done.
* remove unused m_looping
* remove useless underflow check
* do not fall from server to favorites
* Ci android fix (#899)
* pro gamer move
* remove pregenerated android files
* version
* install old ass android platform
* Revert "remove pregenerated android files"
This reverts commit c81a94c6fd337e187af61e9dd706fac5cd51bcc0.
* switch to 24
* use android\src\android\templates instead
* deprecate "chat" deskmod (#910)
* ignore deskmod when zoom speaking
* clean up deskmod a bit
* adds an enum for deskmods
* deprecates the "chat" deskmood
* modifies set_scene since it never rly used the deskmod argument
meaningfully
* actually use the enums i made lol
* fix typo
* Add credits for lamdacalculus
---------
Co-authored-by: TrickyLeifa <date.epoch@gmail.com>
Co-authored-by: stonedDiscord <Tukz@gmx.de>
Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
Co-authored-by: Crystalwarrior <Varsash@Gmail.com>
Co-authored-by: Crystalwarrior <3470436+Crystalwarrior@users.noreply.github.com>
Co-authored-by: stonedDiscord <10584181+stonedDiscord@users.noreply.github.com>
Co-authored-by: segfault <128277930+memsecviolator@users.noreply.github.com>
Co-authored-by: lambdcalculus <64238778+lambdcalculus@users.noreply.github.com>
Co-authored-by: Leifa♥ <26681464+TrickyLeifa@users.noreply.github.com>
Diffstat (limited to 'src/text_file_functions.cpp')
| -rw-r--r-- | src/text_file_functions.cpp | 514 |
1 files changed, 35 insertions, 479 deletions
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index f3dc0cb9..8aba93fd 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -1,147 +1,6 @@ #include "text_file_functions.h" #include "aoutils.h" - -QString AOApplication::read_theme() -{ - QString result = configini->value("theme", "default").value<QString>(); - return result; -} - -int AOApplication::read_blip_rate() -{ - int result = configini->value("blip_rate", 2).toInt(); - - if (result < 0) - return 0; - - return result; -} - -QString AOApplication::get_ooc_name() -{ - QString result = configini->value("ooc_name").value<QString>(); - return result; -} - -int AOApplication::get_default_music() -{ - int result = configini->value("default_music", 50).toInt(); - return result; -} - -int AOApplication::get_default_sfx() -{ - int result = configini->value("default_sfx", 50).toInt(); - return result; -} - -int AOApplication::get_default_blip() -{ - int result = configini->value("default_blip", 50).toInt(); - return result; -} - -int AOApplication::get_default_suppress_audio() -{ - int result = configini->value("suppress_audio", 50).toInt(); - return result; -} - -int AOApplication::get_max_log_size() -{ - int result = configini->value("log_maximum", 1000).toInt(); - return result; -} - -int AOApplication::stay_time() -{ - int result = configini->value("stay_time", 200).toInt(); - return result; -} - -int AOApplication::get_text_crawl() -{ - int result = configini->value("text_crawl", 40).toInt(); - return result; -} - -int AOApplication::get_chat_ratelimit() -{ - int result = configini->value("chat_ratelimit", 300).toInt(); - return result; -} - -bool AOApplication::get_log_goes_downwards() -{ - QString result = - configini->value("log_goes_downwards", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_log_newline() -{ - QString result = configini->value("log_newline", "false").value<QString>(); - return result.startsWith("true"); -} - -int AOApplication::get_log_margin() -{ - int result = configini->value("log_margin", 0).toInt(); - return result; -} - -bool AOApplication::get_log_timestamp() -{ - QString result = configini->value("log_timestamp", "false").value<QString>(); - return result.startsWith("true"); -} - -QString AOApplication::get_log_timestamp_format() -{ - QString result = configini->value("log_timestamp_format", "h:mm:ss AP").value<QString>(); - return result; -} - -bool AOApplication::get_log_ic_actions() -{ - QString result = - configini->value("log_ic_actions", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_showname_enabled_by_default() -{ - QString result = - configini->value("show_custom_shownames", "true").value<QString>(); - return result.startsWith("true"); -} - -QString AOApplication::get_default_username() -{ - QString result = configini->value("default_username", "").value<QString>(); - if (result.isEmpty()) - return get_ooc_name(); - else - return result; -} - -QString AOApplication::get_default_showname() -{ - QString result = configini->value("default_showname", "").value<QString>(); - return result; -} - -QString AOApplication::get_audio_output_device() -{ - QString result = - configini->value("default_audio_device", "default").value<QString>(); - return result; -} - -QStringList AOApplication::get_call_words() -{ - return get_list_file(get_base_path() + "callwords.ini"); -} +#include "options.h" QStringList AOApplication::get_list_file(VPath path) { @@ -202,6 +61,7 @@ bool AOApplication::write_to_file(QString p_text, QString p_file, bool make_dir) if (f_log.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { QTextStream out(&f_log); + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) out.setCodec("UTF-8"); #endif @@ -233,6 +93,7 @@ bool AOApplication::append_to_file(QString p_text, QString p_file, QFile f_log(p_file); if (f_log.open(QIODevice::WriteOnly | QIODevice::Append)) { QTextStream out(&f_log); + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) out.setCodec("UTF-8"); #endif @@ -245,101 +106,23 @@ bool AOApplication::append_to_file(QString p_text, QString p_file, return false; } -QVector<server_type> AOApplication::read_favorite_servers() +QMultiMap<QString, QString> AOApplication::load_demo_logs_list() const { - QVector<server_type> serverlist; - - // demo server is always at the top - server_type demo_server; - demo_server.ip = "127.0.0.1"; - demo_server.port = 99999; - demo_server.name = tr("Demo playback"); - demo_server.desc = tr("Play back demos you have previously recorded"); - serverlist.append(demo_server); - - QString fav_servers_ini_path(get_base_path() + "favorite_servers.ini"); - if (!QFile::exists(fav_servers_ini_path)) { - qWarning() << "failed to locate favorite_servers.ini, falling back to legacy serverlist.txt"; - serverlist += read_legacy_favorite_servers(); - } - else { - QSettings fav_servers_ini(fav_servers_ini_path, QSettings::IniFormat); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - fav_servers_ini.setIniCodec("UTF-8"); -#endif + QString l_log_path = applicationDirPath() + "/logs/"; + QDir l_log_folder(l_log_path); + l_log_folder.setFilter(QDir::NoDotAndDotDot | QDir::Dirs); - auto grouplist = fav_servers_ini.childGroups(); - { // remove all negative and non-numbers - auto filtered_grouplist = grouplist; - for (const QString &group : qAsConst(grouplist)) { - bool ok = false; - const int l_num = group.toInt(&ok); - if (ok && l_num >= 0) { - continue; - } - filtered_grouplist.append(group); - } - std::sort(filtered_grouplist.begin(), filtered_grouplist.end(), [](const auto &a, const auto &b) -> bool { - return a.toInt() < b.toInt(); - }); - grouplist = std::move(filtered_grouplist); - } + QMultiMap<QString,QString> l_demo_logs; + for (const QString &l_demo_folder_name : l_log_folder.entryList()) { + QDir l_demo_folder(l_log_path + l_demo_folder_name); + l_demo_folder.setFilter(QDir::Files); + l_demo_folder.setNameFilters(QStringList() << "*.demo"); - for(const QString &group: qAsConst(grouplist)) { - server_type f_server; - fav_servers_ini.beginGroup(group); - f_server.ip = fav_servers_ini.value("address", "127.0.0.1").toString(); - f_server.port = fav_servers_ini.value("port", 27016).toInt(); - f_server.name = fav_servers_ini.value("name", "Missing Name").toString(); - f_server.desc = fav_servers_ini.value("desc", "No description").toString(); - f_server.socket_type = to_connection_type.value(fav_servers_ini.value("protocol", "tcp").toString()); - serverlist.append(std::move(f_server)); - fav_servers_ini.endGroup(); - } - } - - return serverlist; -} - -QVector<server_type> AOApplication::read_legacy_favorite_servers() -{ - QVector<server_type> serverlist; - - QFile serverlist_txt(get_base_path() + "serverlist.txt"); - if (!serverlist_txt.exists()) { - qWarning() << "serverlist.txt does not exist"; - } else if (!serverlist_txt.open(QIODevice::ReadOnly)) { - qWarning() << "failed to open serverlist.txt"; - } else { - QTextStream stream(&serverlist_txt); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - stream.setCodec("UTF-8"); -#endif - - while (!stream.atEnd()) - { - QStringList contents = stream.readLine().split(":"); - - int item_count = contents.size(); - if (item_count < 3 || item_count > 4) { - continue; - } - - server_type server; - server.ip = contents.at(0); - server.port = contents.at(1).toInt(); - server.name = contents.at(2); - if (item_count == 4) { - server.socket_type = connection_type(contents.at(3).toInt()); - } else { - server.socket_type = TCP; - } - serverlist.append(std::move(server)); + for (QString l_demo_name : l_demo_folder.entryList()) { + l_demo_logs.insert(l_demo_folder_name, l_demo_name); + } } - serverlist_txt.close(); - } - - return serverlist; + return l_demo_logs; } QString AOApplication::read_design_ini(QString p_identifier, @@ -368,7 +151,7 @@ QString AOApplication::read_design_ini(QString p_identifier, Qt::TransformationMode AOApplication::get_scaling(QString p_scaling) { if (p_scaling.isEmpty()) - p_scaling = get_default_scaling(); + p_scaling = Options::getInstance().defaultScalingMode(); if (p_scaling == "smooth") return Qt::SmoothTransformation; @@ -377,7 +160,7 @@ Qt::TransformationMode AOApplication::get_scaling(QString p_scaling) QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file) { - QString value = get_config_value(p_identifier, p_file, current_theme, get_subtheme(), default_theme); + QString value = get_config_value(p_identifier, p_file, Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme); QPoint return_value; return_value.setX(0); @@ -423,7 +206,7 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString AOApplication::get_design_element(QString p_identifier, QString p_file, QString p_misc) { - QString value = get_config_value(p_identifier, p_file, current_theme, get_subtheme(), default_theme, p_misc); + QString value = get_config_value(p_identifier, p_file, Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme, p_misc); if (!value.isEmpty()) return value; return ""; @@ -432,7 +215,7 @@ QString AOApplication::get_design_element(QString p_identifier, QString p_file, // tfw this function is only used for lobby and nowhere else int AOApplication::get_font_size(QString p_identifier, QString p_file) { - QString value = get_config_value(p_identifier, p_file, current_theme, get_subtheme(), default_theme); + QString value = get_config_value(p_identifier, p_file, Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme); if (!value.isEmpty()) return value.toInt(); return 10; @@ -440,7 +223,7 @@ int AOApplication::get_font_size(QString p_identifier, QString p_file) QColor AOApplication::get_color(QString p_identifier, QString p_file) { - QString value = get_config_value(p_identifier, p_file, current_theme, get_subtheme(), default_theme); + QString value = get_config_value(p_identifier, p_file, Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme); QColor return_color(0, 0, 0); if (value.isEmpty()) @@ -460,7 +243,7 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file) QString AOApplication::get_stylesheet(QString p_file) { - QString path = get_asset(p_file, current_theme, get_subtheme(), default_theme); + QString path = get_asset(p_file, Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme); QFile design_ini; design_ini.setFileName(path); if (!design_ini.open(QIODevice::ReadOnly)) @@ -480,7 +263,7 @@ QString AOApplication::get_stylesheet(QString p_file) QString AOApplication::get_tagged_stylesheet(QString target_tag, QString p_file) { - QString path = get_asset(p_file, current_theme, get_subtheme(), default_theme); + QString path = get_asset(p_file, Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme); QFile design_ini; design_ini.setFileName(path); if (!design_ini.open(QIODevice::ReadOnly)) @@ -514,7 +297,7 @@ QString AOApplication::get_tagged_stylesheet(QString target_tag, QString p_file) QString AOApplication::get_chat_markup(QString p_identifier, QString p_chat) { // New Chadly method - QString value = get_config_value(p_identifier, "chat_config.ini", current_theme, get_subtheme(), default_theme, p_chat); + QString value = get_config_value(p_identifier, "chat_config.ini", Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme, p_chat); if (!value.isEmpty()) return value.toUtf8(); @@ -557,14 +340,14 @@ QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) QString AOApplication::get_penalty_value(QString p_identifier) { - return get_config_value(p_identifier, "penalty/penalty.ini", current_theme, - get_subtheme(), default_theme, ""); + return get_config_value(p_identifier, "penalty/penalty.ini", Options::getInstance().theme(), + Options::getInstance().subTheme(), default_theme, ""); } QString AOApplication::get_court_sfx(QString p_identifier, QString p_misc) { - QString value = get_config_value(p_identifier, "courtroom_sounds.ini", current_theme, get_subtheme(), default_theme, p_misc); + QString value = get_config_value(p_identifier, "courtroom_sounds.ini", Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme, p_misc); if (!value.isEmpty()) return value.toUtf8(); return ""; @@ -615,10 +398,10 @@ QString AOApplication::read_char_ini(QString p_char, QString p_search_line, { QSettings settings(get_real_path(get_character_path(p_char, "char.ini")), QSettings::IniFormat); - settings.beginGroup(target_tag); #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) settings.setIniCodec("UTF-8"); #endif + settings.beginGroup(target_tag); QString value = settings.value(p_search_line).value<QString>(); settings.endGroup(); return value; @@ -629,6 +412,7 @@ void AOApplication::set_char_ini(QString p_char, QString value, { QSettings settings(get_real_path(get_character_path(p_char, "char.ini")), QSettings::IniFormat); + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) settings.setIniCodec("UTF-8"); #endif @@ -927,8 +711,8 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote) QStringList AOApplication::get_effects(QString p_char) { const QStringList l_filepath_list{ - get_asset("effects/effects.ini", current_theme, get_subtheme(), default_theme, ""), - get_asset("effects.ini", current_theme, get_subtheme(), default_theme, read_char_ini(p_char, "effects", "Options")), + get_asset("effects/effects.ini", Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme, ""), + get_asset("effects.ini", Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme, read_char_ini(p_char, "effects", "Options")), }; QStringList l_effect_name_list; @@ -943,7 +727,6 @@ QStringList AOApplication::get_effects(QString p_char) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) l_effects_ini.setIniCodec("UTF-8"); #endif - // port legacy effects if (!l_effects_ini.contains("version/major") || l_effects_ini.value("version/major").toInt() < 2) { @@ -998,8 +781,8 @@ QString AOApplication::get_effect(QString effect, QString p_char, p_folder = read_char_ini(p_char, "effects", "Options"); QStringList paths { - get_image("effects/" + effect, current_theme, get_subtheme(), default_theme, ""), - get_image(effect, current_theme, get_subtheme(), default_theme, p_folder) + get_image("effects/" + effect, Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme, ""), + get_image(effect, Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme, p_folder) }; for (const auto &p : paths) @@ -1014,8 +797,8 @@ QString AOApplication::get_effect_property(QString fx_name, QString p_char, if (p_folder == "") p_folder = read_char_ini(p_char, "effects", "Options"); - const auto paths = get_asset_paths("effects/effects.ini", current_theme, get_subtheme(), default_theme, ""); - const auto misc_paths = get_asset_paths("effects.ini", current_theme, get_subtheme(), default_theme, p_folder); + const auto paths = get_asset_paths("effects/effects.ini", Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme, ""); + const auto misc_paths = get_asset_paths("effects.ini", Options::getInstance().theme(), Options::getInstance().subTheme(), default_theme, p_folder); QString path; QString f_result; for (const VPath &p : paths + misc_paths) { @@ -1060,230 +843,3 @@ bool AOApplication::get_pos_is_judge(const QString &p_pos) } return positions.contains(p_pos.trimmed()); } - -bool AOApplication::get_blank_blip() -{ - QString result = configini->value("blank_blip", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_looping_sfx() -{ - QString result = configini->value("looping_sfx", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::objection_stop_music() -{ - QString result = - configini->value("objection_stop_music", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_streaming_disabled() -{ - return configini->value("streaming_disabled", false).toBool(); -} - -bool AOApplication::is_instant_objection_enabled() -{ - QString result = configini->value("instant_objection", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_desyncrhonized_logs_enabled() -{ - QString result = configini->value("desync_logs", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_discord_enabled() -{ - QString result = configini->value("discord", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_shake_enabled() -{ - QString result = configini->value("shake", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_effects_enabled() -{ - QString result = configini->value("effects", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_frame_network_enabled() -{ - QString result = configini->value("framenetwork", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_colorlog_enabled() -{ - QString result = configini->value("colorlog", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_stickysounds_enabled() -{ - QString result = configini->value("stickysounds", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_stickyeffects_enabled() -{ - QString result = configini->value("stickyeffects", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_stickypres_enabled() -{ - QString result = configini->value("stickypres", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_customchat_enabled() -{ - QString result = configini->value("customchat", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_sticker_enabled() -{ - QString result = configini->value("sticker", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_continuous_enabled() -{ - QString result = configini->value("continuous_playback", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::is_category_stop_enabled() -{ - QString result = configini->value("category_stop", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_enabled() -{ - QString result = configini->value("casing_enabled", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_defence_enabled() -{ - QString result = - configini->value("casing_defence_enabled", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_prosecution_enabled() -{ - QString result = - configini->value("casing_prosecution_enabled", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_judge_enabled() -{ - QString result = - configini->value("casing_judge_enabled", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_juror_enabled() -{ - QString result = - configini->value("casing_juror_enabled", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_steno_enabled() -{ - QString result = - configini->value("casing_steno_enabled", "false").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_cm_enabled() -{ - QString result = - configini->value("casing_cm_enabled", "false").value<QString>(); - return result.startsWith("true"); -} - -QString AOApplication::get_casing_can_host_cases() -{ - QString result = - configini->value("casing_can_host_cases", "Turnabout Check Your Settings") - .value<QString>(); - return result; -} - -bool AOApplication::get_text_logging_enabled() -{ - QString result = - configini->value("automatic_logging_enabled", "true").value<QString>(); - return result.startsWith("true"); -} - -bool AOApplication::get_demo_logging_enabled() -{ - QString result = - configini->value("demo_logging_enabled", "true").value<QString>(); - return result.startsWith("true"); -} - -QString AOApplication::get_subtheme() -{ - QString result = - configini->value("subtheme", "server").value<QString>(); - // Server means we want the server to decide for us - if (result == "server") - // 'subtheme' variable is affected by the server - result = subtheme; - // Default means we don't want any subthemes - else if (result == "default") - result = ""; - return result; -} - -bool AOApplication::get_animated_theme() -{ - QString result = - configini->value("animated_theme", "false").value<QString>(); - return result.startsWith("true"); -} - -QString AOApplication::get_default_scaling() -{ - return configini->value("default_scaling", "fast").value<QString>(); -} - -QStringList AOApplication::get_mount_paths() -{ - return configini->value("mount_paths").value<QStringList>(); -} - -bool AOApplication::get_player_count_optout() -{ - return configini->value("player_count_optout", "false").value<QString>() - .startsWith("true"); -} - -bool AOApplication::get_sfx_on_idle() -{ - return configini->value("sfx_on_idle", "true").value<QString>() - .startsWith("true"); -} - -bool AOApplication::get_evidence_double_click() -{ - return configini->value("evidence_double_click", "false").value<QString>() - .startsWith("true"); -} |
