Skip to content

Commit

Permalink
Merge pull request #1 from argoneuscze/modcall_reason
Browse files Browse the repository at this point in the history
Added support for modcall reasons
  • Loading branch information
wewlad1 authored Aug 5, 2018
2 parents 68a3f35 + 806a022 commit a8344ce
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 4 deletions.
5 changes: 3 additions & 2 deletions aoapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class AOApplication : public QApplication
bool improved_loading_enabled = false;
bool desk_mod_enabled = false;
bool evidence_enabled = false;
bool modcall_reason_enabled = false;

///////////////loading info///////////////////

Expand Down Expand Up @@ -224,8 +225,8 @@ class AOApplication : public QApplication

private:
const int RELEASE = 2;
const int MAJOR_VERSION = 4;
const int MINOR_VERSION = 10;
const int MAJOR_VERSION = 5;
const int MINOR_VERSION = 0;

QString current_theme = "default";

Expand Down
24 changes: 23 additions & 1 deletion courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,29 @@ void Courtroom::on_spectator_clicked()

void Courtroom::on_call_mod_clicked()
{
ao_app->send_server_packet(new AOPacket("ZZ#%"));
if (ao_app->modcall_reason_enabled) {
auto box = new QInputDialog();
box->setLabelText("Enter a reason:");
auto code = box->exec();

if (code != QDialog::Accepted) {
delete box;
return;
}

auto text = box->textValue();
if (text.isEmpty())
text = "N/A";

delete box;

QStringList mod_reason;
mod_reason.append(text);

ao_app->send_server_packet(new AOPacket("ZZ", mod_reason));
} else {
ao_app->send_server_packet(new AOPacket("ZZ#%"));
}

ui_ic_chat_message->setFocus();
}
Expand Down
1 change: 1 addition & 0 deletions courtroom.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#include <QSignalMapper>
#include <QMap>
#include <QTextBrowser>
#include <QInputDialog>

class AOApplication;

Expand Down
2 changes: 1 addition & 1 deletion lobby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
{
ao_app = p_ao_app;

this->setWindowTitle("Attorney Online 2");
this->setWindowTitle("Attorney Online Vidya (AO2)");

ui_background = new AOImage(this, ao_app);
ui_public_servers = new AOButton(this, ao_app);
Expand Down
2 changes: 2 additions & 0 deletions packet_distribution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
desk_mod_enabled = true;
if (f_packet.contains("evidence",Qt::CaseInsensitive))
evidence_enabled = true;
if (f_packet.contains("modcall_reason",Qt::CaseInsensitive))
modcall_reason_enabled = true;
}
else if (header == "PN")
{
Expand Down

0 comments on commit a8344ce

Please sign in to comment.