diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2020-04-17 21:48:34 -0500 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2020-04-17 21:48:34 -0500 |
| commit | faac191f0b9e99b82614ed3959ec5c67f56a1fc3 (patch) | |
| tree | 11c8996e51bbab2dd1e776677df698a9891ffdb2 /src/text_file_functions.cpp | |
| parent | 5901733650715858e14b9c70237f0b22c02a8f61 (diff) | |
Mega-merge of CR fork
CR likely stands for "CentsRaidensnake." Like the Case Cafe mega-merge
before it, this was not a clean merge, and it had to be split up into
two parts: the actual changes, and the attempt it made to reformat the
entire code via clang-format.
This branch had a complicated set of changes that would be difficult to
describe in this commit message. It would be better described in a
proper changelog.
Diffstat (limited to 'src/text_file_functions.cpp')
| -rw-r--r-- | src/text_file_functions.cpp | 95 |
1 files changed, 87 insertions, 8 deletions
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 1e1c4744..1fbb0b53 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -46,6 +46,15 @@ int AOApplication::get_max_log_size() return result; } +int AOApplication::get_pundelay()
+{
+ int result = configini->value("punctuation_delay", 2).toInt();
+ if (result < 1 || result > 3) {
+ result = 2;
+ }
+ return result;
+}
+
bool AOApplication::get_log_goes_downwards() { QString result = configini->value("log_goes_downwards", "false").value<QString>(); @@ -154,6 +163,26 @@ QString AOApplication::read_design_ini(QString p_identifier, QString p_design_pa { QSettings settings(p_design_path, QSettings::IniFormat); QVariant value = settings.value(p_identifier); + if (value.isNull()) // Since the value wasn't found, maybe it uses the proper
+ // config system
+ {
+ int last_underscore_index = p_identifier.lastIndexOf(
+ '_'); // we will use this in order to check wether it is just showname
+ // or showname_something
+ if (last_underscore_index != -1) {
+ p_identifier.replace(
+ last_underscore_index, 1,
+ '/'); // we replace the last dash in order to access the category, e.g
+ // from showname_font -> showname/font
+ value = settings.value(p_identifier);
+ }
+ else if (!settings.value(p_identifier + "/size")
+ .isNull()) // This is to check whether showname/size exists,
+ // because size is defined as widgetname = x
+ {
+ value = settings.value(p_identifier + "/size");
+ }
+ }
if (value.type() == QVariant::StringList) { return value.toStringList().join(","); } else { @@ -368,8 +397,27 @@ QString AOApplication::get_sfx(QString p_identifier) return return_sfx; } +QString AOApplication::get_music_prefix(QString song_to_check)
+{
+ if (!file_exists(get_music_path(song_to_check))) {
+ QString mp3_check = get_music_path(song_to_check + ".mp3");
+ QString opus_check = get_music_path(song_to_check + ".opus");
+ if (file_exists(opus_check)) {
+ return song_to_check + ".opus";
+ }
+ else if (file_exists(mp3_check)) {
+ return song_to_check + ".mp3";
+ }
+ return song_to_check + ".wav";
+ }
+ else {
+ return song_to_check;
+ }
+}
+
QString AOApplication::get_sfx_suffix(QString sound_to_check) { + if (!file_exists(get_sounds_path(sound_to_check))) {
QString mp3_check = get_sounds_path(sound_to_check + ".mp3"); QString opus_check = get_sounds_path(sound_to_check + ".opus"); if (file_exists(opus_check)) @@ -381,16 +429,21 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check) return sound_to_check + ".mp3"; } return sound_to_check + ".wav"; -} + }
+ else {
+ return sound_to_check;
+ }
+}
QString AOApplication::get_image_suffix(QString path_to_check) { - QString apng_check = path_to_check + ".apng"; - if (file_exists(apng_check)) - { - return apng_check; - } + if (file_exists(path_to_check + ".webp"))
+ return path_to_check + ".webp";
+ if (file_exists(path_to_check + ".apng"))
+ return path_to_check + ".apng";
+ if (file_exists(path_to_check + ".gif"))
return path_to_check + ".gif"; + return path_to_check + ".png";
} @@ -655,9 +708,9 @@ bool AOApplication::is_discord_enabled() return result.startsWith("true"); } -bool AOApplication::is_shakeandflash_enabled() +bool AOApplication::is_keepevi_enabled()
{ - QString result = configini->value("shakeandflash", "true").value<QString>(); + QString result = configini->value("keep_evidence", "false").value<QString>();
return result.startsWith("true"); } @@ -715,3 +768,29 @@ 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_colored_iclog_enabled()
+{
+ QString result =
+ configini->value("color_iclog_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+
+bool AOApplication::get_iclmir_enabled()
+{
+ QString result =
+ configini->value("mirror_iclog_enabled", "false").value<QString>();
+ return result.startsWith("true");
+}
+bool AOApplication::colorlog_restricted_enabled()
+{
+ QString result =
+ configini->value("mirror_iclog_restricted", "false").value<QString>();
+ return result.startsWith("true");
+}
+
+bool AOApplication::is_shakeandflash_enabled()
+{
+ QString result = configini->value("shakeandflash", "true").value<QString>();
+ return result.startsWith("true");
+}
|
