aboutsummaryrefslogtreecommitdiff
path: root/src/aoapplication.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/aoapplication.cpp')
-rw-r--r--src/aoapplication.cpp77
1 files changed, 34 insertions, 43 deletions
diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp
index 4ef1edd3..9bed218d 100644
--- a/src/aoapplication.cpp
+++ b/src/aoapplication.cpp
@@ -1,17 +1,18 @@
#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);
+ configini =
+ new QSettings(get_base_path() + "config.ini", QSettings::IniFormat);
net_manager = new NetworkManager(this);
discord = new AttorneyOnline::Discord();
@@ -28,8 +29,7 @@ AOApplication::~AOApplication()
void AOApplication::construct_lobby()
{
- if (lobby_constructed)
- {
+ if (lobby_constructed) {
qDebug() << "W: lobby was attempted constructed when it already exists";
return;
}
@@ -38,8 +38,8 @@ void AOApplication::construct_lobby()
lobby_constructed = true;
QRect geometry = QGuiApplication::primaryScreen()->geometry();
- int x = (geometry.width()-w_lobby->width()) / 2;
- int y = (geometry.height()-w_lobby->height()) / 2;
+ 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())
@@ -50,8 +50,7 @@ void AOApplication::construct_lobby()
void AOApplication::destruct_lobby()
{
- if(!lobby_constructed)
- {
+ if (!lobby_constructed) {
qDebug() << "W: lobby was attempted destructed when it did not exist";
return;
}
@@ -63,8 +62,7 @@ void AOApplication::destruct_lobby()
void AOApplication::construct_courtroom()
{
- if (courtroom_constructed)
- {
+ if (courtroom_constructed) {
qDebug() << "W: courtroom was attempted constructed when it already exists";
return;
}
@@ -73,15 +71,14 @@ void AOApplication::construct_courtroom()
courtroom_constructed = true;
QRect geometry = QGuiApplication::primaryScreen()->geometry();
- int x = (geometry.width()-w_courtroom->width()) / 2;
- int y = (geometry.height()-w_courtroom->height()) / 2;
+ 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)
- {
+ if (!courtroom_constructed) {
qDebug() << "W: courtroom was attempted destructed when it did not exist";
return;
}
@@ -93,16 +90,11 @@ void AOApplication::destruct_courtroom()
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()
{
@@ -133,8 +125,7 @@ void AOApplication::add_favorite_server(int p_server)
void AOApplication::server_disconnected()
{
- if (courtroom_constructed)
- {
+ if (courtroom_constructed) {
call_notice("Disconnected from server.");
construct_lobby();
destruct_courtroom();
@@ -150,38 +141,38 @@ void AOApplication::loading_cancelled()
void AOApplication::ms_connect_finished(bool connected, bool will_retry)
{
- if (connected)
- {
+ if (connected) {
AOPacket *f_packet = new AOPacket("ALL#%");
send_ms_packet(f_packet);
}
- else
- {
- if (will_retry)
- {
+ else {
+ if (will_retry) {
if (lobby_constructed)
- w_lobby->append_error("Error connecting to master server. Will try again in "
- + QString::number(net_manager->ms_reconnect_delay) + " seconds.");
+ w_lobby->append_error(
+ "Error connecting to master server. Will try again in " +
+ QString::number(net_manager->ms_reconnect_delay) + " seconds.");
}
- else
- {
+ else {
call_error("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 "
+ "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.");
+ "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();
}