establishing child-parent relation with the ao app
This commit is contained in:
parent
a699b6eb9c
commit
455d6106e3
@ -34,4 +34,5 @@ HEADERS += lobby.h \
|
||||
global_variables.h \
|
||||
debug_functions.h \
|
||||
networkmanager.h \
|
||||
aoapplication.h
|
||||
aoapplication.h \
|
||||
datatypes.h
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
68
datatypes.h
Normal file
68
datatypes.h
Normal file
@ -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
|
18
lobby.cpp
18
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");
|
||||
}
|
||||
|
||||
|
15
lobby.h
15
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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user