aboutsummaryrefslogtreecommitdiff
path: root/src/aoapplication.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2020-04-17 21:57:16 -0500
committeroldmud0 <oldmud0@users.noreply.github.com>2020-04-17 21:57:16 -0500
commit13942345c6a3e7e1625c6c26cc2f2f368a3bff23 (patch)
tree73ce940217b57fd47afb6a95e828e6309ed5e683 /src/aoapplication.cpp
parentfaac191f0b9e99b82614ed3959ec5c67f56a1fc3 (diff)
Run clang-format on entire project
Indentation fixed to 2 spaces per tab. Braces set to Stroustrup style. Lines reflow at 80 characters. One-line method bodies are on the same line as the signature. Space always after `//`. No indentation on preprocessor macros. Includes are sorted lexicographically. If you don't want to see this commit on blames, use the hidden whitespace option on GitHub, or use `-w` in git-blame.
Diffstat (limited to 'src/aoapplication.cpp')
-rw-r--r--src/aoapplication.cpp83
1 files changed, 37 insertions, 46 deletions
diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp
index 85465660..3b5e836d 100644
--- a/src/aoapplication.cpp
+++ b/src/aoapplication.cpp
@@ -1,17 +1,17 @@
#include "aoapplication.h"
-#include "lobby.h"
+#include "aocaseannouncerdialog.h"
+#include "aooptionsdialog.h"
#include "courtroom.h"
-#include "networkmanager.h"
#include "debug_functions.h"
-
-#include "aooptionsdialog.h"
-#include "aocaseannouncerdialog.h"
+#include "lobby.h"
+#include "networkmanager.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 +28,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 +37,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 +49,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 +61,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 +70,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 +89,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 +124,7 @@ void AOApplication::add_favorite_server(int p_server)
void AOApplication::server_disconnected()
{
- if (courtroom_constructed)
- {
+ if (courtroom_constructed) {
beep();
call_notice(tr("Disconnected from server."));
construct_lobby();
@@ -145,43 +135,44 @@ void AOApplication::server_disconnected()
void AOApplication::loading_cancelled()
{
destruct_courtroom();
-
w_lobby->hide_loading_overlay();
}
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(tr("Error connecting to master server. Will try again in %1 seconds.").arg(QString::number(net_manager->ms_reconnect_delay)));
+ 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
- {
+ 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."));
+ "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();
}