aboutsummaryrefslogtreecommitdiff
path: root/src/text_file_functions.cpp
diff options
context:
space:
mode:
authorCrystalwarrior <varsash@gmail.com>2019-09-17 18:51:40 +0300
committerCrystalwarrior <varsash@gmail.com>2019-09-17 18:51:40 +0300
commit9d20cf03222add2ef04d4d2cc305458bdf00fcad (patch)
treec9d587da32ac0bb5ffe934f27dbe723cab3d48b6 /src/text_file_functions.cpp
parent6747bfdd5edee3693144c088ad1e732b5748fb8b (diff)
Streamlined ini swapping so the user can set up multiple character folders associated with a character.
This will save to the character folder's iniswaps.ini. You can click on the dropdown and edit the text inside to add an iniswap, and press the [X] button that'll appear next to it to remove the ini swap. Recode the enter_courtroom and add a new update_character feature - the two are now separate and responsible for different things. The courtroom will reload the whole theme and widgets while the character is only responsible for all ui elements related to the character. This drastically improves performance when switching characters using /switch or something Add a set_char_ini helper function that allows you to modify the character variables. For now only used to set name= field when iniswapping
Diffstat (limited to 'src/text_file_functions.cpp')
-rw-r--r--src/text_file_functions.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index a70fdc50..f22bc748 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -75,16 +75,21 @@ QString AOApplication::get_audio_output_device()
QStringList AOApplication::get_call_words()
{
+ return get_list_file(get_base_path() + "callwords.ini");
+}
+
+QStringList AOApplication::get_list_file(QString p_file)
+{
QStringList return_value;
- QFile callwords_ini;
+ QFile p_ini;
- callwords_ini.setFileName(get_base_path() + "callwords.ini");
+ p_ini.setFileName(p_file);
- if (!callwords_ini.open(QIODevice::ReadOnly))
+ if (!p_ini.open(QIODevice::ReadOnly))
return return_value;
- QTextStream in(&callwords_ini);
+ QTextStream in(&p_ini);
while (!in.atEnd())
{
@@ -555,6 +560,14 @@ QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QStr
return value;
}
+void AOApplication::set_char_ini(QString p_char, QString value, QString p_search_line, QString target_tag)
+{
+ QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat);
+ settings.beginGroup(target_tag);
+ settings.setValue(p_search_line, value);
+ settings.endGroup();
+}
+
//returns all the values of target_tag
QStringList AOApplication::read_char_ini_tag(QString p_char, QString target_tag)
{