aboutsummaryrefslogtreecommitdiff
path: root/aoapplication.h
blob: a63ec41729c7867349302f5643bafa146d535d10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef AOAPPLICATION_H
#define AOAPPLICATION_H

#include "aopacket.h"
#include "datatypes.h"

#include <QApplication>
#include <QVector>
#include <QFile>

class NetworkManager;
class Lobby;
class Courtroom;

class AOApplication : public QApplication
{
  Q_OBJECT

public:
  AOApplication(int &argc, char **argv);
  ~AOApplication();

  NetworkManager *net_manager;
  Lobby *w_lobby;
  Courtroom *w_courtroom;

  bool lobby_constructed = false;
  bool courtroom_constructed = false;

  void construct_lobby();
  void destruct_lobby();

  void construct_courtroom();
  void destruct_courtroom();

  void ms_packet_received(AOPacket *p_packet);
  void server_packet_received(AOPacket *p_packet);

  void send_ms_packet(AOPacket *p_packet);
  void send_server_packet(AOPacket *p_packet);

  /////////////////server metadata//////////////////

  unsigned int s_decryptor = 5;
  bool encryption_needed = true;
  bool ao2_features = false;

  ///////////////loading info///////////////////

  //player number, it's hardly used but might be needed for some old servers
  int s_pv = 0;

  int char_list_size = 0;
  int loaded_chars = 0;
  int evidence_list_size = 0;
  int loaded_evidence = 0;
  int music_list_size = 0;
  int loaded_music = 0;

  //////////////////versioning///////////////

  int get_release() {return RELEASE;}
  int get_major_version() {return MAJOR_VERSION;}
  int get_minor_version() {return MINOR_VERSION;}
  QString get_version_string();

  void set_favorite_list();
  QVector<server_type>& get_favorite_list() {return favorite_list;}
  void add_favorite_server(int p_server);

  void set_server_list();
  QVector<server_type>& get_server_list() {return server_list;}

  void set_user_theme();
  QString get_user_theme() {return user_theme;}

  //implementation in path_functions.cpp
  QString get_base_path();
  QString get_theme_path();
  QString get_default_theme_path();
  QString get_character_path(QString p_character);
  QString get_demothings_path();

  //implementation in text_file_functions.cpp
  QString read_user_theme();
  void write_to_serverlist_txt(QString p_line);
  QVector<server_type> read_serverlist_txt();
  pos_size_type get_pos_and_size(QString p_identifier, QString p_design_path);

private:
  const int RELEASE = 2;
  const int MAJOR_VERSION = 1;
  const int MINOR_VERSION = 0;

  QString user_theme = "default";

  QVector<server_type> server_list;
  QVector<server_type> favorite_list;

public slots:
  void loading_cancelled();
};

#endif // AOAPPLICATION_H