aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-01-03 15:01:54 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-01-03 15:01:54 +0100
commit455d6106e3c923e86b1b75687d1dbd3c52e8a11b (patch)
tree94c20ac6a9160fe769c7e35e14b580e502fff22d
parenta699b6eb9cfb0d6ba98bf94881f85cbf7d6c6ebf (diff)
establishing child-parent relation with the ao app
-rw-r--r--Attorney_Online_remake.pro3
-rw-r--r--aoapplication.cpp7
-rw-r--r--aoapplication.h5
-rw-r--r--datatypes.h68
-rw-r--r--lobby.cpp18
-rw-r--r--lobby.h15
-rw-r--r--networkmanager.cpp10
-rw-r--r--networkmanager.h5
8 files changed, 122 insertions, 9 deletions
diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro
index 38374f2c..ab07286e 100644
--- a/Attorney_Online_remake.pro
+++ b/Attorney_Online_remake.pro
@@ -34,4 +34,5 @@ HEADERS += lobby.h \
global_variables.h \
debug_functions.h \
networkmanager.h \
- aoapplication.h
+ aoapplication.h \
+ datatypes.h
diff --git a/aoapplication.cpp b/aoapplication.cpp
index cb7c44db..8ba9c399 100644
--- a/aoapplication.cpp
+++ b/aoapplication.cpp
@@ -1,5 +1,7 @@
#include <QDebug>
+#include "lobby.h"
+
#include "aoapplication.h"
AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
@@ -20,7 +22,7 @@ void AOApplication::construct_lobby()
return;
}
- w_lobby = new Lobby();
+ w_lobby = new Lobby(this);
lobby_constructed = true;
}
@@ -44,7 +46,8 @@ void AOApplication::construct_courtroom()
return;
}
- w_courtroom = new QMainWindow();
+ //T0D0, make custom Courtroom class and uncomment
+ //w_courtroom = new QMainWindow(this);
courtroom_constructed = true;
}
diff --git a/aoapplication.h b/aoapplication.h
index 95238248..194612c3 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -4,7 +4,8 @@
#include <QApplication>
#include <QMainWindow>
-#include "lobby.h"
+class NetworkManager;
+class Lobby;
class AOApplication : public QApplication
{
@@ -12,7 +13,9 @@ public:
AOApplication(int &argc, char **argv);
~AOApplication();
+ NetworkManager *net_manager;
Lobby *w_lobby;
+ //T0D0: change to custom class "Courtroom"
QMainWindow *w_courtroom;
bool lobby_constructed = false;
diff --git a/datatypes.h b/datatypes.h
new file mode 100644
index 00000000..172c32fa
--- /dev/null
+++ b/datatypes.h
@@ -0,0 +1,68 @@
+#ifndef DATATYPES_H
+#define DATATYPES_H
+
+#include <QString>
+
+struct server_type
+{
+ QString name;
+ QString desc;
+ QString ip;
+ int port;
+};
+
+struct emote_type
+{
+ QString comment;
+ QString preanim;
+ QString anim;
+ int mod;
+ QString sfx_name;
+ int sfx_delay;
+ int sfx_duration;
+};
+
+struct char_type
+{
+ QString name;
+ QString description;
+};
+
+struct evi_type
+{
+ QString name;
+ QString description;
+};
+
+struct chatmessage_type
+{
+ QString message;
+ QString character;
+ QString side;
+ QString sfx_name;
+ QString pre_emote;
+ QString emote;
+ int emote_modifier;
+ int objection_modifier;
+ int realization;
+ int text_color;
+ int evidence;
+ int cid;
+ int sfx_delay;
+ int flip;
+};
+
+struct area_type
+{
+ QString name;
+ QString background;
+ bool passworded;
+};
+
+struct pos_type
+{
+ int x;
+ int y;
+};
+
+#endif // DATATYPES_H
diff --git a/lobby.cpp b/lobby.cpp
index 45aadec6..24e3ae99 100644
--- a/lobby.cpp
+++ b/lobby.cpp
@@ -3,11 +3,14 @@
#include "path_functions.h"
#include "text_file_functions.h"
#include "global_variables.h"
+#include "debug_functions.h"
#include "lobby.h"
-Lobby::Lobby(QWidget *parent) : QMainWindow(parent)
+Lobby::Lobby(AOApplication *parent) : QMainWindow()
{
+ m_parent = parent;
+
this->setWindowTitle("Attorney Online 2");
this->resize(m_lobby_width, m_lobby_height);
@@ -17,6 +20,7 @@ Lobby::Lobby(QWidget *parent) : QMainWindow(parent)
ui_refresh = new AOButton(this);
ui_add_to_fav = new AOButton(this);
ui_connect = new AOButton(this);
+ ui_about = new AOButton(this);
connect(ui_public_servers, SIGNAL(clicked()), this, SLOT(on_public_servers_clicked()));
connect(ui_favorites, SIGNAL(clicked()), this, SLOT(on_favorites_clicked()));
@@ -28,6 +32,8 @@ Lobby::Lobby(QWidget *parent) : QMainWindow(parent)
connect(ui_connect, SIGNAL(pressed()), this, SLOT(on_connect_pressed()));
connect(ui_connect, SIGNAL(released()), this, SLOT(on_connect_released()));
+ connect(ui_about, SIGNAL(clicked()), this, SLOT(on_about_clicked()));
+
set_widgets();
}
@@ -65,6 +71,10 @@ void Lobby::set_widgets()
ui_connect->set_image("connect.png");
ui_connect->move(332, 381);
ui_connect->resize(132, 28);
+
+ ui_about->set_image("about.png");
+ ui_about->move(428, 1);
+ ui_about->resize(88, 21);
}
void Lobby::on_public_servers_clicked()
@@ -119,3 +129,9 @@ void Lobby::on_connect_released()
//T0D0: connect to selected server(show loading overlay?)
}
+void Lobby::on_about_clicked()
+{
+ //T0D0: add something real here
+ call_error("YEBOIIII");
+}
+
diff --git a/lobby.h b/lobby.h
index a8f20e85..d67be82d 100644
--- a/lobby.h
+++ b/lobby.h
@@ -2,15 +2,19 @@
#define LOBBY_H
#include <QMainWindow>
+#include <QListWidget>
+
#include "aoimage.h"
#include "aobutton.h"
+class AOApplication;
+
class Lobby : public QMainWindow
{
Q_OBJECT
public:
- Lobby(QWidget *parent = nullptr);
+ Lobby(AOApplication *parent);
~Lobby();
void set_widgets();
@@ -19,6 +23,8 @@ private:
const int m_lobby_width = 517;
const int m_lobby_height = 666;
+ AOApplication *m_parent;
+
AOImage *ui_background;
AOButton *ui_public_servers;
@@ -28,6 +34,11 @@ private:
AOButton *ui_add_to_fav;
AOButton *ui_connect;
+ AOButton *ui_about;
+
+ QListWidget *ui_server_list;
+// QListWidget
+
public slots:
void on_public_servers_clicked();
void on_favorites_clicked();
@@ -38,6 +49,8 @@ public slots:
void on_add_to_fav_released();
void on_connect_pressed();
void on_connect_released();
+
+ void on_about_clicked();
};
#endif // LOBBY_H
diff --git a/networkmanager.cpp b/networkmanager.cpp
index 89413e4d..d5a2dacb 100644
--- a/networkmanager.cpp
+++ b/networkmanager.cpp
@@ -1,13 +1,19 @@
+#include "aoapplication.h"
+
#include "networkmanager.h"
-NetworkManager::NetworkManager()
+
+NetworkManager::NetworkManager(AOApplication *parent)
{
+ ao_app = parent;
+
ms_socket = new QTcpSocket();
server_socket = new QTcpSocket();
}
NetworkManager::~NetworkManager()
{
-
+ delete ms_socket;
+ delete server_socket;
}
diff --git a/networkmanager.h b/networkmanager.h
index 7aaf0015..ba539dd4 100644
--- a/networkmanager.h
+++ b/networkmanager.h
@@ -3,12 +3,15 @@
#include <QTcpSocket>
+class AOApplication;
+
class NetworkManager
{
public:
- NetworkManager();
+ NetworkManager(AOApplication *parent);
~NetworkManager();
+ AOApplication *ao_app;
QTcpSocket *ms_socket;
QTcpSocket *server_socket;
};