aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcents02 <sens03.con@gmail.com>2019-06-30 21:47:48 +0000
committercents02 <sens03.con@gmail.com>2019-06-30 21:47:48 +0000
commitf826ba390bcf11427aab5058728ad7dbd3f699a6 (patch)
tree7bcfc3951d2461dc1b384bc2139d746329f48f09
parentae8552578020dcd515e1fe80f2b95e6be461744c (diff)
New feature! /save_case . Takes two parameters, name and cr status.
E.g: /save_case case1 lfp . It takes court evidence but leaves the doc and cmdoc options blank to be entered manually(if anybody actually puts anything).
-rw-r--r--src/courtroom.cpp61
1 files changed, 59 insertions, 2 deletions
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index 020a54c8..581ce5a4 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -2864,6 +2864,58 @@ void Courtroom::on_ooc_return_pressed()
ui_ooc_chat_message->clear();
return;
}
+ else if(ooc_message.startsWith("/save_case"))
+ {
+ QStringList command = ooc_message.split(" ", QString::SkipEmptyParts);
+
+ QDir casefolder("base/cases");
+ if (!casefolder.exists())
+ {
+ QDir::current().mkdir("base/" + casefolder.dirName());
+ append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it.", "1");
+ ui_ooc_chat_message->clear();
+ return;
+ }
+ QStringList caseslist = casefolder.entryList();
+ caseslist.removeOne(".");
+ caseslist.removeOne("..");
+ caseslist.replaceInStrings(".ini","");
+
+ if (command.size() < 2)
+ {
+ append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!" + caseslist.join(", "), "1");
+ ui_ooc_chat_message->clear();
+ return;
+ }
+
+
+ if (command.size() > 3)
+ {
+ append_server_chatmessage("CLIENT", "Too many arguments to save a case! You only need a filename without extension and the courtroom status!", "1");
+ ui_ooc_chat_message->clear();
+ return;
+ }
+ QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat);
+ casefile.setValue("author",ui_ooc_chat_name->text());
+ casefile.setValue("cmdoc","");
+ casefile.setValue("doc", "");
+ casefile.setValue("status",command[2]);
+ casefile.sync();
+ for(int i = local_evidence_list.size() - 1; i >= 0; i--)
+ {
+ casefile.beginGroup(QString::number(i));
+ casefile.sync();
+ casefile.setValue("name",local_evidence_list[i].name);
+ casefile.setValue("description",local_evidence_list[i].description);
+ casefile.setValue("image",local_evidence_list[i].image);
+ casefile.endGroup();
+ }
+ casefile.sync();
+ append_server_chatmessage("CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!", "1");
+ ui_ooc_chat_message->clear();
+ return;
+
+ }
QStringList packet_contents;
packet_contents.append(ui_ooc_chat_name->text());
@@ -3009,7 +3061,11 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index)
f_cid = n_char;
}
}
- if (f_cid < -1 || f_cid >= char_list.size())
+
+
+
+
+ if (f_cid < -2 || f_cid >= char_list.size())
{
qDebug() << "W: " << real_char << " not present in char_list";
return;
@@ -3030,9 +3086,10 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index)
}
if(other_charid != -1)
{
- f_item->setText(real_char + " [x]");
+ f_item->setText(real_char + " [x]");
}
}
+
void Courtroom::on_music_list_double_clicked(QModelIndex p_model)
{
if (is_muted)