From 4c8bf57268c09c298edc3f3695e4a2ede84643ac Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Mar 2020 18:34:51 +0300 Subject: VERSION 2.8.3 BABYYYYYYYY Add "KFO" to version display in lobby so it's even clearer this is a custom client Add a settings button to the Lobby screen --- src/aoapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/aoapplication.cpp') diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 6213acd..9c3d1cd 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -93,7 +93,7 @@ void AOApplication::destruct_courtroom() QString AOApplication::get_version_string() { - return + return "KFO" + QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." + QString::number(MINOR_VERSION); -- cgit From 71967d44fd4a7d8955524045d174847e985c7a15 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Mar 2020 19:20:26 +0300 Subject: Keep verison string as-is and only update the actual VERSION display as for some weird ass reason doing it this way won't let you join KFO server --- src/aoapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/aoapplication.cpp') diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 9c3d1cd..6213acd 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -93,7 +93,7 @@ void AOApplication::destruct_courtroom() QString AOApplication::get_version_string() { - return "KFO" + + return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." + QString::number(MINOR_VERSION); -- cgit From c8e12558cdd3fd0769b81679ad09edf1f29b780f Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 01:18:24 +0300 Subject: Clang-ify the code with this styling using Visual Studio Code: { BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Stroustrup, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All } (this is the Visual Studio preset with only "BreakBeforeBraces" changed from Allman to Stroustrup) --- src/aoapplication.cpp | 182 ++++++++++++++++++++++++-------------------------- 1 file changed, 86 insertions(+), 96 deletions(-) (limited to 'src/aoapplication.cpp') diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 6213acd..4d2bb31 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -1,176 +1,166 @@ #include "aoapplication.h" -#include "lobby.h" #include "courtroom.h" -#include "networkmanager.h" #include "debug_functions.h" +#include "lobby.h" +#include "networkmanager.h" -#include "aooptionsdialog.h" #include "aocaseannouncerdialog.h" +#include "aooptionsdialog.h" AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv) { - // Create the QSettings class that points to the config.ini. - configini = new QSettings(get_base_path() + "config.ini", QSettings::IniFormat); + // Create the QSettings class that points to the config.ini. + configini = new QSettings(get_base_path() + "config.ini", QSettings::IniFormat); - net_manager = new NetworkManager(this); - discord = new AttorneyOnline::Discord(); - QObject::connect(net_manager, SIGNAL(ms_connect_finished(bool, bool)), - SLOT(ms_connect_finished(bool, bool))); + net_manager = new NetworkManager(this); + discord = new AttorneyOnline::Discord(); + QObject::connect(net_manager, SIGNAL(ms_connect_finished(bool, bool)), + SLOT(ms_connect_finished(bool, bool))); } AOApplication::~AOApplication() { - destruct_lobby(); - destruct_courtroom(); - delete discord; + destruct_lobby(); + destruct_courtroom(); + delete discord; } void AOApplication::construct_lobby() { - if (lobby_constructed) - { - qDebug() << "W: lobby was attempted constructed when it already exists"; - return; - } + if (lobby_constructed) { + qDebug() << "W: lobby was attempted constructed when it already exists"; + return; + } - w_lobby = new Lobby(this); - lobby_constructed = true; + w_lobby = new Lobby(this); + lobby_constructed = true; - QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width()-w_lobby->width()) / 2; - int y = (geometry.height()-w_lobby->height()) / 2; - w_lobby->move(x, y); + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + int x = (geometry.width() - w_lobby->width()) / 2; + int y = (geometry.height() - w_lobby->height()) / 2; + w_lobby->move(x, y); - if (is_discord_enabled()) - discord->state_lobby(); + if (is_discord_enabled()) + discord->state_lobby(); - w_lobby->show(); + w_lobby->show(); } void AOApplication::destruct_lobby() { - if(!lobby_constructed) - { - qDebug() << "W: lobby was attempted destructed when it did not exist"; - return; - } + if (!lobby_constructed) { + qDebug() << "W: lobby was attempted destructed when it did not exist"; + return; + } - delete w_lobby; - w_lobby = nullptr; - lobby_constructed = false; + delete w_lobby; + w_lobby = nullptr; + lobby_constructed = false; } void AOApplication::construct_courtroom() { - if (courtroom_constructed) - { - qDebug() << "W: courtroom was attempted constructed when it already exists"; - return; - } + if (courtroom_constructed) { + qDebug() << "W: courtroom was attempted constructed when it already exists"; + return; + } - w_courtroom = new Courtroom(this); - courtroom_constructed = true; + w_courtroom = new Courtroom(this); + courtroom_constructed = true; - QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width()-w_courtroom->width()) / 2; - int y = (geometry.height()-w_courtroom->height()) / 2; - w_courtroom->move(x, y); + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + int x = (geometry.width() - w_courtroom->width()) / 2; + int y = (geometry.height() - w_courtroom->height()) / 2; + w_courtroom->move(x, y); } void AOApplication::destruct_courtroom() { - if (!courtroom_constructed) - { - qDebug() << "W: courtroom was attempted destructed when it did not exist"; - return; - } + if (!courtroom_constructed) { + qDebug() << "W: courtroom was attempted destructed when it did not exist"; + return; + } - delete w_courtroom; - w_courtroom = nullptr; - courtroom_constructed = false; + delete w_courtroom; + w_courtroom = nullptr; + courtroom_constructed = false; } QString AOApplication::get_version_string() { - return - QString::number(RELEASE) + "." + - QString::number(MAJOR_VERSION) + "." + - QString::number(MINOR_VERSION); + return QString::number(RELEASE) + "." + + QString::number(MAJOR_VERSION) + "." + + QString::number(MINOR_VERSION); } void AOApplication::reload_theme() { - current_theme = read_theme(); + current_theme = read_theme(); } void AOApplication::set_favorite_list() { - favorite_list = read_serverlist_txt(); + favorite_list = read_serverlist_txt(); } QString AOApplication::get_current_char() { - if (courtroom_constructed) - return w_courtroom->get_current_char(); - else - return ""; + if (courtroom_constructed) + return w_courtroom->get_current_char(); + else + return ""; } void AOApplication::add_favorite_server(int p_server) { - if (p_server < 0 || p_server >= server_list.size()) - return; + if (p_server < 0 || p_server >= server_list.size()) + return; - server_type fav_server = server_list.at(p_server); + server_type fav_server = server_list.at(p_server); - QString str_port = QString::number(fav_server.port); + QString str_port = QString::number(fav_server.port); - QString server_line = fav_server.ip + ":" + str_port + ":" + fav_server.name; + QString server_line = fav_server.ip + ":" + str_port + ":" + fav_server.name; - write_to_serverlist_txt(server_line); + write_to_serverlist_txt(server_line); } void AOApplication::server_disconnected() { - if (courtroom_constructed) - { - call_notice(tr("Disconnected from server.")); - construct_lobby(); - destruct_courtroom(); - } + if (courtroom_constructed) { + call_notice(tr("Disconnected from server.")); + construct_lobby(); + destruct_courtroom(); + } } void AOApplication::loading_cancelled() { - destruct_courtroom(); + destruct_courtroom(); - w_lobby->hide_loading_overlay(); + w_lobby->hide_loading_overlay(); } void AOApplication::ms_connect_finished(bool connected, bool will_retry) { - if (connected) - { - AOPacket *f_packet = new AOPacket("ALL#%"); - send_ms_packet(f_packet); - } - else - { - if (will_retry) - { - if (lobby_constructed) - w_lobby->append_error(tr("Error connecting to master server. Will try again in %1 seconds.").arg(QString::number(net_manager->ms_reconnect_delay))); + if (connected) { + AOPacket *f_packet = new AOPacket("ALL#%"); + send_ms_packet(f_packet); } - else - { - call_error(tr("There was an error connecting to the master server.\n" - "We deploy multiple master servers to mitigate any possible downtime, " - "but the client appears to have exhausted all possible methods of finding " - "and connecting to one.\n" - "Please check your Internet connection and firewall, and please try again.")); + else { + if (will_retry) { + if (lobby_constructed) + w_lobby->append_error(tr("Error connecting to master server. Will try again in %1 seconds.").arg(QString::number(net_manager->ms_reconnect_delay))); + } + else { + call_error(tr("There was an error connecting to the master server.\n" + "We deploy multiple master servers to mitigate any possible downtime, " + "but the client appears to have exhausted all possible methods of finding " + "and connecting to one.\n" + "Please check your Internet connection and firewall, and please try again.")); + } } - } } void AOApplication::call_settings_menu() -- cgit From 88de4cde0433ef5e606f38a2f1e6041f0d24a87e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 02:14:54 +0300 Subject: clang 2 electric boogaloo { BasedOnStyle: LLVM, BreakBeforeBraces: Stroustrup} --- src/aoapplication.cpp | 181 +++++++++++++++++++++++++------------------------- 1 file changed, 92 insertions(+), 89 deletions(-) (limited to 'src/aoapplication.cpp') diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 4d2bb31..e1e9e7f 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -10,167 +10,170 @@ AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv) { - // Create the QSettings class that points to the config.ini. - configini = new QSettings(get_base_path() + "config.ini", QSettings::IniFormat); + // Create the QSettings class that points to the config.ini. + configini = + new QSettings(get_base_path() + "config.ini", QSettings::IniFormat); - net_manager = new NetworkManager(this); - discord = new AttorneyOnline::Discord(); - QObject::connect(net_manager, SIGNAL(ms_connect_finished(bool, bool)), - SLOT(ms_connect_finished(bool, bool))); + net_manager = new NetworkManager(this); + discord = new AttorneyOnline::Discord(); + QObject::connect(net_manager, SIGNAL(ms_connect_finished(bool, bool)), + SLOT(ms_connect_finished(bool, bool))); } AOApplication::~AOApplication() { - destruct_lobby(); - destruct_courtroom(); - delete discord; + destruct_lobby(); + destruct_courtroom(); + delete discord; } void AOApplication::construct_lobby() { - if (lobby_constructed) { - qDebug() << "W: lobby was attempted constructed when it already exists"; - return; - } + if (lobby_constructed) { + qDebug() << "W: lobby was attempted constructed when it already exists"; + return; + } - w_lobby = new Lobby(this); - lobby_constructed = true; + w_lobby = new Lobby(this); + lobby_constructed = true; - QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width() - w_lobby->width()) / 2; - int y = (geometry.height() - w_lobby->height()) / 2; - w_lobby->move(x, y); + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + int x = (geometry.width() - w_lobby->width()) / 2; + int y = (geometry.height() - w_lobby->height()) / 2; + w_lobby->move(x, y); - if (is_discord_enabled()) - discord->state_lobby(); + if (is_discord_enabled()) + discord->state_lobby(); - w_lobby->show(); + w_lobby->show(); } void AOApplication::destruct_lobby() { - if (!lobby_constructed) { - qDebug() << "W: lobby was attempted destructed when it did not exist"; - return; - } + if (!lobby_constructed) { + qDebug() << "W: lobby was attempted destructed when it did not exist"; + return; + } - delete w_lobby; - w_lobby = nullptr; - lobby_constructed = false; + delete w_lobby; + w_lobby = nullptr; + lobby_constructed = false; } void AOApplication::construct_courtroom() { - if (courtroom_constructed) { - qDebug() << "W: courtroom was attempted constructed when it already exists"; - return; - } + if (courtroom_constructed) { + qDebug() << "W: courtroom was attempted constructed when it already exists"; + return; + } - w_courtroom = new Courtroom(this); - courtroom_constructed = true; + w_courtroom = new Courtroom(this); + courtroom_constructed = true; - QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width() - w_courtroom->width()) / 2; - int y = (geometry.height() - w_courtroom->height()) / 2; - w_courtroom->move(x, y); + QRect geometry = QGuiApplication::primaryScreen()->geometry(); + int x = (geometry.width() - w_courtroom->width()) / 2; + int y = (geometry.height() - w_courtroom->height()) / 2; + w_courtroom->move(x, y); } void AOApplication::destruct_courtroom() { - if (!courtroom_constructed) { - qDebug() << "W: courtroom was attempted destructed when it did not exist"; - return; - } + if (!courtroom_constructed) { + qDebug() << "W: courtroom was attempted destructed when it did not exist"; + return; + } - delete w_courtroom; - w_courtroom = nullptr; - courtroom_constructed = false; + delete w_courtroom; + w_courtroom = nullptr; + courtroom_constructed = false; } QString AOApplication::get_version_string() { - return QString::number(RELEASE) + "." + - QString::number(MAJOR_VERSION) + "." + - QString::number(MINOR_VERSION); + return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." + + QString::number(MINOR_VERSION); } -void AOApplication::reload_theme() -{ - current_theme = read_theme(); -} +void AOApplication::reload_theme() { current_theme = read_theme(); } void AOApplication::set_favorite_list() { - favorite_list = read_serverlist_txt(); + favorite_list = read_serverlist_txt(); } QString AOApplication::get_current_char() { - if (courtroom_constructed) - return w_courtroom->get_current_char(); - else - return ""; + if (courtroom_constructed) + return w_courtroom->get_current_char(); + else + return ""; } void AOApplication::add_favorite_server(int p_server) { - if (p_server < 0 || p_server >= server_list.size()) - return; + if (p_server < 0 || p_server >= server_list.size()) + return; - server_type fav_server = server_list.at(p_server); + server_type fav_server = server_list.at(p_server); - QString str_port = QString::number(fav_server.port); + QString str_port = QString::number(fav_server.port); - QString server_line = fav_server.ip + ":" + str_port + ":" + fav_server.name; + QString server_line = fav_server.ip + ":" + str_port + ":" + fav_server.name; - write_to_serverlist_txt(server_line); + write_to_serverlist_txt(server_line); } void AOApplication::server_disconnected() { - if (courtroom_constructed) { - call_notice(tr("Disconnected from server.")); - construct_lobby(); - destruct_courtroom(); - } + if (courtroom_constructed) { + call_notice(tr("Disconnected from server.")); + construct_lobby(); + destruct_courtroom(); + } } void AOApplication::loading_cancelled() { - destruct_courtroom(); + destruct_courtroom(); - w_lobby->hide_loading_overlay(); + w_lobby->hide_loading_overlay(); } void AOApplication::ms_connect_finished(bool connected, bool will_retry) { - if (connected) { - AOPacket *f_packet = new AOPacket("ALL#%"); - send_ms_packet(f_packet); + if (connected) { + AOPacket *f_packet = new AOPacket("ALL#%"); + send_ms_packet(f_packet); + } + else { + if (will_retry) { + if (lobby_constructed) + w_lobby->append_error( + tr("Error connecting to master server. Will try again in %1 " + "seconds.") + .arg(QString::number(net_manager->ms_reconnect_delay))); } else { - if (will_retry) { - if (lobby_constructed) - w_lobby->append_error(tr("Error connecting to master server. Will try again in %1 seconds.").arg(QString::number(net_manager->ms_reconnect_delay))); - } - else { - call_error(tr("There was an error connecting to the master server.\n" - "We deploy multiple master servers to mitigate any possible downtime, " - "but the client appears to have exhausted all possible methods of finding " - "and connecting to one.\n" - "Please check your Internet connection and firewall, and please try again.")); - } + call_error(tr("There was an error connecting to the master server.\n" + "We deploy multiple master servers to mitigate any " + "possible downtime, " + "but the client appears to have exhausted all possible " + "methods of finding " + "and connecting to one.\n" + "Please check your Internet connection and firewall, and " + "please try again.")); } + } } void AOApplication::call_settings_menu() { - AOOptionsDialog settings(nullptr, this); - settings.exec(); + AOOptionsDialog settings(nullptr, this); + settings.exec(); } void AOApplication::call_announce_menu(Courtroom *court) { - AOCaseAnnouncerDialog announcer(nullptr, this, court); - announcer.exec(); + AOCaseAnnouncerDialog announcer(nullptr, this, court); + announcer.exec(); } -- cgit