From 1f9a1bdd5d17d56fc3bfd4f5a35e3df476e74477 Mon Sep 17 00:00:00 2001 From: cents02 Date: Fri, 31 May 2019 21:47:47 +0000 Subject: [PATCH 1/5] Fixed issues #47 on both client and server --- src/courtroom.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c313a98..c798885 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2707,6 +2707,7 @@ void Courtroom::on_ooc_return_pressed() } else { + other_charid = -1; append_server_chatmessage("CLIENT", "You are no longer paired with anyone.", "1"); } } @@ -2992,6 +2993,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) QListWidgetItem *f_item = ui_pair_list->item(p_index.row()); QString f_char = f_item->text(); QString real_char; + int f_cid = -1; if (f_char.endsWith(" [x]")) { @@ -2999,17 +3001,19 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_item->setText(real_char); } else - real_char = f_char; - - int f_cid = -1; - - for (int n_char = 0 ; n_char < char_list.size() ; n_char++) { + real_char = f_char; + for (int n_char = 0 ; n_char < char_list.size() ; n_char++) + { if (char_list.at(n_char).name == real_char) f_cid = n_char; + } } - if (f_cid < 0 || f_cid >= char_list.size()) + + + + if (f_cid < -2 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; @@ -3028,8 +3032,10 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) for (int i = 0; i < ui_pair_list->count(); i++) { ui_pair_list->item(i)->setText(sorted_pair_list.at(i)); } - + if(other_charid != -1) + { f_item->setText(real_char + " [x]"); + } } void Courtroom::on_music_list_double_clicked(QModelIndex p_model) From 09d8e9e7a45d8c7d9557253e1fb48f3e9bd9c894 Mon Sep 17 00:00:00 2001 From: cents02 Date: Fri, 31 May 2019 21:52:22 +0000 Subject: [PATCH 2/5] Update courtroom.cpp --- src/courtroom.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c798885..9fd52d8 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3009,10 +3009,6 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_cid = n_char; } } - - - - if (f_cid < -2 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; @@ -3037,7 +3033,6 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_item->setText(real_char + " [x]"); } } - void Courtroom::on_music_list_double_clicked(QModelIndex p_model) { if (is_muted) From ae8552578020dcd515e1fe80f2b95e6be461744c Mon Sep 17 00:00:00 2001 From: cents02 Date: Mon, 3 Jun 2019 09:00:24 +0000 Subject: [PATCH 3/5] Resolved requests/issues. --- src/courtroom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 9fd52d8..020a54c 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3009,7 +3009,7 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) f_cid = n_char; } } - if (f_cid < -2 || f_cid >= char_list.size()) + if (f_cid < -1 || f_cid >= char_list.size()) { qDebug() << "W: " << real_char << " not present in char_list"; return; @@ -3030,7 +3030,7 @@ 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) From f826ba390bcf11427aab5058728ad7dbd3f699a6 Mon Sep 17 00:00:00 2001 From: cents02 Date: Sun, 30 Jun 2019 21:47:48 +0000 Subject: [PATCH 4/5] 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). --- src/courtroom.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 020a54c..581ce5a 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) From 099fea176c018c4aa6b9e7887e4f154866dc2c7d Mon Sep 17 00:00:00 2001 From: cents02 Date: Sun, 30 Jun 2019 22:09:12 +0000 Subject: [PATCH 5/5] Indentation --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 581ce5a..da05fe9 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3086,7 +3086,7 @@ 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]"); } }