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.
This commit is contained in:
		
							parent
							
								
									faac191f0b
								
							
						
					
					
						commit
						13942345c6
					
				@ -16,6 +16,7 @@ HEADERS += $$files($$PWD/include/*.h)
 | 
			
		||||
 | 
			
		||||
LIBS += -L$$PWD/lib
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#DEFINES += DISCORD
 | 
			
		||||
 | 
			
		||||
contains(DEFINES, DISCORD) {
 | 
			
		||||
 | 
			
		||||
@ -1,381 +1,381 @@
 | 
			
		||||
#ifndef AOAPPLICATION_H
 | 
			
		||||
#define AOAPPLICATION_H
 | 
			
		||||
 | 
			
		||||
#include "aopacket.h"
 | 
			
		||||
#include "datatypes.h"
 | 
			
		||||
#include "discord_rich_presence.h"
 | 
			
		||||
 | 
			
		||||
#include <QApplication>
 | 
			
		||||
#include <QVector>
 | 
			
		||||
#include <QFile>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QRect>
 | 
			
		||||
#include <QDesktopWidget>
 | 
			
		||||
 | 
			
		||||
#include <QCryptographicHash>
 | 
			
		||||
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
#include <QColor>
 | 
			
		||||
#include <QScreen>
 | 
			
		||||
#ifdef QTAUDIO
 | 
			
		||||
#include <QAudioDeviceInfo>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <QtConcurrent/QtConcurrent>
 | 
			
		||||
#include <QThread>
 | 
			
		||||
#include <QThreadPool>
 | 
			
		||||
#include <QFuture>
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
  AttorneyOnline::Discord *discord;
 | 
			
		||||
 | 
			
		||||
  bool lobby_constructed = false;
 | 
			
		||||
  bool courtroom_constructed = false;
 | 
			
		||||
 | 
			
		||||
  void construct_lobby();
 | 
			
		||||
  void destruct_lobby();
 | 
			
		||||
 | 
			
		||||
  void construct_courtroom();
 | 
			
		||||
  void destruct_courtroom();
 | 
			
		||||
 | 
			
		||||
  bool is_music_track(QString trackname);
 | 
			
		||||
 | 
			
		||||
  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, bool encoded = true);
 | 
			
		||||
 | 
			
		||||
  void call_settings_menu();
 | 
			
		||||
  void call_announce_menu(Courtroom *court);
 | 
			
		||||
 | 
			
		||||
  /////////////////server metadata//////////////////
 | 
			
		||||
 | 
			
		||||
  unsigned int s_decryptor = 5;
 | 
			
		||||
  bool encryption_needed = true;
 | 
			
		||||
 | 
			
		||||
  bool yellow_text_enabled = false;
 | 
			
		||||
  bool prezoom_enabled = false;
 | 
			
		||||
  bool flipping_enabled = false;
 | 
			
		||||
  bool custom_objection_enabled = false;
 | 
			
		||||
  bool improved_loading_enabled = false;
 | 
			
		||||
  bool desk_mod_enabled = false;
 | 
			
		||||
  bool evidence_enabled = false;
 | 
			
		||||
  bool cccc_ic_support_enabled = false;
 | 
			
		||||
  bool arup_enabled = false;
 | 
			
		||||
  bool casing_alerts_enabled = false;
 | 
			
		||||
  bool modcall_reason_enabled = false;
 | 
			
		||||
  bool looping_sfx_support_enabled = false;
 | 
			
		||||
 | 
			
		||||
  ///////////////loading info///////////////////
 | 
			
		||||
 | 
			
		||||
  //player number, it's hardly used but might be needed for some old servers
 | 
			
		||||
  int s_pv = 0;
 | 
			
		||||
 | 
			
		||||
  QString server_software = "";
 | 
			
		||||
 | 
			
		||||
  int char_list_size = 0;
 | 
			
		||||
  int loaded_chars = 0;
 | 
			
		||||
  int generated_chars = 0;
 | 
			
		||||
  int evidence_list_size = 0;
 | 
			
		||||
  int loaded_evidence = 0;
 | 
			
		||||
  int music_list_size = 0;
 | 
			
		||||
  int loaded_music = 0;
 | 
			
		||||
  int area_count = 0;
 | 
			
		||||
 | 
			
		||||
  bool courtroom_loaded = false;
 | 
			
		||||
 | 
			
		||||
  //////////////////versioning///////////////
 | 
			
		||||
 | 
			
		||||
  int get_release() const { return RELEASE; }
 | 
			
		||||
  int get_major_version() const { return MAJOR_VERSION; }
 | 
			
		||||
  int get_minor_version() const { 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;}
 | 
			
		||||
 | 
			
		||||
  //reads the theme from config.ini and sets it accordingly
 | 
			
		||||
  void reload_theme();
 | 
			
		||||
 | 
			
		||||
  //Returns the character the player has currently selected
 | 
			
		||||
  QString get_current_char();
 | 
			
		||||
 | 
			
		||||
  //implementation in path_functions.cpp
 | 
			
		||||
  QString get_base_path();
 | 
			
		||||
  QString get_data_path();
 | 
			
		||||
  QString get_theme_path(QString p_file);
 | 
			
		||||
  QString get_default_theme_path(QString p_file);
 | 
			
		||||
  QString get_custom_theme_path(QString p_theme, QString p_file);
 | 
			
		||||
  QString get_character_path(QString p_char, QString p_file);
 | 
			
		||||
  QString get_sounds_path(QString p_file);
 | 
			
		||||
  QString get_music_path(QString p_song);
 | 
			
		||||
  QString get_background_path(QString p_file);
 | 
			
		||||
  QString get_default_background_path(QString p_file);
 | 
			
		||||
  QString get_evidence_path(QString p_file);
 | 
			
		||||
  QString get_case_sensitive_path(QString p_file);
 | 
			
		||||
 | 
			
		||||
  ////// Functions for reading and writing files //////
 | 
			
		||||
  // Implementations file_functions.cpp
 | 
			
		||||
 | 
			
		||||
  // Instead of reinventing the wheel, we'll use a QSettings class.
 | 
			
		||||
  QSettings *configini;
 | 
			
		||||
 | 
			
		||||
  //Reads the theme from config.ini and loads it into the current_theme variable
 | 
			
		||||
  QString read_theme();
 | 
			
		||||
 | 
			
		||||
  //Returns the value of ooc_name in config.ini
 | 
			
		||||
  QString get_ooc_name();
 | 
			
		||||
 | 
			
		||||
  //Returns the blip rate from config.ini
 | 
			
		||||
  int read_blip_rate();
 | 
			
		||||
 | 
			
		||||
  //Returns true if blank blips is enabled in config.ini and false otherwise
 | 
			
		||||
  bool get_blank_blip();
 | 
			
		||||
 | 
			
		||||
  //Returns true if looping sound effects are enabled in the config.ini
 | 
			
		||||
  bool get_looping_sfx();
 | 
			
		||||
 | 
			
		||||
  //Returns true if kill music on object is enabled in the config.ini
 | 
			
		||||
  bool get_objectmusic();
 | 
			
		||||
 | 
			
		||||
  //Returns the value of default_music in config.ini
 | 
			
		||||
  int get_default_music();
 | 
			
		||||
 | 
			
		||||
  //Returns the value of default_sfx in config.ini
 | 
			
		||||
  int get_default_sfx();
 | 
			
		||||
 | 
			
		||||
  //Returns the value of default_blip in config.ini
 | 
			
		||||
  int get_default_blip();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of whether Discord should be enabled on startup
 | 
			
		||||
  // from the config.ini.
 | 
			
		||||
  bool is_discord_enabled();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of whether shaking and flashing should be enabled.
 | 
			
		||||
  // from the config.ini.
 | 
			
		||||
  bool is_shakeandflash_enabled();
 | 
			
		||||
 | 
			
		||||
  // Returns whether evidence should be maintained ic
 | 
			
		||||
  bool is_keepevi_enabled();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of the maximum amount of lines the IC chatlog
 | 
			
		||||
  // may contain, from config.ini.
 | 
			
		||||
  int get_max_log_size();
 | 
			
		||||
 | 
			
		||||
  // Gets the punctuation delay modifier
 | 
			
		||||
  int get_pundelay();
 | 
			
		||||
 | 
			
		||||
  // Returns whether the log should go upwards (new behaviour)
 | 
			
		||||
  // or downwards (vanilla behaviour).
 | 
			
		||||
  bool get_log_goes_downwards();
 | 
			
		||||
 | 
			
		||||
  // Returns the username the user may have set in config.ini.
 | 
			
		||||
  QString get_default_username();
 | 
			
		||||
 | 
			
		||||
  // Returns the audio device used for the client.
 | 
			
		||||
  QString get_audio_output_device();
 | 
			
		||||
  #ifdef QTAUDIO
 | 
			
		||||
  QAudioDeviceInfo QtAudioDevice;
 | 
			
		||||
  #endif
 | 
			
		||||
 | 
			
		||||
  // Returns whether the user would like to have custom shownames on by default.
 | 
			
		||||
  bool get_showname_enabled_by_default();
 | 
			
		||||
 | 
			
		||||
  //Returns the list of words in callwords.ini
 | 
			
		||||
  QStringList get_call_words();
 | 
			
		||||
 | 
			
		||||
  //Appends the argument string to serverlist.txt
 | 
			
		||||
  void write_to_serverlist_txt(QString p_line);
 | 
			
		||||
 | 
			
		||||
  //Returns the contents of serverlist.txt
 | 
			
		||||
  QVector<server_type> read_serverlist_txt();
 | 
			
		||||
 | 
			
		||||
  //Returns the value of p_identifier in the design.ini file in p_design_path
 | 
			
		||||
  QString read_design_ini(QString p_identifier, QString p_design_path);
 | 
			
		||||
 | 
			
		||||
  //Returns the coordinates of widget with p_identifier from p_file
 | 
			
		||||
  QPoint get_button_spacing(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  //Returns the dimensions of widget with specified identifier from p_file
 | 
			
		||||
  pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  //Returns the name of the font with p_identifier from p_file
 | 
			
		||||
  QString get_font_name(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  //Returns the value of font_size with p_identifier from p_file
 | 
			
		||||
  int get_font_size(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  //Returns the color with p_identifier from p_file
 | 
			
		||||
  QColor get_color(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  // Returns the colour from the misc folder.
 | 
			
		||||
  QColor get_chat_color(QString p_identifier, QString p_chat);
 | 
			
		||||
 | 
			
		||||
  //Returns the sfx with p_identifier from sounds.ini in the current theme path
 | 
			
		||||
  QString get_sfx(QString p_identifier);
 | 
			
		||||
 | 
			
		||||
  //Figure out if we can opus this or if we should fall back to wav
 | 
			
		||||
  QString get_sfx_suffix(QString sound_to_check);
 | 
			
		||||
 | 
			
		||||
  // figure out if we can find what prefix this song uses
 | 
			
		||||
  QString get_music_prefix(QString song_to_check);
 | 
			
		||||
 | 
			
		||||
#ifndef AOAPPLICATION_H
 | 
			
		||||
#define AOAPPLICATION_H
 | 
			
		||||
 | 
			
		||||
#include "aopacket.h"
 | 
			
		||||
#include "datatypes.h"
 | 
			
		||||
#include "discord_rich_presence.h"
 | 
			
		||||
 | 
			
		||||
#include <QApplication>
 | 
			
		||||
#include <QFile>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QVector>
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QDesktopWidget>
 | 
			
		||||
#include <QRect>
 | 
			
		||||
 | 
			
		||||
#include <QCryptographicHash>
 | 
			
		||||
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
 | 
			
		||||
#include <QColor>
 | 
			
		||||
#include <QScreen>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
#ifdef QTAUDIO
 | 
			
		||||
#include <QAudioDeviceInfo>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <QFuture>
 | 
			
		||||
#include <QThread>
 | 
			
		||||
#include <QThreadPool>
 | 
			
		||||
#include <QtConcurrent/QtConcurrent>
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
  AttorneyOnline::Discord *discord;
 | 
			
		||||
 | 
			
		||||
  bool lobby_constructed = false;
 | 
			
		||||
  bool courtroom_constructed = false;
 | 
			
		||||
 | 
			
		||||
  void construct_lobby();
 | 
			
		||||
  void destruct_lobby();
 | 
			
		||||
 | 
			
		||||
  void construct_courtroom();
 | 
			
		||||
  void destruct_courtroom();
 | 
			
		||||
 | 
			
		||||
  bool is_music_track(QString trackname);
 | 
			
		||||
 | 
			
		||||
  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, bool encoded = true);
 | 
			
		||||
 | 
			
		||||
  void call_settings_menu();
 | 
			
		||||
  void call_announce_menu(Courtroom *court);
 | 
			
		||||
 | 
			
		||||
  /////////////////server metadata//////////////////
 | 
			
		||||
 | 
			
		||||
  unsigned int s_decryptor = 5;
 | 
			
		||||
  bool encryption_needed = true;
 | 
			
		||||
 | 
			
		||||
  bool yellow_text_enabled = false;
 | 
			
		||||
  bool prezoom_enabled = false;
 | 
			
		||||
  bool flipping_enabled = false;
 | 
			
		||||
  bool custom_objection_enabled = false;
 | 
			
		||||
  bool improved_loading_enabled = false;
 | 
			
		||||
  bool desk_mod_enabled = false;
 | 
			
		||||
  bool evidence_enabled = false;
 | 
			
		||||
  bool cccc_ic_support_enabled = false;
 | 
			
		||||
  bool arup_enabled = false;
 | 
			
		||||
  bool casing_alerts_enabled = false;
 | 
			
		||||
  bool modcall_reason_enabled = false;
 | 
			
		||||
  bool looping_sfx_support_enabled = false;
 | 
			
		||||
 | 
			
		||||
  ///////////////loading info///////////////////
 | 
			
		||||
 | 
			
		||||
  // player number, it's hardly used but might be needed for some old servers
 | 
			
		||||
  int s_pv = 0;
 | 
			
		||||
 | 
			
		||||
  QString server_software = "";
 | 
			
		||||
 | 
			
		||||
  int char_list_size = 0;
 | 
			
		||||
  int loaded_chars = 0;
 | 
			
		||||
  int generated_chars = 0;
 | 
			
		||||
  int evidence_list_size = 0;
 | 
			
		||||
  int loaded_evidence = 0;
 | 
			
		||||
  int music_list_size = 0;
 | 
			
		||||
  int loaded_music = 0;
 | 
			
		||||
  int area_count = 0;
 | 
			
		||||
  bool courtroom_loaded = false;
 | 
			
		||||
 | 
			
		||||
  //////////////////versioning///////////////
 | 
			
		||||
 | 
			
		||||
  int get_release() const { return RELEASE; }
 | 
			
		||||
  int get_major_version() const { return MAJOR_VERSION; }
 | 
			
		||||
  int get_minor_version() const { 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; }
 | 
			
		||||
 | 
			
		||||
  // reads the theme from config.ini and sets it accordingly
 | 
			
		||||
  void reload_theme();
 | 
			
		||||
 | 
			
		||||
  // Returns the character the player has currently selected
 | 
			
		||||
  QString get_current_char();
 | 
			
		||||
 | 
			
		||||
  // implementation in path_functions.cpp
 | 
			
		||||
  QString get_base_path();
 | 
			
		||||
  QString get_data_path();
 | 
			
		||||
  QString get_theme_path(QString p_file);
 | 
			
		||||
  QString get_default_theme_path(QString p_file);
 | 
			
		||||
  QString get_custom_theme_path(QString p_theme, QString p_file);
 | 
			
		||||
  QString get_character_path(QString p_char, QString p_file);
 | 
			
		||||
  QString get_sounds_path(QString p_file);
 | 
			
		||||
  QString get_music_path(QString p_song);
 | 
			
		||||
  QString get_background_path(QString p_file);
 | 
			
		||||
  QString get_default_background_path(QString p_file);
 | 
			
		||||
  QString get_evidence_path(QString p_file);
 | 
			
		||||
  QString get_case_sensitive_path(QString p_file);
 | 
			
		||||
 | 
			
		||||
  ////// Functions for reading and writing files //////
 | 
			
		||||
  // Implementations file_functions.cpp
 | 
			
		||||
 | 
			
		||||
  // Instead of reinventing the wheel, we'll use a QSettings class.
 | 
			
		||||
  QSettings *configini;
 | 
			
		||||
 | 
			
		||||
  // Reads the theme from config.ini and loads it into the current_theme
 | 
			
		||||
  // variable
 | 
			
		||||
  QString read_theme();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of ooc_name in config.ini
 | 
			
		||||
  QString get_ooc_name();
 | 
			
		||||
 | 
			
		||||
  // Returns the blip rate from config.ini
 | 
			
		||||
  int read_blip_rate();
 | 
			
		||||
 | 
			
		||||
  // Returns true if blank blips is enabled in config.ini and false otherwise
 | 
			
		||||
  bool get_blank_blip();
 | 
			
		||||
 | 
			
		||||
  // Returns true if looping sound effects are enabled in the config.ini
 | 
			
		||||
  bool get_looping_sfx();
 | 
			
		||||
 | 
			
		||||
  // Returns true if kill music on object is enabled in the config.ini
 | 
			
		||||
  bool get_objectmusic();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of default_music in config.ini
 | 
			
		||||
  int get_default_music();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of default_sfx in config.ini
 | 
			
		||||
  int get_default_sfx();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of default_blip in config.ini
 | 
			
		||||
  int get_default_blip();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of whether Discord should be enabled on startup
 | 
			
		||||
  // from the config.ini.
 | 
			
		||||
  bool is_discord_enabled();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of whether shaking and flashing should be enabled.
 | 
			
		||||
  // from the config.ini.
 | 
			
		||||
  bool is_shakeandflash_enabled();
 | 
			
		||||
 | 
			
		||||
  // Returns whether evidence should be maintained ic
 | 
			
		||||
  bool is_keepevi_enabled();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of the maximum amount of lines the IC chatlog
 | 
			
		||||
  // may contain, from config.ini.
 | 
			
		||||
  int get_max_log_size();
 | 
			
		||||
 | 
			
		||||
  // Gets the punctuation delay modifier
 | 
			
		||||
  int get_pundelay();
 | 
			
		||||
 | 
			
		||||
  // Returns whether the log should go upwards (new behaviour)
 | 
			
		||||
  // or downwards (vanilla behaviour).
 | 
			
		||||
  bool get_log_goes_downwards();
 | 
			
		||||
 | 
			
		||||
  // Returns the username the user may have set in config.ini.
 | 
			
		||||
  QString get_default_username();
 | 
			
		||||
 | 
			
		||||
  // Returns the audio device used for the client.
 | 
			
		||||
  QString get_audio_output_device();
 | 
			
		||||
#ifdef QTAUDIO
 | 
			
		||||
  QAudioDeviceInfo QtAudioDevice;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  // Returns whether the user would like to have custom shownames on by default.
 | 
			
		||||
  bool get_showname_enabled_by_default();
 | 
			
		||||
 | 
			
		||||
  // Returns the list of words in callwords.ini
 | 
			
		||||
  QStringList get_call_words();
 | 
			
		||||
 | 
			
		||||
  // Appends the argument string to serverlist.txt
 | 
			
		||||
  void write_to_serverlist_txt(QString p_line);
 | 
			
		||||
 | 
			
		||||
  // Returns the contents of serverlist.txt
 | 
			
		||||
  QVector<server_type> read_serverlist_txt();
 | 
			
		||||
 | 
			
		||||
  // Returns the value of p_identifier in the design.ini file in p_design_path
 | 
			
		||||
  QString read_design_ini(QString p_identifier, QString p_design_path);
 | 
			
		||||
 | 
			
		||||
  // Returns the coordinates of widget with p_identifier from p_file
 | 
			
		||||
  QPoint get_button_spacing(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  // Returns the dimensions of widget with specified identifier from p_file
 | 
			
		||||
  pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  // Returns the name of the font with p_identifier from p_file
 | 
			
		||||
  QString get_font_name(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  // Returns the value of font_size with p_identifier from p_file
 | 
			
		||||
  int get_font_size(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  // Returns the color with p_identifier from p_file
 | 
			
		||||
  QColor get_color(QString p_identifier, QString p_file);
 | 
			
		||||
 | 
			
		||||
  // Returns the colour from the misc folder.
 | 
			
		||||
  QColor get_chat_color(QString p_identifier, QString p_chat);
 | 
			
		||||
 | 
			
		||||
  // Returns the sfx with p_identifier from sounds.ini in the current theme path
 | 
			
		||||
  QString get_sfx(QString p_identifier);
 | 
			
		||||
 | 
			
		||||
  // Figure out if we can opus this or if we should fall back to wav
 | 
			
		||||
  QString get_sfx_suffix(QString sound_to_check);
 | 
			
		||||
 | 
			
		||||
  // figure out if we can find what prefix this song uses
 | 
			
		||||
  QString get_music_prefix(QString song_to_check);
 | 
			
		||||
 | 
			
		||||
  // Can we use APNG for this? If not, WEBP? if not, GIF? If not, fall back to a
 | 
			
		||||
  // gif.
 | 
			
		||||
  QString get_image_suffix(QString path_to_check);
 | 
			
		||||
 | 
			
		||||
  //Returns the value of p_search_line within target_tag and terminator_tag
 | 
			
		||||
  QString read_char_ini(QString p_char, QString p_search_line, QString target_tag);
 | 
			
		||||
 | 
			
		||||
  //Returns the side of the p_char character from that characters ini file
 | 
			
		||||
  QString get_char_side(QString p_char);
 | 
			
		||||
 | 
			
		||||
  //Returns the showname from the ini of p_char
 | 
			
		||||
  QString get_showname(QString p_char);
 | 
			
		||||
 | 
			
		||||
  //Returns the value of chat from the specific p_char's ini file
 | 
			
		||||
  QString get_chat(QString p_char);
 | 
			
		||||
 | 
			
		||||
  //Returns the value of shouts from the specified p_char's ini file
 | 
			
		||||
  QString get_char_shouts(QString p_char);
 | 
			
		||||
 | 
			
		||||
  //Returns the preanim duration of p_char's p_emote
 | 
			
		||||
  int get_preanim_duration(QString p_char, QString p_emote);
 | 
			
		||||
 | 
			
		||||
  //Same as above, but only returns if it has a % in front(refer to Preanims section in the manual)
 | 
			
		||||
  int get_ao2_preanim_duration(QString p_char, QString p_emote);
 | 
			
		||||
 | 
			
		||||
  //Not in use
 | 
			
		||||
  int get_text_delay(QString p_char, QString p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns the custom realisation used by the character.
 | 
			
		||||
  QString get_custom_realization(QString p_char);
 | 
			
		||||
 | 
			
		||||
  //Returns the name of p_char
 | 
			
		||||
  QString get_char_name(QString p_char);
 | 
			
		||||
 | 
			
		||||
  //Returns the total amount of emotes of p_char
 | 
			
		||||
  int get_emote_number(QString p_char);
 | 
			
		||||
 | 
			
		||||
  //Returns the emote comment of p_char's p_emote
 | 
			
		||||
  QString get_emote_comment(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  //Returns the base name of p_char's p_emote
 | 
			
		||||
  QString get_emote(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  //Returns the preanimation name of p_char's p_emote
 | 
			
		||||
  QString get_pre_emote(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  //Returns the sfx of p_char's p_emote
 | 
			
		||||
  QString get_sfx_name(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  //Returns if an emote loops it's SFX
 | 
			
		||||
  QString get_sfx_looping(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  //Returns if an emote has a frame specific SFX for it
 | 
			
		||||
  QString get_frame_sfx_name(QString p_char, QString p_emote, int n_frame);
 | 
			
		||||
 | 
			
		||||
  //Returns if an emote has a frame specific SFX for it
 | 
			
		||||
  QString get_realization_frame(QString p_char, QString p_emote, int n_frame);
 | 
			
		||||
 | 
			
		||||
  //Returns if an emote has a frame specific SFX for it
 | 
			
		||||
  QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame);
 | 
			
		||||
 | 
			
		||||
  //Not in use
 | 
			
		||||
  int get_sfx_delay(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  //Returns the modifier for p_char's p_emote
 | 
			
		||||
  int get_emote_mod(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  //Returns the desk modifier for p_char's p_emote
 | 
			
		||||
  int get_desk_mod(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  //Returns p_char's gender
 | 
			
		||||
  QString get_gender(QString p_char);
 | 
			
		||||
 | 
			
		||||
  // ======
 | 
			
		||||
  // These are all casing-related settings.
 | 
			
		||||
  // ======
 | 
			
		||||
 | 
			
		||||
  // Returns if the user has casing alerts enabled.
 | 
			
		||||
  bool get_casing_enabled();
 | 
			
		||||
 | 
			
		||||
  // Returns if the user wants to get alerts for the defence role.
 | 
			
		||||
  bool get_casing_defence_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for prosecution.
 | 
			
		||||
  bool get_casing_prosecution_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for judge.
 | 
			
		||||
  bool get_casing_judge_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for juror.
 | 
			
		||||
  bool get_casing_juror_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for steno.
 | 
			
		||||
  bool get_casing_steno_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for CM.
 | 
			
		||||
  bool get_casing_cm_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for witnesses.
 | 
			
		||||
  bool get_casing_wit_enabled();
 | 
			
		||||
 | 
			
		||||
  // Get the message for the CM for casing alerts.
 | 
			
		||||
  QString get_casing_can_host_cases();
 | 
			
		||||
 | 
			
		||||
  // Get if html for ic log is enabled
 | 
			
		||||
  bool get_colored_iclog_enabled();
 | 
			
		||||
 | 
			
		||||
  // Get if ic log mirror is enabled
 | 
			
		||||
  bool get_iclmir_enabled();
 | 
			
		||||
 | 
			
		||||
  // Get if only inline coloring should be shown in log
 | 
			
		||||
  bool colorlog_restricted_enabled();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  const int RELEASE = 2;
 | 
			
		||||
  const int MAJOR_VERSION = 7;
 | 
			
		||||
  const int MINOR_VERSION = 0;
 | 
			
		||||
 | 
			
		||||
  QString current_theme = "default";
 | 
			
		||||
 | 
			
		||||
  QVector<server_type> server_list;
 | 
			
		||||
  QVector<server_type> favorite_list;
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
  void ms_connect_finished(bool connected, bool will_retry);
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
  void server_disconnected();
 | 
			
		||||
  void loading_cancelled();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOAPPLICATION_H
 | 
			
		||||
  QString get_image_suffix(QString path_to_check);
 | 
			
		||||
 | 
			
		||||
  // Returns the value of p_search_line within target_tag and terminator_tag
 | 
			
		||||
  QString read_char_ini(QString p_char, QString p_search_line,
 | 
			
		||||
                        QString target_tag);
 | 
			
		||||
 | 
			
		||||
  // Returns the side of the p_char character from that characters ini file
 | 
			
		||||
  QString get_char_side(QString p_char);
 | 
			
		||||
 | 
			
		||||
  // Returns the showname from the ini of p_char
 | 
			
		||||
  QString get_showname(QString p_char);
 | 
			
		||||
 | 
			
		||||
  // Returns the value of chat from the specific p_char's ini file
 | 
			
		||||
  QString get_chat(QString p_char);
 | 
			
		||||
 | 
			
		||||
  // Returns the value of shouts from the specified p_char's ini file
 | 
			
		||||
  QString get_char_shouts(QString p_char);
 | 
			
		||||
 | 
			
		||||
  // Returns the preanim duration of p_char's p_emote
 | 
			
		||||
  int get_preanim_duration(QString p_char, QString p_emote);
 | 
			
		||||
 | 
			
		||||
  // Same as above, but only returns if it has a % in front(refer to Preanims
 | 
			
		||||
  // section in the manual)
 | 
			
		||||
  int get_ao2_preanim_duration(QString p_char, QString p_emote);
 | 
			
		||||
 | 
			
		||||
  // Not in use
 | 
			
		||||
  int get_text_delay(QString p_char, QString p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns the custom realisation used by the character.
 | 
			
		||||
  QString get_custom_realization(QString p_char);
 | 
			
		||||
 | 
			
		||||
  // Returns the name of p_char
 | 
			
		||||
  QString get_char_name(QString p_char);
 | 
			
		||||
 | 
			
		||||
  // Returns the total amount of emotes of p_char
 | 
			
		||||
  int get_emote_number(QString p_char);
 | 
			
		||||
 | 
			
		||||
  // Returns the emote comment of p_char's p_emote
 | 
			
		||||
  QString get_emote_comment(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns if an emote loops it's SFX
 | 
			
		||||
  QString get_sfx_looping(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns if an emote has a frame specific SFX for it
 | 
			
		||||
  QString get_frame_sfx_name(QString p_char, QString p_emote, int n_frame);
 | 
			
		||||
 | 
			
		||||
  // Returns if an emote has a frame specific SFX for it
 | 
			
		||||
  QString get_realization_frame(QString p_char, QString p_emote, int n_frame);
 | 
			
		||||
 | 
			
		||||
  // Returns if an emote has a frame specific SFX for it
 | 
			
		||||
  QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame);
 | 
			
		||||
 | 
			
		||||
  // Returns the base name of p_char's p_emote
 | 
			
		||||
  QString get_emote(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns the preanimation name of p_char's p_emote
 | 
			
		||||
  QString get_pre_emote(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns the sfx of p_char's p_emote
 | 
			
		||||
  QString get_sfx_name(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Not in use
 | 
			
		||||
  int get_sfx_delay(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns the modifier for p_char's p_emote
 | 
			
		||||
  int get_emote_mod(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns the desk modifier for p_char's p_emote
 | 
			
		||||
  int get_desk_mod(QString p_char, int p_emote);
 | 
			
		||||
 | 
			
		||||
  // Returns p_char's gender
 | 
			
		||||
  QString get_gender(QString p_char);
 | 
			
		||||
 | 
			
		||||
  // ======
 | 
			
		||||
  // These are all casing-related settings.
 | 
			
		||||
  // ======
 | 
			
		||||
 | 
			
		||||
  // Returns if the user has casing alerts enabled.
 | 
			
		||||
  bool get_casing_enabled();
 | 
			
		||||
 | 
			
		||||
  // Returns if the user wants to get alerts for the defence role.
 | 
			
		||||
  bool get_casing_defence_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for prosecution.
 | 
			
		||||
  bool get_casing_prosecution_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for judge.
 | 
			
		||||
  bool get_casing_judge_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for witnesses.
 | 
			
		||||
  bool get_casing_wit_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for juror.
 | 
			
		||||
  bool get_casing_juror_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for steno.
 | 
			
		||||
  bool get_casing_steno_enabled();
 | 
			
		||||
 | 
			
		||||
  // Same for CM.
 | 
			
		||||
  bool get_casing_cm_enabled();
 | 
			
		||||
 | 
			
		||||
  // Get the message for the CM for casing alerts.
 | 
			
		||||
  QString get_casing_can_host_cases();
 | 
			
		||||
 | 
			
		||||
  // Get if html for ic log is enabled
 | 
			
		||||
  bool get_colored_iclog_enabled();
 | 
			
		||||
 | 
			
		||||
  // Get if ic log mirror is enabled
 | 
			
		||||
  bool get_iclmir_enabled();
 | 
			
		||||
 | 
			
		||||
  // Get if only inline coloring should be shown in log
 | 
			
		||||
  bool colorlog_restricted_enabled();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  const int RELEASE = 2;
 | 
			
		||||
  const int MAJOR_VERSION = 7;
 | 
			
		||||
  const int MINOR_VERSION = 0;
 | 
			
		||||
 | 
			
		||||
  QString current_theme = "default";
 | 
			
		||||
 | 
			
		||||
  QVector<server_type> server_list;
 | 
			
		||||
  QVector<server_type> favorite_list;
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
  void ms_connect_finished(bool connected, bool will_retry);
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
  void server_disconnected();
 | 
			
		||||
  void loading_cancelled();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOAPPLICATION_H
 | 
			
		||||
 | 
			
		||||
@ -9,13 +9,11 @@
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class AOBlipPlayer
 | 
			
		||||
{
 | 
			
		||||
class AOBlipPlayer {
 | 
			
		||||
public:
 | 
			
		||||
  AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
 | 
			
		||||
@ -32,11 +30,11 @@ private:
 | 
			
		||||
 | 
			
		||||
  void set_volume_internal(qreal p_volume);
 | 
			
		||||
 | 
			
		||||
  #if defined(BASSAUDIO)
 | 
			
		||||
#if defined(BASSAUDIO)
 | 
			
		||||
  HSTREAM m_stream_list[5];
 | 
			
		||||
  #elif defined(QTAUDIO)
 | 
			
		||||
#elif defined(QTAUDIO)
 | 
			
		||||
  QSoundEffect m_blips;
 | 
			
		||||
  #endif
 | 
			
		||||
#endif
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOBLIPPLAYER_H
 | 
			
		||||
 | 
			
		||||
@ -3,11 +3,10 @@
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
 | 
			
		||||
class AOButton : public QPushButton
 | 
			
		||||
{
 | 
			
		||||
class AOButton : public QPushButton {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
@ -4,20 +4,21 @@
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
 | 
			
		||||
#include <QtWidgets/QDialog>
 | 
			
		||||
#include <QDialogButtonBox>
 | 
			
		||||
#include <QtWidgets/QVBoxLayout>
 | 
			
		||||
#include <QtWidgets/QFormLayout>
 | 
			
		||||
#include <QtWidgets/QCheckBox>
 | 
			
		||||
#include <QtWidgets/QDialog>
 | 
			
		||||
#include <QtWidgets/QFormLayout>
 | 
			
		||||
#include <QtWidgets/QLabel>
 | 
			
		||||
#include <QtWidgets/QLineEdit>
 | 
			
		||||
#include <QtWidgets/QVBoxLayout>
 | 
			
		||||
 | 
			
		||||
class AOCaseAnnouncerDialog : public QDialog
 | 
			
		||||
{
 | 
			
		||||
class AOCaseAnnouncerDialog : public QDialog {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  explicit AOCaseAnnouncerDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr, Courtroom *p_court = nullptr);
 | 
			
		||||
  explicit AOCaseAnnouncerDialog(QWidget *parent = nullptr,
 | 
			
		||||
                                 AOApplication *p_ao_app = nullptr,
 | 
			
		||||
                                 Courtroom *p_court = nullptr);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
@ -4,17 +4,17 @@
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aoimage.h"
 | 
			
		||||
 | 
			
		||||
#include <QFile>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <QFile>
 | 
			
		||||
 | 
			
		||||
class AOCharButton : public QPushButton
 | 
			
		||||
{
 | 
			
		||||
class AOCharButton : public QPushButton {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken);
 | 
			
		||||
  AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos,
 | 
			
		||||
               bool is_taken);
 | 
			
		||||
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,19 +1,17 @@
 | 
			
		||||
#ifndef AOCHARMOVIE_H
 | 
			
		||||
#define AOCHARMOVIE_H
 | 
			
		||||
 | 
			
		||||
#include <QMovie>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QImageReader>
 | 
			
		||||
#include <QPainter>
 | 
			
		||||
#include "include/aosfxplayer.h"
 | 
			
		||||
#include "include/courtroom.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QImageReader>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QMovie>
 | 
			
		||||
#include <QPainter>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
 | 
			
		||||
class AOApplication;
 | 
			
		||||
class AOCharMovie : public QLabel
 | 
			
		||||
{
 | 
			
		||||
class AOCharMovie : public QLabel {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
@ -24,12 +22,10 @@ public:
 | 
			
		||||
  void play_talking(QString p_char, QString p_emote);
 | 
			
		||||
  void play_idle(QString p_char, QString p_emote);
 | 
			
		||||
 | 
			
		||||
  void set_flipped(bool p_flipped) {m_flipped = p_flipped;}
 | 
			
		||||
  void set_flipped(bool p_flipped) { m_flipped = p_flipped; }
 | 
			
		||||
  void LoadImageWithStupidMethodForFlipSupport(QImage image);
 | 
			
		||||
  void stop();
 | 
			
		||||
 | 
			
		||||
  void move(int ax, int ay);
 | 
			
		||||
  void combo_resize(int w, int h);
 | 
			
		||||
  void play_frame_sfx();
 | 
			
		||||
 | 
			
		||||
  void sfx_two_network_boogaloo();
 | 
			
		||||
@ -42,6 +38,10 @@ public:
 | 
			
		||||
  QString frame_screenshake_hellstring = "";
 | 
			
		||||
  QString frame_realization_hellstring = "";
 | 
			
		||||
  bool use_networked_framehell = false;
 | 
			
		||||
 | 
			
		||||
  void move(int ax, int ay);
 | 
			
		||||
  void combo_resize(int w, int h);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
@ -52,14 +52,15 @@ private:
 | 
			
		||||
  QString last_path;
 | 
			
		||||
  QString current_emote;
 | 
			
		||||
  QString current_char;
 | 
			
		||||
  int default_w;
 | 
			
		||||
  int default_h;
 | 
			
		||||
 | 
			
		||||
  const int time_mod = 62;
 | 
			
		||||
 | 
			
		||||
  // These are the X and Y values before they are fixed based on the sprite's width.
 | 
			
		||||
  // These are the X and Y values before they are fixed based on the sprite's
 | 
			
		||||
  // width.
 | 
			
		||||
  int x = 0;
 | 
			
		||||
  int y = 0;
 | 
			
		||||
  int default_w;
 | 
			
		||||
  int default_h;
 | 
			
		||||
 | 
			
		||||
  bool m_flipped = false;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -3,22 +3,21 @@
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
 | 
			
		||||
class AOEmoteButton : public QPushButton
 | 
			
		||||
{
 | 
			
		||||
class AOEmoteButton : public QPushButton {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
 | 
			
		||||
 | 
			
		||||
  //void set_on(QString p_char, int p_emote);
 | 
			
		||||
  //void set_off(QString p_char, int p_emote);
 | 
			
		||||
  // void set_on(QString p_char, int p_emote);
 | 
			
		||||
  // void set_off(QString p_char, int p_emote);
 | 
			
		||||
  void set_image(QString p_char, int p_emote, QString suffix);
 | 
			
		||||
 | 
			
		||||
  void set_id(int p_id) {m_id = p_id;}
 | 
			
		||||
  int get_id() {return m_id;}
 | 
			
		||||
  void set_id(int p_id) { m_id = p_id; }
 | 
			
		||||
  int get_id() { return m_id; }
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  QWidget *parent;
 | 
			
		||||
 | 
			
		||||
@ -4,21 +4,21 @@
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aoimage.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QPushButton>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
class AOEvidenceButton : public QPushButton
 | 
			
		||||
{
 | 
			
		||||
class AOEvidenceButton : public QPushButton {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
 | 
			
		||||
  AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x,
 | 
			
		||||
                   int p_y);
 | 
			
		||||
 | 
			
		||||
  void reset();
 | 
			
		||||
  void set_image(QString p_image);
 | 
			
		||||
  void set_theme_image(QString p_image);
 | 
			
		||||
  void set_id(int p_id) {m_id = p_id;}
 | 
			
		||||
  void set_id(int p_id) { m_id = p_id; }
 | 
			
		||||
 | 
			
		||||
  void set_selected(bool p_selected);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -4,19 +4,18 @@
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aosfxplayer.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QMovie>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
class AOEvidenceDisplay : public QLabel
 | 
			
		||||
{
 | 
			
		||||
class AOEvidenceDisplay : public QLabel {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app);
 | 
			
		||||
 | 
			
		||||
  void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume);
 | 
			
		||||
  QLabel* get_evidence_icon();
 | 
			
		||||
  QLabel *get_evidence_icon();
 | 
			
		||||
  void reset();
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
@ -1,15 +1,14 @@
 | 
			
		||||
//This class represents a static theme-dependent image
 | 
			
		||||
// This class represents a static theme-dependent image
 | 
			
		||||
 | 
			
		||||
#ifndef AOIMAGE_H
 | 
			
		||||
#define AOIMAGE_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
 | 
			
		||||
class AOImage : public QLabel
 | 
			
		||||
{
 | 
			
		||||
class AOImage : public QLabel {
 | 
			
		||||
public:
 | 
			
		||||
  AOImage(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
  ~AOImage();
 | 
			
		||||
 | 
			
		||||
@ -4,8 +4,7 @@
 | 
			
		||||
#include <QLineEdit>
 | 
			
		||||
#include <QMouseEvent>
 | 
			
		||||
 | 
			
		||||
class AOLineEdit : public QLineEdit
 | 
			
		||||
{
 | 
			
		||||
class AOLineEdit : public QLineEdit {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
@ -19,8 +18,6 @@ signals:
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
  void on_enter_pressed();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOLINEEDIT_H
 | 
			
		||||
 | 
			
		||||
@ -7,8 +7,7 @@
 | 
			
		||||
class Courtroom;
 | 
			
		||||
class AOApplication;
 | 
			
		||||
 | 
			
		||||
class AOMovie : public QLabel
 | 
			
		||||
{
 | 
			
		||||
class AOMovie : public QLabel {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
@ -9,15 +9,14 @@
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QObject>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
#include <QObject>
 | 
			
		||||
 | 
			
		||||
#if defined(BASSAUDIO)
 | 
			
		||||
class AOMusicPlayer : public QObject
 | 
			
		||||
{
 | 
			
		||||
class AOMusicPlayer : public QObject {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
@ -38,11 +37,9 @@ private:
 | 
			
		||||
  QString f_path;
 | 
			
		||||
 | 
			
		||||
  HSTREAM m_stream;
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
#elif defined(QTAUDIO)
 | 
			
		||||
class AOMusicPlayer : public QObject
 | 
			
		||||
{
 | 
			
		||||
class AOMusicPlayer : public QObject {
 | 
			
		||||
public:
 | 
			
		||||
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
  ~AOMusicPlayer();
 | 
			
		||||
@ -64,8 +61,7 @@ private:
 | 
			
		||||
  QString f_path;
 | 
			
		||||
};
 | 
			
		||||
#else
 | 
			
		||||
class AOMusicPlayer : public QObject
 | 
			
		||||
{
 | 
			
		||||
class AOMusicPlayer : public QObject {
 | 
			
		||||
public:
 | 
			
		||||
  AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
  ~AOMusicPlayer();
 | 
			
		||||
 | 
			
		||||
@ -1,150 +1,152 @@
 | 
			
		||||
#ifndef AOOPTIONSDIALOG_H
 | 
			
		||||
#define AOOPTIONSDIALOG_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#ifdef BASSAUDIO
 | 
			
		||||
#include "bass.h"
 | 
			
		||||
#elif defined QTAUDIO
 | 
			
		||||
#include <QAudio>
 | 
			
		||||
#include <QAudioDeviceInfo>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <QtCore/QVariant>
 | 
			
		||||
#include <QtWidgets/QApplication>
 | 
			
		||||
#include <QtWidgets/QCheckBox>
 | 
			
		||||
#include <QtWidgets/QComboBox>
 | 
			
		||||
#include <QtWidgets/QDialog>
 | 
			
		||||
#include <QtWidgets/QDialogButtonBox>
 | 
			
		||||
#include <QtWidgets/QFormLayout>
 | 
			
		||||
#include <QtWidgets/QFrame>
 | 
			
		||||
#include <QtWidgets/QLabel>
 | 
			
		||||
#include <QtWidgets/QLineEdit>
 | 
			
		||||
#include <QtWidgets/QPlainTextEdit>
 | 
			
		||||
#include <QtWidgets/QSpinBox>
 | 
			
		||||
#include <QtWidgets/QTabWidget>
 | 
			
		||||
#include <QtWidgets/QVBoxLayout>
 | 
			
		||||
#include <QtWidgets/QWidget>
 | 
			
		||||
 | 
			
		||||
#include <QDirIterator>
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
 | 
			
		||||
class AOOptionsDialog: public QDialog
 | 
			
		||||
{
 | 
			
		||||
    Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
    explicit AOOptionsDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
    QVBoxLayout *ui_vertical_layout;
 | 
			
		||||
    QTabWidget *ui_settings_tabs;
 | 
			
		||||
 | 
			
		||||
    QWidget *ui_gameplay_tab;
 | 
			
		||||
    QWidget *ui_form_layout_widget;
 | 
			
		||||
    QFormLayout *ui_gameplay_form;
 | 
			
		||||
    QLabel *ui_theme_label;
 | 
			
		||||
    QComboBox *ui_theme_combobox;
 | 
			
		||||
    QFrame *ui_theme_log_divider;
 | 
			
		||||
    QLabel *ui_downwards_lbl;
 | 
			
		||||
    QCheckBox *ui_downwards_cb;
 | 
			
		||||
    QLabel *ui_length_lbl;
 | 
			
		||||
    QSpinBox *ui_length_spinbox;
 | 
			
		||||
#ifndef AOOPTIONSDIALOG_H
 | 
			
		||||
#define AOOPTIONSDIALOG_H
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#ifdef BASSAUDIO
 | 
			
		||||
#include "bass.h"
 | 
			
		||||
#elif defined QTAUDIO
 | 
			
		||||
#include <QAudio>
 | 
			
		||||
#include <QAudioDeviceInfo>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include <QtCore/QVariant>
 | 
			
		||||
#include <QtWidgets/QApplication>
 | 
			
		||||
#include <QtWidgets/QCheckBox>
 | 
			
		||||
#include <QtWidgets/QComboBox>
 | 
			
		||||
#include <QtWidgets/QDialog>
 | 
			
		||||
#include <QtWidgets/QDialogButtonBox>
 | 
			
		||||
#include <QtWidgets/QFormLayout>
 | 
			
		||||
#include <QtWidgets/QFrame>
 | 
			
		||||
#include <QtWidgets/QLabel>
 | 
			
		||||
#include <QtWidgets/QLineEdit>
 | 
			
		||||
#include <QtWidgets/QPlainTextEdit>
 | 
			
		||||
#include <QtWidgets/QSpinBox>
 | 
			
		||||
#include <QtWidgets/QTabWidget>
 | 
			
		||||
#include <QtWidgets/QVBoxLayout>
 | 
			
		||||
#include <QtWidgets/QWidget>
 | 
			
		||||
 | 
			
		||||
#include <QDirIterator>
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
 | 
			
		||||
class AOOptionsDialog : public QDialog {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
  explicit AOOptionsDialog(QWidget *parent = nullptr,
 | 
			
		||||
                           AOApplication *p_ao_app = nullptr);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  AOApplication *ao_app;
 | 
			
		||||
 | 
			
		||||
  QVBoxLayout *ui_vertical_layout;
 | 
			
		||||
  QTabWidget *ui_settings_tabs;
 | 
			
		||||
 | 
			
		||||
  QWidget *ui_gameplay_tab;
 | 
			
		||||
  QWidget *ui_form_layout_widget;
 | 
			
		||||
  QFormLayout *ui_gameplay_form;
 | 
			
		||||
  QLabel *ui_theme_label;
 | 
			
		||||
  QComboBox *ui_theme_combobox;
 | 
			
		||||
  QFrame *ui_theme_log_divider;
 | 
			
		||||
  QLabel *ui_downwards_lbl;
 | 
			
		||||
  QCheckBox *ui_downwards_cb;
 | 
			
		||||
  QLabel *ui_length_lbl;
 | 
			
		||||
  QSpinBox *ui_length_spinbox;
 | 
			
		||||
  QLabel *ui_pun_delay;
 | 
			
		||||
  QSpinBox *ui_pun_delay_spinbox;
 | 
			
		||||
    QFrame *ui_log_names_divider;
 | 
			
		||||
    QLineEdit *ui_username_textbox;
 | 
			
		||||
    QLabel *ui_username_lbl;
 | 
			
		||||
    QLabel *ui_showname_lbl;
 | 
			
		||||
    QCheckBox *ui_showname_cb;
 | 
			
		||||
    QFrame *ui_net_divider;
 | 
			
		||||
    QLabel *ui_ms_lbl;
 | 
			
		||||
    QLineEdit *ui_ms_textbox;
 | 
			
		||||
    QLabel *ui_discord_lbl;
 | 
			
		||||
    QCheckBox *ui_discord_cb;
 | 
			
		||||
    QLabel *ui_epilepsy_lbl;
 | 
			
		||||
    QCheckBox *ui_epilepsy_cb;
 | 
			
		||||
    QLabel *ui_language_label;
 | 
			
		||||
    QComboBox *ui_language_combobox;
 | 
			
		||||
 | 
			
		||||
  QFrame *ui_log_names_divider;
 | 
			
		||||
  QLineEdit *ui_username_textbox;
 | 
			
		||||
  QLabel *ui_username_lbl;
 | 
			
		||||
  QLabel *ui_showname_lbl;
 | 
			
		||||
  QCheckBox *ui_showname_cb;
 | 
			
		||||
  QFrame *ui_net_divider;
 | 
			
		||||
  QLabel *ui_ms_lbl;
 | 
			
		||||
  QLineEdit *ui_ms_textbox;
 | 
			
		||||
  QLabel *ui_discord_lbl;
 | 
			
		||||
  QLabel *ui_epilepsy_lbl;
 | 
			
		||||
  QCheckBox *ui_epilepsy_cb;
 | 
			
		||||
 | 
			
		||||
  QCheckBox *ui_discord_cb;
 | 
			
		||||
  QLabel *ui_language_label;
 | 
			
		||||
  QComboBox *ui_language_combobox;
 | 
			
		||||
 | 
			
		||||
  QLabel *ui_keepevi_lbl;
 | 
			
		||||
  QCheckBox *ui_keepevi_cb;
 | 
			
		||||
 | 
			
		||||
  QLabel *ui_keepcobj_lbl;
 | 
			
		||||
  QCheckBox *ui_keepcobj_cb;
 | 
			
		||||
 | 
			
		||||
    QWidget *ui_callwords_tab;
 | 
			
		||||
    QWidget *ui_callwords_widget;
 | 
			
		||||
    QVBoxLayout *ui_callwords_layout;
 | 
			
		||||
    QPlainTextEdit *ui_callwords_textbox;
 | 
			
		||||
    QLabel *ui_callwords_explain_lbl;
 | 
			
		||||
    QCheckBox *ui_callwords_char_textbox;
 | 
			
		||||
 | 
			
		||||
    QWidget *ui_audio_tab;
 | 
			
		||||
    QWidget *ui_audio_widget;
 | 
			
		||||
    QFormLayout *ui_audio_layout;
 | 
			
		||||
    QLabel *ui_audio_device_lbl;
 | 
			
		||||
    QComboBox *ui_audio_device_combobox;
 | 
			
		||||
    QFrame *ui_audio_volume_divider;
 | 
			
		||||
    QSpinBox *ui_music_volume_spinbox;
 | 
			
		||||
    QLabel *ui_music_volume_lbl;
 | 
			
		||||
    QSpinBox *ui_sfx_volume_spinbox;
 | 
			
		||||
    QSpinBox *ui_blips_volume_spinbox;
 | 
			
		||||
    QLabel *ui_sfx_volume_lbl;
 | 
			
		||||
    QLabel *ui_blips_volume_lbl;
 | 
			
		||||
    QFrame *ui_volume_blip_divider;
 | 
			
		||||
    QSpinBox *ui_bliprate_spinbox;
 | 
			
		||||
    QLabel *ui_bliprate_lbl;
 | 
			
		||||
    QCheckBox *ui_blank_blips_cb;
 | 
			
		||||
    QLabel *ui_blank_blips_lbl;
 | 
			
		||||
    QLabel *ui_loopsfx_lbl;
 | 
			
		||||
    QCheckBox *ui_loopsfx_cb;
 | 
			
		||||
    QLabel *ui_objectmusic_lbl;
 | 
			
		||||
    QCheckBox *ui_objectmusic_cb;
 | 
			
		||||
    QDialogButtonBox *ui_settings_buttons;
 | 
			
		||||
 | 
			
		||||
    QWidget *ui_casing_tab;
 | 
			
		||||
    QWidget *ui_casing_widget;
 | 
			
		||||
    QFormLayout *ui_casing_layout;
 | 
			
		||||
    QLabel *ui_casing_supported_lbl;
 | 
			
		||||
    QLabel *ui_casing_enabled_lbl;
 | 
			
		||||
    QCheckBox *ui_casing_enabled_cb;
 | 
			
		||||
    QLabel *ui_casing_def_lbl;
 | 
			
		||||
    QCheckBox *ui_casing_def_cb;
 | 
			
		||||
    QLabel *ui_casing_pro_lbl;
 | 
			
		||||
    QCheckBox *ui_casing_pro_cb;
 | 
			
		||||
    QLabel *ui_casing_jud_lbl;
 | 
			
		||||
    QCheckBox *ui_casing_jud_cb;
 | 
			
		||||
    QLabel *ui_casing_jur_lbl;
 | 
			
		||||
    QCheckBox *ui_casing_jur_cb;
 | 
			
		||||
    QLabel *ui_casing_steno_lbl;
 | 
			
		||||
    QCheckBox *ui_casing_steno_cb;
 | 
			
		||||
    QLabel *ui_casing_cm_lbl;
 | 
			
		||||
    QCheckBox *ui_casing_cm_cb;
 | 
			
		||||
    QLabel *ui_casing_wit_lbl;
 | 
			
		||||
    QCheckBox *ui_casing_wit_cb;
 | 
			
		||||
    QLabel *ui_casing_cm_cases_lbl;
 | 
			
		||||
    QLineEdit *ui_casing_cm_cases_textbox;
 | 
			
		||||
 | 
			
		||||
  QWidget *ui_other_tab;
 | 
			
		||||
  QWidget *ui_other_widget;
 | 
			
		||||
  QFormLayout *ui_other_layout;
 | 
			
		||||
  QLabel *ui_other_fancy_icl_enabled_lb;
 | 
			
		||||
  QCheckBox *ui_other_fancy_icl_enabled_cb;
 | 
			
		||||
  QLabel *ui_other_mirror_icl_enabled_lb;
 | 
			
		||||
  QCheckBox *ui_other_mirror_icl_enabled_cb;
 | 
			
		||||
 | 
			
		||||
  QLabel *ui_other_fancy_icl_limit_lb;
 | 
			
		||||
  QCheckBox *ui_other_fancy_icl_limit_cb;
 | 
			
		||||
 | 
			
		||||
  QWidget *ui_callwords_tab;
 | 
			
		||||
  QWidget *ui_callwords_widget;
 | 
			
		||||
  QVBoxLayout *ui_callwords_layout;
 | 
			
		||||
  QPlainTextEdit *ui_callwords_textbox;
 | 
			
		||||
  QLabel *ui_callwords_explain_lbl;
 | 
			
		||||
  QCheckBox *ui_callwords_char_textbox;
 | 
			
		||||
 | 
			
		||||
  QWidget *ui_audio_tab;
 | 
			
		||||
  QWidget *ui_audio_widget;
 | 
			
		||||
  QFormLayout *ui_audio_layout;
 | 
			
		||||
  QLabel *ui_audio_device_lbl;
 | 
			
		||||
  QComboBox *ui_audio_device_combobox;
 | 
			
		||||
  QFrame *ui_audio_volume_divider;
 | 
			
		||||
  QSpinBox *ui_music_volume_spinbox;
 | 
			
		||||
  QLabel *ui_music_volume_lbl;
 | 
			
		||||
  QSpinBox *ui_sfx_volume_spinbox;
 | 
			
		||||
  QLabel *ui_loopsfx_lbl;
 | 
			
		||||
  QCheckBox *ui_loopsfx_cb;
 | 
			
		||||
  QLabel *ui_objectmusic_lbl;
 | 
			
		||||
  QCheckBox *ui_objectmusic_cb;
 | 
			
		||||
 | 
			
		||||
  QSpinBox *ui_blips_volume_spinbox;
 | 
			
		||||
  QLabel *ui_sfx_volume_lbl;
 | 
			
		||||
  QLabel *ui_blips_volume_lbl;
 | 
			
		||||
  QFrame *ui_volume_blip_divider;
 | 
			
		||||
  QSpinBox *ui_bliprate_spinbox;
 | 
			
		||||
  QLabel *ui_bliprate_lbl;
 | 
			
		||||
  QCheckBox *ui_blank_blips_cb;
 | 
			
		||||
  QLabel *ui_blank_blips_lbl;
 | 
			
		||||
  QDialogButtonBox *ui_settings_buttons;
 | 
			
		||||
 | 
			
		||||
  QWidget *ui_casing_tab;
 | 
			
		||||
  QWidget *ui_casing_widget;
 | 
			
		||||
  QFormLayout *ui_casing_layout;
 | 
			
		||||
  QLabel *ui_casing_supported_lbl;
 | 
			
		||||
  QLabel *ui_casing_enabled_lbl;
 | 
			
		||||
  QCheckBox *ui_casing_enabled_cb;
 | 
			
		||||
  QLabel *ui_casing_def_lbl;
 | 
			
		||||
  QCheckBox *ui_casing_def_cb;
 | 
			
		||||
  QLabel *ui_casing_pro_lbl;
 | 
			
		||||
  QCheckBox *ui_casing_pro_cb;
 | 
			
		||||
  QLabel *ui_casing_jud_lbl;
 | 
			
		||||
  QCheckBox *ui_casing_jud_cb;
 | 
			
		||||
  QLabel *ui_casing_jur_lbl;
 | 
			
		||||
  QCheckBox *ui_casing_jur_cb;
 | 
			
		||||
  QLabel *ui_casing_steno_lbl;
 | 
			
		||||
  QCheckBox *ui_casing_steno_cb;
 | 
			
		||||
  QLabel *ui_casing_cm_lbl;
 | 
			
		||||
  QCheckBox *ui_casing_cm_cb;
 | 
			
		||||
  QLabel *ui_casing_wit_lbl;
 | 
			
		||||
  QCheckBox *ui_casing_wit_cb;
 | 
			
		||||
  QLabel *ui_casing_cm_cases_lbl;
 | 
			
		||||
  QLineEdit *ui_casing_cm_cases_textbox;
 | 
			
		||||
 | 
			
		||||
  QWidget *ui_other_tab;
 | 
			
		||||
  QWidget *ui_other_widget;
 | 
			
		||||
  QFormLayout *ui_other_layout;
 | 
			
		||||
  QLabel *ui_other_fancy_icl_enabled_lb;
 | 
			
		||||
  QCheckBox *ui_other_fancy_icl_enabled_cb;
 | 
			
		||||
  QLabel *ui_other_mirror_icl_enabled_lb;
 | 
			
		||||
  QCheckBox *ui_other_mirror_icl_enabled_cb;
 | 
			
		||||
 | 
			
		||||
  QLabel *ui_other_fancy_icl_limit_lb;
 | 
			
		||||
  QCheckBox *ui_other_fancy_icl_limit_cb;
 | 
			
		||||
 | 
			
		||||
  bool needs_default_audiodev();
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
    void save_pressed();
 | 
			
		||||
    void discard_pressed();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOOPTIONSDIALOG_H
 | 
			
		||||
 | 
			
		||||
signals:
 | 
			
		||||
 | 
			
		||||
public slots:
 | 
			
		||||
  void save_pressed();
 | 
			
		||||
  void discard_pressed();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOOPTIONSDIALOG_H
 | 
			
		||||
 | 
			
		||||
@ -1,19 +1,18 @@
 | 
			
		||||
#ifndef AOPACKET_H
 | 
			
		||||
#define AOPACKET_H
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
class AOPacket
 | 
			
		||||
{
 | 
			
		||||
class AOPacket {
 | 
			
		||||
public:
 | 
			
		||||
  AOPacket(QString p_packet_string);
 | 
			
		||||
  AOPacket(QString header, QStringList &p_contents);
 | 
			
		||||
  ~AOPacket();
 | 
			
		||||
 | 
			
		||||
  QString get_header() {return m_header;}
 | 
			
		||||
  QStringList &get_contents() {return m_contents;}
 | 
			
		||||
  QString get_header() { return m_header; }
 | 
			
		||||
  QStringList &get_contents() { return m_contents; }
 | 
			
		||||
  QString to_string();
 | 
			
		||||
 | 
			
		||||
  void encrypt_header(unsigned int p_key);
 | 
			
		||||
 | 
			
		||||
@ -1,15 +1,14 @@
 | 
			
		||||
#ifndef AOSCENE_H
 | 
			
		||||
#define AOSCENE_H
 | 
			
		||||
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QMovie>
 | 
			
		||||
 | 
			
		||||
class Courtroom;
 | 
			
		||||
class AOApplication;
 | 
			
		||||
 | 
			
		||||
class AOScene : public QLabel
 | 
			
		||||
{
 | 
			
		||||
class AOScene : public QLabel {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
  explicit AOScene(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
 | 
			
		||||
@ -9,13 +9,12 @@
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
#include <QWidget>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
class AOSfxPlayer : public QObject
 | 
			
		||||
{
 | 
			
		||||
class AOSfxPlayer : public QObject {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
  AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
 | 
			
		||||
@ -33,11 +32,11 @@ private:
 | 
			
		||||
 | 
			
		||||
  void set_volume_internal(qreal p_volume);
 | 
			
		||||
 | 
			
		||||
  #if defined(BASSAUDIO)
 | 
			
		||||
#if defined(BASSAUDIO)
 | 
			
		||||
  HSTREAM m_stream;
 | 
			
		||||
  #elif defined(QTAUDIO)
 | 
			
		||||
  QSoundEffect m_sfx;  
 | 
			
		||||
  #endif
 | 
			
		||||
#elif defined(QTAUDIO)
 | 
			
		||||
  QSoundEffect m_sfx;
 | 
			
		||||
#endif
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOSFXPLAYER_H
 | 
			
		||||
 | 
			
		||||
@ -1,14 +1,13 @@
 | 
			
		||||
#ifndef AOTEXTAREA_H
 | 
			
		||||
#define AOTEXTAREA_H
 | 
			
		||||
 | 
			
		||||
#include <QTextBrowser>
 | 
			
		||||
#include <QScrollBar>
 | 
			
		||||
#include <QTextCursor>
 | 
			
		||||
#include <QRegExp>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QRegExp>
 | 
			
		||||
#include <QScrollBar>
 | 
			
		||||
#include <QTextBrowser>
 | 
			
		||||
#include <QTextCursor>
 | 
			
		||||
 | 
			
		||||
class AOTextArea : public QTextBrowser
 | 
			
		||||
{
 | 
			
		||||
class AOTextArea : public QTextBrowser {
 | 
			
		||||
public:
 | 
			
		||||
  AOTextArea(QWidget *p_parent = nullptr);
 | 
			
		||||
 | 
			
		||||
@ -19,7 +18,8 @@ public:
 | 
			
		||||
private:
 | 
			
		||||
  const QRegExp omnis_dank_url_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
 | 
			
		||||
 | 
			
		||||
  void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down);
 | 
			
		||||
  void auto_scroll(QTextCursor old_cursor, int scrollbar_value,
 | 
			
		||||
                   bool is_scrolled_down);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOTEXTAREA_H
 | 
			
		||||
 | 
			
		||||
@ -3,8 +3,7 @@
 | 
			
		||||
 | 
			
		||||
#include <QPlainTextEdit>
 | 
			
		||||
 | 
			
		||||
class AOTextEdit : public QPlainTextEdit
 | 
			
		||||
{
 | 
			
		||||
class AOTextEdit : public QPlainTextEdit {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
  AOTextEdit(QWidget *parent);
 | 
			
		||||
@ -17,7 +16,6 @@ signals:
 | 
			
		||||
 | 
			
		||||
private slots:
 | 
			
		||||
  void on_enter_pressed();
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif // AOTEXTEDIT_H
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2214
									
								
								include/bass.h
									
									
									
									
									
								
							
							
						
						
									
										2214
									
								
								include/bass.h
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1,11 +1,10 @@
 | 
			
		||||
#ifndef CHATLOGPIECE_H
 | 
			
		||||
#define CHATLOGPIECE_H
 | 
			
		||||
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QDateTime>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
class chatlogpiece
 | 
			
		||||
{
 | 
			
		||||
class chatlogpiece {
 | 
			
		||||
public:
 | 
			
		||||
  chatlogpiece();
 | 
			
		||||
  chatlogpiece(QString p_name, QString p_showname, QString p_message,
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1468
									
								
								include/courtroom.h
									
									
									
									
									
								
							
							
						
						
									
										1468
									
								
								include/courtroom.h
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -3,16 +3,14 @@
 | 
			
		||||
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
struct server_type
 | 
			
		||||
{
 | 
			
		||||
struct server_type {
 | 
			
		||||
  QString name;
 | 
			
		||||
  QString desc;
 | 
			
		||||
  QString ip;
 | 
			
		||||
  int port;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct emote_type
 | 
			
		||||
{
 | 
			
		||||
struct emote_type {
 | 
			
		||||
  QString comment;
 | 
			
		||||
  QString preanim;
 | 
			
		||||
  QString anim;
 | 
			
		||||
@ -22,23 +20,20 @@ struct emote_type
 | 
			
		||||
  int sfx_duration;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct char_type
 | 
			
		||||
{
 | 
			
		||||
struct char_type {
 | 
			
		||||
  QString name;
 | 
			
		||||
  QString description;
 | 
			
		||||
  QString evidence_string;
 | 
			
		||||
  bool taken;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct evi_type
 | 
			
		||||
{
 | 
			
		||||
struct evi_type {
 | 
			
		||||
  QString name;
 | 
			
		||||
  QString description;
 | 
			
		||||
  QString image;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct chatmessage_type
 | 
			
		||||
{
 | 
			
		||||
struct chatmessage_type {
 | 
			
		||||
  QString message;
 | 
			
		||||
  QString character;
 | 
			
		||||
  QString side;
 | 
			
		||||
@ -55,29 +50,25 @@ struct chatmessage_type
 | 
			
		||||
  int flip;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct area_type
 | 
			
		||||
{
 | 
			
		||||
struct area_type {
 | 
			
		||||
  QString name;
 | 
			
		||||
  QString background;
 | 
			
		||||
  bool passworded;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct pos_type
 | 
			
		||||
{
 | 
			
		||||
struct pos_type {
 | 
			
		||||
  int x;
 | 
			
		||||
  int y;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct pos_size_type
 | 
			
		||||
{
 | 
			
		||||
struct pos_size_type {
 | 
			
		||||
  int x = 0;
 | 
			
		||||
  int y = 0;
 | 
			
		||||
  int width = 0;
 | 
			
		||||
  int height = 0;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum CHAT_MESSAGE
 | 
			
		||||
{
 | 
			
		||||
enum CHAT_MESSAGE {
 | 
			
		||||
  DESK_MOD = 0,
 | 
			
		||||
  PRE_EMOTE,
 | 
			
		||||
  CHAR_NAME,
 | 
			
		||||
@ -108,17 +99,6 @@ enum CHAT_MESSAGE
 | 
			
		||||
  FRAME_SFX
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum COLOR
 | 
			
		||||
{
 | 
			
		||||
  WHITE = 0,
 | 
			
		||||
  GREEN,
 | 
			
		||||
  RED,
 | 
			
		||||
  ORANGE,
 | 
			
		||||
  BLUE,
 | 
			
		||||
  YELLOW,
 | 
			
		||||
  RAINBOW,
 | 
			
		||||
  PINK,
 | 
			
		||||
  CYAN
 | 
			
		||||
};
 | 
			
		||||
enum COLOR { WHITE = 0, GREEN, RED, ORANGE, BLUE, YELLOW, RAINBOW, PINK, CYAN };
 | 
			
		||||
 | 
			
		||||
#endif // DATATYPES_H
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,8 @@
 | 
			
		||||
#ifndef DEBUG_FUNCTIONS_H
 | 
			
		||||
#define DEBUG_FUNCTIONS_H
 | 
			
		||||
 | 
			
		||||
#include <QString>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
void call_error(QString message);
 | 
			
		||||
void call_notice(QString message);
 | 
			
		||||
 | 
			
		||||
@ -24,61 +24,63 @@ extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordRichPresence {
 | 
			
		||||
    const char* state;   /* max 128 bytes */
 | 
			
		||||
    const char* details; /* max 128 bytes */
 | 
			
		||||
    int64_t startTimestamp;
 | 
			
		||||
    int64_t endTimestamp;
 | 
			
		||||
    const char* largeImageKey;  /* max 32 bytes */
 | 
			
		||||
    const char* largeImageText; /* max 128 bytes */
 | 
			
		||||
    const char* smallImageKey;  /* max 32 bytes */
 | 
			
		||||
    const char* smallImageText; /* max 128 bytes */
 | 
			
		||||
    const char* partyId;        /* max 128 bytes */
 | 
			
		||||
    int partySize;
 | 
			
		||||
    int partyMax;
 | 
			
		||||
    const char* matchSecret;    /* max 128 bytes */
 | 
			
		||||
    const char* joinSecret;     /* max 128 bytes */
 | 
			
		||||
    const char* spectateSecret; /* max 128 bytes */
 | 
			
		||||
    int8_t instance;
 | 
			
		||||
  const char *state;   /* max 128 bytes */
 | 
			
		||||
  const char *details; /* max 128 bytes */
 | 
			
		||||
  int64_t startTimestamp;
 | 
			
		||||
  int64_t endTimestamp;
 | 
			
		||||
  const char *largeImageKey;  /* max 32 bytes */
 | 
			
		||||
  const char *largeImageText; /* max 128 bytes */
 | 
			
		||||
  const char *smallImageKey;  /* max 32 bytes */
 | 
			
		||||
  const char *smallImageText; /* max 128 bytes */
 | 
			
		||||
  const char *partyId;        /* max 128 bytes */
 | 
			
		||||
  int partySize;
 | 
			
		||||
  int partyMax;
 | 
			
		||||
  const char *matchSecret;    /* max 128 bytes */
 | 
			
		||||
  const char *joinSecret;     /* max 128 bytes */
 | 
			
		||||
  const char *spectateSecret; /* max 128 bytes */
 | 
			
		||||
  int8_t instance;
 | 
			
		||||
} DiscordRichPresence;
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordJoinRequest {
 | 
			
		||||
    const char* userId;
 | 
			
		||||
    const char* username;
 | 
			
		||||
    const char* discriminator;
 | 
			
		||||
    const char* avatar;
 | 
			
		||||
  const char *userId;
 | 
			
		||||
  const char *username;
 | 
			
		||||
  const char *discriminator;
 | 
			
		||||
  const char *avatar;
 | 
			
		||||
} DiscordJoinRequest;
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordEventHandlers {
 | 
			
		||||
    void (*ready)(void);
 | 
			
		||||
    void (*disconnected)(int errorCode, const char* message);
 | 
			
		||||
    void (*errored)(int errorCode, const char* message);
 | 
			
		||||
    void (*joinGame)(const char* joinSecret);
 | 
			
		||||
    void (*spectateGame)(const char* spectateSecret);
 | 
			
		||||
    void (*joinRequest)(const DiscordJoinRequest* request);
 | 
			
		||||
  void (*ready)(void);
 | 
			
		||||
  void (*disconnected)(int errorCode, const char *message);
 | 
			
		||||
  void (*errored)(int errorCode, const char *message);
 | 
			
		||||
  void (*joinGame)(const char *joinSecret);
 | 
			
		||||
  void (*spectateGame)(const char *spectateSecret);
 | 
			
		||||
  void (*joinRequest)(const DiscordJoinRequest *request);
 | 
			
		||||
} DiscordEventHandlers;
 | 
			
		||||
 | 
			
		||||
#define DISCORD_REPLY_NO 0
 | 
			
		||||
#define DISCORD_REPLY_YES 1
 | 
			
		||||
#define DISCORD_REPLY_IGNORE 2
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
 | 
			
		||||
                                       DiscordEventHandlers* handlers,
 | 
			
		||||
DISCORD_EXPORT void Discord_Initialize(const char *applicationId,
 | 
			
		||||
                                       DiscordEventHandlers *handlers,
 | 
			
		||||
                                       int autoRegister,
 | 
			
		||||
                                       const char* optionalSteamId);
 | 
			
		||||
                                       const char *optionalSteamId);
 | 
			
		||||
DISCORD_EXPORT void Discord_Shutdown(void);
 | 
			
		||||
 | 
			
		||||
/* checks for incoming messages, dispatches callbacks */
 | 
			
		||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
 | 
			
		||||
 | 
			
		||||
/* If you disable the lib starting its own io thread, you'll need to call this from your own */
 | 
			
		||||
/* If you disable the lib starting its own io thread, you'll need to call this
 | 
			
		||||
 * from your own */
 | 
			
		||||
#ifdef DISCORD_DISABLE_IO_THREAD
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence);
 | 
			
		||||
DISCORD_EXPORT void Discord_ClearPresence(void);
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
 | 
			
		||||
DISCORD_EXPORT void Discord_Respond(const char *userid,
 | 
			
		||||
                                    /* DISCORD_REPLY_ */ int reply);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
} /* extern "C" */
 | 
			
		||||
 | 
			
		||||
@ -1,25 +1,27 @@
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#if defined(DISCORD_DYNAMIC_LIB)
 | 
			
		||||
#  if defined(_WIN32)
 | 
			
		||||
#    if defined(DISCORD_BUILDING_SDK)
 | 
			
		||||
#      define DISCORD_EXPORT __declspec(dllexport)
 | 
			
		||||
#    else
 | 
			
		||||
#      define DISCORD_EXPORT __declspec(dllimport)
 | 
			
		||||
#    endif
 | 
			
		||||
#  else
 | 
			
		||||
#    define DISCORD_EXPORT __attribute__((visibility("default")))
 | 
			
		||||
#  endif
 | 
			
		||||
#if defined(_WIN32)
 | 
			
		||||
#if defined(DISCORD_BUILDING_SDK)
 | 
			
		||||
#define DISCORD_EXPORT __declspec(dllexport)
 | 
			
		||||
#else
 | 
			
		||||
#  define DISCORD_EXPORT
 | 
			
		||||
#define DISCORD_EXPORT __declspec(dllimport)
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
#define DISCORD_EXPORT __attribute__((visibility("default")))
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
#define DISCORD_EXPORT
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command);
 | 
			
		||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
 | 
			
		||||
DISCORD_EXPORT void Discord_Register(const char *applicationId,
 | 
			
		||||
                                     const char *command);
 | 
			
		||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char *applicationId,
 | 
			
		||||
                                              const char *steamId);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,11 +1,11 @@
 | 
			
		||||
#ifndef DISCORD_RICH_PRESENCE_H
 | 
			
		||||
#define DISCORD_RICH_PRESENCE_H
 | 
			
		||||
 | 
			
		||||
#include <QCoreApplication>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <cstring>
 | 
			
		||||
#include <ctime>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <QCoreApplication>
 | 
			
		||||
 | 
			
		||||
#include <discord-rpc.h>
 | 
			
		||||
 | 
			
		||||
@ -16,14 +16,14 @@
 | 
			
		||||
 | 
			
		||||
namespace AttorneyOnline {
 | 
			
		||||
 | 
			
		||||
class Discord
 | 
			
		||||
{
 | 
			
		||||
class Discord {
 | 
			
		||||
  Q_DECLARE_TR_FUNCTIONS(Discord)
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
  const char* APPLICATION_ID = "399779271737868288";
 | 
			
		||||
  const char *APPLICATION_ID = "399779271737868288";
 | 
			
		||||
  std::string server_name, server_id;
 | 
			
		||||
  int64_t timestamp;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  Discord();
 | 
			
		||||
  ~Discord();
 | 
			
		||||
@ -34,5 +34,5 @@ public:
 | 
			
		||||
  void state_spectate();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
} // namespace AttorneyOnline
 | 
			
		||||
#endif // DISCORD_RICH_PRESENCE_H
 | 
			
		||||
 | 
			
		||||
@ -24,63 +24,65 @@ extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordRichPresence {
 | 
			
		||||
    const char* state;   /* max 128 bytes */
 | 
			
		||||
    const char* details; /* max 128 bytes */
 | 
			
		||||
    int64_t startTimestamp;
 | 
			
		||||
    int64_t endTimestamp;
 | 
			
		||||
    const char* largeImageKey;  /* max 32 bytes */
 | 
			
		||||
    const char* largeImageText; /* max 128 bytes */
 | 
			
		||||
    const char* smallImageKey;  /* max 32 bytes */
 | 
			
		||||
    const char* smallImageText; /* max 128 bytes */
 | 
			
		||||
    const char* partyId;        /* max 128 bytes */
 | 
			
		||||
    int partySize;
 | 
			
		||||
    int partyMax;
 | 
			
		||||
    const char* matchSecret;    /* max 128 bytes */
 | 
			
		||||
    const char* joinSecret;     /* max 128 bytes */
 | 
			
		||||
    const char* spectateSecret; /* max 128 bytes */
 | 
			
		||||
    int8_t instance;
 | 
			
		||||
  const char *state;   /* max 128 bytes */
 | 
			
		||||
  const char *details; /* max 128 bytes */
 | 
			
		||||
  int64_t startTimestamp;
 | 
			
		||||
  int64_t endTimestamp;
 | 
			
		||||
  const char *largeImageKey;  /* max 32 bytes */
 | 
			
		||||
  const char *largeImageText; /* max 128 bytes */
 | 
			
		||||
  const char *smallImageKey;  /* max 32 bytes */
 | 
			
		||||
  const char *smallImageText; /* max 128 bytes */
 | 
			
		||||
  const char *partyId;        /* max 128 bytes */
 | 
			
		||||
  int partySize;
 | 
			
		||||
  int partyMax;
 | 
			
		||||
  const char *matchSecret;    /* max 128 bytes */
 | 
			
		||||
  const char *joinSecret;     /* max 128 bytes */
 | 
			
		||||
  const char *spectateSecret; /* max 128 bytes */
 | 
			
		||||
  int8_t instance;
 | 
			
		||||
} DiscordRichPresence;
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordUser {
 | 
			
		||||
    const char* userId;
 | 
			
		||||
    const char* username;
 | 
			
		||||
    const char* discriminator;
 | 
			
		||||
    const char* avatar;
 | 
			
		||||
  const char *userId;
 | 
			
		||||
  const char *username;
 | 
			
		||||
  const char *discriminator;
 | 
			
		||||
  const char *avatar;
 | 
			
		||||
} DiscordUser;
 | 
			
		||||
 | 
			
		||||
typedef struct DiscordEventHandlers {
 | 
			
		||||
    void (*ready)(const DiscordUser* request);
 | 
			
		||||
    void (*disconnected)(int errorCode, const char* message);
 | 
			
		||||
    void (*errored)(int errorCode, const char* message);
 | 
			
		||||
    void (*joinGame)(const char* joinSecret);
 | 
			
		||||
    void (*spectateGame)(const char* spectateSecret);
 | 
			
		||||
    void (*joinRequest)(const DiscordUser* request);
 | 
			
		||||
  void (*ready)(const DiscordUser *request);
 | 
			
		||||
  void (*disconnected)(int errorCode, const char *message);
 | 
			
		||||
  void (*errored)(int errorCode, const char *message);
 | 
			
		||||
  void (*joinGame)(const char *joinSecret);
 | 
			
		||||
  void (*spectateGame)(const char *spectateSecret);
 | 
			
		||||
  void (*joinRequest)(const DiscordUser *request);
 | 
			
		||||
} DiscordEventHandlers;
 | 
			
		||||
 | 
			
		||||
#define DISCORD_REPLY_NO 0
 | 
			
		||||
#define DISCORD_REPLY_YES 1
 | 
			
		||||
#define DISCORD_REPLY_IGNORE 2
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
 | 
			
		||||
                                       DiscordEventHandlers* handlers,
 | 
			
		||||
DISCORD_EXPORT void Discord_Initialize(const char *applicationId,
 | 
			
		||||
                                       DiscordEventHandlers *handlers,
 | 
			
		||||
                                       int autoRegister,
 | 
			
		||||
                                       const char* optionalSteamId);
 | 
			
		||||
                                       const char *optionalSteamId);
 | 
			
		||||
DISCORD_EXPORT void Discord_Shutdown(void);
 | 
			
		||||
 | 
			
		||||
/* checks for incoming messages, dispatches callbacks */
 | 
			
		||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
 | 
			
		||||
 | 
			
		||||
/* If you disable the lib starting its own io thread, you'll need to call this from your own */
 | 
			
		||||
/* If you disable the lib starting its own io thread, you'll need to call this
 | 
			
		||||
 * from your own */
 | 
			
		||||
#ifdef DISCORD_DISABLE_IO_THREAD
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence);
 | 
			
		||||
DISCORD_EXPORT void Discord_ClearPresence(void);
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
 | 
			
		||||
DISCORD_EXPORT void Discord_Respond(const char *userid,
 | 
			
		||||
                                    /* DISCORD_REPLY_ */ int reply);
 | 
			
		||||
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers);
 | 
			
		||||
DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers *handlers);
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
} /* extern "C" */
 | 
			
		||||
 | 
			
		||||
@ -3,11 +3,11 @@
 | 
			
		||||
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
#include <cstddef>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <iomanip>
 | 
			
		||||
#include <QVector>
 | 
			
		||||
#include <cstddef>
 | 
			
		||||
#include <iomanip>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
QString fanta_encrypt(QString p_input, unsigned int key);
 | 
			
		||||
QString fanta_decrypt(QString p_input, unsigned int key);
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,8 @@
 | 
			
		||||
#ifndef FILE_FUNCTIONS_H
 | 
			
		||||
#define FILE_FUNCTIONS_H
 | 
			
		||||
 | 
			
		||||
#include <QFileInfo>
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include <QFileInfo>
 | 
			
		||||
#include <QString>
 | 
			
		||||
 | 
			
		||||
bool file_exists(QString file_path);
 | 
			
		||||
 | 
			
		||||
@ -1,17 +1,16 @@
 | 
			
		||||
#ifndef HEX_OPERATIONS_H
 | 
			
		||||
#define HEX_OPERATIONS_H
 | 
			
		||||
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <bitset>
 | 
			
		||||
#include <cstdint>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <string>
 | 
			
		||||
#include <iomanip>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
#include <sstream>
 | 
			
		||||
#include <string>
 | 
			
		||||
 | 
			
		||||
namespace omni
 | 
			
		||||
{
 | 
			
		||||
  std::string int_to_hex(unsigned int input);
 | 
			
		||||
namespace omni {
 | 
			
		||||
std::string int_to_hex(unsigned int input);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif //HEX_OPERATIONS_H
 | 
			
		||||
#endif // HEX_OPERATIONS_H
 | 
			
		||||
 | 
			
		||||
@ -1,16 +1,16 @@
 | 
			
		||||
#ifndef LOBBY_H
 | 
			
		||||
#define LOBBY_H
 | 
			
		||||
 | 
			
		||||
#include "aoimage.h"
 | 
			
		||||
#include "aobutton.h"
 | 
			
		||||
#include "aoimage.h"
 | 
			
		||||
#include "aopacket.h"
 | 
			
		||||
#include "aotextarea.h"
 | 
			
		||||
 | 
			
		||||
#include <QMainWindow>
 | 
			
		||||
#include <QListWidget>
 | 
			
		||||
#include <QLabel>
 | 
			
		||||
#include <QPlainTextEdit>
 | 
			
		||||
#include <QLineEdit>
 | 
			
		||||
#include <QListWidget>
 | 
			
		||||
#include <QMainWindow>
 | 
			
		||||
#include <QPlainTextEdit>
 | 
			
		||||
#include <QProgressBar>
 | 
			
		||||
#include <QTextBrowser>
 | 
			
		||||
 | 
			
		||||
@ -19,8 +19,7 @@
 | 
			
		||||
 | 
			
		||||
class AOApplication;
 | 
			
		||||
 | 
			
		||||
class Lobby : public QMainWindow
 | 
			
		||||
{
 | 
			
		||||
class Lobby : public QMainWindow {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
@ -33,8 +32,8 @@ public:
 | 
			
		||||
  void append_error(QString f_message);
 | 
			
		||||
  void set_player_count(int players_online, int max_players);
 | 
			
		||||
  void set_loading_text(QString p_text);
 | 
			
		||||
  void show_loading_overlay(){ui_loading_background->show();}
 | 
			
		||||
  void hide_loading_overlay(){ui_loading_background->hide();}
 | 
			
		||||
  void show_loading_overlay() { ui_loading_background->show(); }
 | 
			
		||||
  void hide_loading_overlay() { ui_loading_background->hide(); }
 | 
			
		||||
  QString get_chatlog();
 | 
			
		||||
  int get_selected_server();
 | 
			
		||||
  void enable_connect_button();
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,8 @@
 | 
			
		||||
#ifndef MISC_FUNCTIONS_H
 | 
			
		||||
#define MISC_FUNCTIONS_H
 | 
			
		||||
 | 
			
		||||
#include <QTime>
 | 
			
		||||
#include <QCoreApplication>
 | 
			
		||||
#include <QTime>
 | 
			
		||||
 | 
			
		||||
void delay(int p_milliseconds);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,8 @@
 | 
			
		||||
#ifndef NETWORKMANAGER_H
 | 
			
		||||
#define NETWORKMANAGER_H
 | 
			
		||||
 | 
			
		||||
// Qt for Android has stubbed QDnsLookup. This is not documented in any part of their wiki.
 | 
			
		||||
// This prevents SRV lookup/failover behavior from functioning.
 | 
			
		||||
// Qt for Android has stubbed QDnsLookup. This is not documented in any part of
 | 
			
		||||
// their wiki. This prevents SRV lookup/failover behavior from functioning.
 | 
			
		||||
// https://bugreports.qt.io/browse/QTBUG-56143
 | 
			
		||||
#ifndef ANDROID
 | 
			
		||||
#define MS_FAILOVER_SUPPORTED
 | 
			
		||||
@ -14,17 +14,16 @@
 | 
			
		||||
#undef MS_FAILOVER_SUPPORTED
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include "aopacket.h"
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aopacket.h"
 | 
			
		||||
 | 
			
		||||
#include <QTcpSocket>
 | 
			
		||||
#include <QDnsLookup>
 | 
			
		||||
#include <QTcpSocket>
 | 
			
		||||
#include <QTime>
 | 
			
		||||
#include <QTimer>
 | 
			
		||||
#include <cstring>
 | 
			
		||||
 | 
			
		||||
class NetworkManager : public QObject
 | 
			
		||||
{
 | 
			
		||||
class NetworkManager : public QObject {
 | 
			
		||||
  Q_OBJECT
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
 | 
			
		||||
@ -3,11 +3,11 @@
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
#include <QVector>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QColor>
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QSettings>
 | 
			
		||||
#include <QStringList>
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
#include <QVector>
 | 
			
		||||
 | 
			
		||||
#endif // TEXT_FILE_FUNCTIONS_H
 | 
			
		||||
 | 
			
		||||
@ -9,6 +9,7 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
 | 
			
		||||
 | 
			
		||||
cd "${ROOT_DIR}"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#need some openGL stuff
 | 
			
		||||
sudo apt install libgl1-mesa-dev
 | 
			
		||||
#install curl incase of fresh vm
 | 
			
		||||
 | 
			
		||||
@ -1,17 +1,17 @@
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include "lobby.h"
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
#include "networkmanager.h"
 | 
			
		||||
#include "debug_functions.h"
 | 
			
		||||
 | 
			
		||||
#include "aooptionsdialog.h"
 | 
			
		||||
#include "aocaseannouncerdialog.h"
 | 
			
		||||
#include "aooptionsdialog.h"
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
#include "debug_functions.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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,6 @@
 | 
			
		||||
#include "aoblipplayer.h"
 | 
			
		||||
 | 
			
		||||
#if defined(BASSAUDIO) //Using bass.dll for the blips
 | 
			
		||||
#if defined(BASSAUDIO) // Using bass.dll for the blips
 | 
			
		||||
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
@ -11,11 +11,11 @@ void AOBlipPlayer::set_blips(QString p_sfx)
 | 
			
		||||
{
 | 
			
		||||
  QString f_path = ao_app->get_sounds_path(p_sfx);
 | 
			
		||||
 | 
			
		||||
  for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n_stream = 0; n_stream < 5; ++n_stream) {
 | 
			
		||||
    BASS_StreamFree(m_stream_list[n_stream]);
 | 
			
		||||
 | 
			
		||||
    m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
 | 
			
		||||
    m_stream_list[n_stream] = BASS_StreamCreateFile(
 | 
			
		||||
        FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  set_volume_internal(m_volume);
 | 
			
		||||
@ -44,12 +44,11 @@ void AOBlipPlayer::set_volume_internal(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
  float volume = p_value;
 | 
			
		||||
 | 
			
		||||
  for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n_stream = 0; n_stream < 5; ++n_stream) {
 | 
			
		||||
    BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
#elif defined(QTAUDIO) //Using Qt's QSoundEffect class
 | 
			
		||||
#elif defined(QTAUDIO) // Using Qt's QSoundEffect class
 | 
			
		||||
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
@ -60,8 +59,7 @@ void AOBlipPlayer::set_blips(QString p_sfx)
 | 
			
		||||
{
 | 
			
		||||
  QString f_path = ao_app->get_sounds_path(p_sfx);
 | 
			
		||||
 | 
			
		||||
  for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n_stream = 0; n_stream < 5; ++n_stream) {
 | 
			
		||||
    m_blips.setSource(QUrl::fromLocalFile(f_path));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -88,30 +86,18 @@ void AOBlipPlayer::set_volume_internal(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
  m_blips.setVolume(m_volume);
 | 
			
		||||
}
 | 
			
		||||
#else //No audio
 | 
			
		||||
#else                  // No audio
 | 
			
		||||
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::set_blips(QString p_sfx)
 | 
			
		||||
{
 | 
			
		||||
void AOBlipPlayer::set_blips(QString p_sfx) {}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void AOBlipPlayer::blip_tick() {}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::blip_tick()
 | 
			
		||||
{
 | 
			
		||||
void AOBlipPlayer::set_volume(qreal p_value) {}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::set_volume(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOBlipPlayer::set_volume_internal(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void AOBlipPlayer::set_volume_internal(qreal p_value) {}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -3,15 +3,13 @@
 | 
			
		||||
#include "debug_functions.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent)
 | 
			
		||||
AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app)
 | 
			
		||||
    : QPushButton(parent)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AOButton::~AOButton()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
AOButton::~AOButton() {}
 | 
			
		||||
 | 
			
		||||
void AOButton::set_image(QString p_image)
 | 
			
		||||
{
 | 
			
		||||
@ -23,4 +21,3 @@ void AOButton::set_image(QString p_image)
 | 
			
		||||
  else
 | 
			
		||||
    this->setStyleSheet("border-image:url(\"" + default_image_path + "\")");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,9 @@
 | 
			
		||||
#include "aocaseannouncerdialog.h"
 | 
			
		||||
 | 
			
		||||
AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_ao_app, Courtroom *p_court)
 | 
			
		||||
  : QDialog(parent)
 | 
			
		||||
AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent,
 | 
			
		||||
                                             AOApplication *p_ao_app,
 | 
			
		||||
                                             Courtroom *p_court)
 | 
			
		||||
    : QDialog(parent)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
  court = p_court;
 | 
			
		||||
@ -14,21 +16,27 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
 | 
			
		||||
  QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
 | 
			
		||||
  sizepolicy.setHorizontalStretch(0);
 | 
			
		||||
  sizepolicy.setVerticalStretch(0);
 | 
			
		||||
  sizepolicy.setHeightForWidth(ui_announcer_buttons->sizePolicy().hasHeightForWidth());
 | 
			
		||||
  sizepolicy.setHeightForWidth(
 | 
			
		||||
      ui_announcer_buttons->sizePolicy().hasHeightForWidth());
 | 
			
		||||
  ui_announcer_buttons->setSizePolicy(sizepolicy);
 | 
			
		||||
  ui_announcer_buttons->setOrientation(Qt::Horizontal);
 | 
			
		||||
  ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
 | 
			
		||||
  ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok |
 | 
			
		||||
                                           QDialogButtonBox::Cancel);
 | 
			
		||||
 | 
			
		||||
  QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this, SLOT(ok_pressed()));
 | 
			
		||||
  QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this, SLOT(cancel_pressed()));
 | 
			
		||||
  QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this,
 | 
			
		||||
                   SLOT(ok_pressed()));
 | 
			
		||||
  QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this,
 | 
			
		||||
                   SLOT(cancel_pressed()));
 | 
			
		||||
 | 
			
		||||
  setUpdatesEnabled(false);
 | 
			
		||||
 | 
			
		||||
  ui_vbox_layout = new QVBoxLayout(this);
 | 
			
		||||
 | 
			
		||||
  ui_form_layout = new QFormLayout(this);
 | 
			
		||||
  ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
 | 
			
		||||
  ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop);
 | 
			
		||||
  ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
 | 
			
		||||
                                    Qt::AlignVCenter);
 | 
			
		||||
  ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
 | 
			
		||||
                                   Qt::AlignTop);
 | 
			
		||||
  ui_form_layout->setContentsMargins(6, 6, 6, 6);
 | 
			
		||||
 | 
			
		||||
  ui_vbox_layout->addItem(ui_form_layout);
 | 
			
		||||
@ -69,18 +77,13 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
 | 
			
		||||
 | 
			
		||||
void AOCaseAnnouncerDialog::ok_pressed()
 | 
			
		||||
{
 | 
			
		||||
  court->announce_case(ui_case_title_textbox->text(),
 | 
			
		||||
                       ui_defense_needed->isChecked(),
 | 
			
		||||
                       ui_prosecutor_needed->isChecked(),
 | 
			
		||||
                       ui_judge_needed->isChecked(),
 | 
			
		||||
                       ui_juror_needed->isChecked(),
 | 
			
		||||
                       ui_steno_needed->isChecked(),
 | 
			
		||||
                       ui_witness_needed->isChecked());
 | 
			
		||||
  court->announce_case(
 | 
			
		||||
      ui_case_title_textbox->text(), ui_defense_needed->isChecked(),
 | 
			
		||||
      ui_prosecutor_needed->isChecked(), ui_judge_needed->isChecked(),
 | 
			
		||||
      ui_juror_needed->isChecked(), ui_steno_needed->isChecked(),
 | 
			
		||||
      ui_witness_needed->isChecked());
 | 
			
		||||
 | 
			
		||||
  done(0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCaseAnnouncerDialog::cancel_pressed()
 | 
			
		||||
{
 | 
			
		||||
  done(0);
 | 
			
		||||
}
 | 
			
		||||
void AOCaseAnnouncerDialog::cancel_pressed() { done(0); }
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,9 @@
 | 
			
		||||
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken) : QPushButton(parent)
 | 
			
		||||
AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos,
 | 
			
		||||
                           int y_pos, bool is_taken)
 | 
			
		||||
    : QPushButton(parent)
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
 | 
			
		||||
@ -40,45 +42,35 @@ void AOCharButton::reset()
 | 
			
		||||
  ui_selector->hide();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharButton::set_taken(bool is_taken)
 | 
			
		||||
{
 | 
			
		||||
  taken = is_taken;
 | 
			
		||||
}
 | 
			
		||||
void AOCharButton::set_taken(bool is_taken) { taken = is_taken; }
 | 
			
		||||
 | 
			
		||||
void AOCharButton::apply_taken_image()
 | 
			
		||||
{
 | 
			
		||||
  if (taken)
 | 
			
		||||
  {
 | 
			
		||||
    ui_taken->move(0,0);
 | 
			
		||||
  if (taken) {
 | 
			
		||||
    ui_taken->move(0, 0);
 | 
			
		||||
    ui_taken->show();
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    ui_taken->hide();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharButton::set_passworded()
 | 
			
		||||
{
 | 
			
		||||
  ui_passworded->show();
 | 
			
		||||
}
 | 
			
		||||
void AOCharButton::set_passworded() { ui_passworded->show(); }
 | 
			
		||||
 | 
			
		||||
void AOCharButton::set_image(QString p_character)
 | 
			
		||||
{
 | 
			
		||||
  QString image_path = ao_app->get_character_path(p_character, "char_icon.png");
 | 
			
		||||
 | 
			
		||||
  this->setText("");
 | 
			
		||||
 | 
			
		||||
  if (file_exists(image_path))
 | 
			
		||||
    this->setStyleSheet("border-image:url(\"" + image_path + "\")");
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    this->setStyleSheet("border-image:url()");
 | 
			
		||||
    this->setText(p_character);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharButton::enterEvent(QEvent * e)
 | 
			
		||||
void AOCharButton::enterEvent(QEvent *e)
 | 
			
		||||
{
 | 
			
		||||
  ui_selector->move(this->x() - 1, this->y() - 1);
 | 
			
		||||
  ui_selector->raise();
 | 
			
		||||
@ -88,10 +80,8 @@ void AOCharButton::enterEvent(QEvent * e)
 | 
			
		||||
  QPushButton::enterEvent(e);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharButton::leaveEvent(QEvent * e)
 | 
			
		||||
void AOCharButton::leaveEvent(QEvent *e)
 | 
			
		||||
{
 | 
			
		||||
  ui_selector->hide();
 | 
			
		||||
  QPushButton::leaveEvent(e);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,11 @@
 | 
			
		||||
#include "aocharmovie.h"
 | 
			
		||||
 | 
			
		||||
#include "misc_functions.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include "misc_functions.h"
 | 
			
		||||
 | 
			
		||||
AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
 | 
			
		||||
AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app)
 | 
			
		||||
    : QLabel(p_parent)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
  m_movie = new QMovie(this);
 | 
			
		||||
@ -19,17 +20,22 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_
 | 
			
		||||
void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
 | 
			
		||||
{
 | 
			
		||||
  apng = false;
 | 
			
		||||
  QString original_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif");
 | 
			
		||||
  QString alt_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".png");
 | 
			
		||||
 | 
			
		||||
  QString original_path =
 | 
			
		||||
      ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif");
 | 
			
		||||
  QString alt_path =
 | 
			
		||||
      ao_app->get_character_path(p_char, emote_prefix + p_emote + ".png");
 | 
			
		||||
  QString apng_path =
 | 
			
		||||
      ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng");
 | 
			
		||||
  QString alt_path_still = ao_app->get_character_path(p_char, p_emote + ".png");
 | 
			
		||||
  QString apng_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng");
 | 
			
		||||
 | 
			
		||||
  QString placeholder_path = ao_app->get_theme_path("placeholder.gif");
 | 
			
		||||
  QString placeholder_default_path = ao_app->get_default_theme_path("placeholder.gif");
 | 
			
		||||
  QString placeholder_default_path =
 | 
			
		||||
      ao_app->get_default_theme_path("placeholder.gif");
 | 
			
		||||
  QString gif_path;
 | 
			
		||||
  current_emote = emote_prefix + p_emote;
 | 
			
		||||
  current_char = p_char;
 | 
			
		||||
  if (file_exists(apng_path))
 | 
			
		||||
  {
 | 
			
		||||
  if (file_exists(apng_path)) {
 | 
			
		||||
    gif_path = apng_path;
 | 
			
		||||
    apng = true;
 | 
			
		||||
  }
 | 
			
		||||
@ -53,7 +59,8 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
 | 
			
		||||
  this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
 | 
			
		||||
  this->show();
 | 
			
		||||
  this->play_frame_sfx();
 | 
			
		||||
  // if the frame count is 0 (i.e. it's a static PNG) don't try to play the next frame, ya goofus
 | 
			
		||||
  // if the frame count is 0 (i.e. it's a static PNG) don't try to play the next
 | 
			
		||||
  // frame, ya goofus
 | 
			
		||||
  if (m_movie->frameCount() != 0) {
 | 
			
		||||
    ticker->start(m_movie->nextFrameDelay());
 | 
			
		||||
  }
 | 
			
		||||
@ -62,148 +69,147 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
 | 
			
		||||
void AOCharMovie::play_frame_sfx()
 | 
			
		||||
{
 | 
			
		||||
  int current_frame = m_movie->currentFrameNumber();
 | 
			
		||||
  QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, current_emote, current_frame);
 | 
			
		||||
  QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, current_emote, current_frame);
 | 
			
		||||
  QString realization_to_play = ao_app->get_realization_frame(current_char, current_emote, current_frame);
 | 
			
		||||
  if(sfx_to_play != "" && !use_networked_framehell)
 | 
			
		||||
  {
 | 
			
		||||
  QString sfx_to_play =
 | 
			
		||||
      ao_app->get_frame_sfx_name(current_char, current_emote, current_frame);
 | 
			
		||||
  QString screenshake_to_play =
 | 
			
		||||
      ao_app->get_screenshake_frame(current_char, current_emote, current_frame);
 | 
			
		||||
  QString realization_to_play =
 | 
			
		||||
      ao_app->get_realization_frame(current_char, current_emote, current_frame);
 | 
			
		||||
  if (sfx_to_play != "" && !use_networked_framehell) {
 | 
			
		||||
    frame_specific_sfx_player->play(ao_app->get_sfx_suffix(sfx_to_play));
 | 
			
		||||
  }
 | 
			
		||||
  else if(use_networked_framehell)
 | 
			
		||||
  {
 | 
			
		||||
      this->sfx_two_network_boogaloo();
 | 
			
		||||
  else if (use_networked_framehell) {
 | 
			
		||||
    this->sfx_two_network_boogaloo();
 | 
			
		||||
  }
 | 
			
		||||
  if(screenshake_to_play != "" && !use_networked_framehell)
 | 
			
		||||
  {
 | 
			
		||||
  if (screenshake_to_play != "" && !use_networked_framehell) {
 | 
			
		||||
    mycourtroom->doScreenShake();
 | 
			
		||||
  }
 | 
			
		||||
  else if(use_networked_framehell)
 | 
			
		||||
  {
 | 
			
		||||
      this->screenshake_two_network_boogaloo();
 | 
			
		||||
  else if (use_networked_framehell) {
 | 
			
		||||
    this->screenshake_two_network_boogaloo();
 | 
			
		||||
  }
 | 
			
		||||
  if(realization_to_play != "" && !use_networked_framehell)
 | 
			
		||||
  {
 | 
			
		||||
  if (realization_to_play != "" && !use_networked_framehell) {
 | 
			
		||||
    mycourtroom->doRealization();
 | 
			
		||||
  }
 | 
			
		||||
  else if(use_networked_framehell)
 | 
			
		||||
  {
 | 
			
		||||
      this->realization_two_network_boogaloo();
 | 
			
		||||
  else if (use_networked_framehell) {
 | 
			
		||||
    this->realization_two_network_boogaloo();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharMovie::realization_two_network_boogaloo()
 | 
			
		||||
{
 | 
			
		||||
    int current_frame = m_movie->currentFrameNumber();
 | 
			
		||||
    QStringList realizationList = this->frame_realization_hellstring.split("^");
 | 
			
		||||
    for (int i = 0; i < realizationList.length(); i++) {
 | 
			
		||||
        QString screenshakeList = realizationList.at(i);
 | 
			
		||||
        QStringList extra_garbage = screenshakeList.split("|");
 | 
			
		||||
        if(extra_garbage.at(0) != current_emote){
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        for (int ii = 1; ii < extra_garbage.length(); ii++) {
 | 
			
		||||
            QString levels_of_garbage = extra_garbage.at(ii);
 | 
			
		||||
            QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
 | 
			
		||||
            if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") {
 | 
			
		||||
                mycourtroom->doRealization();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
  int current_frame = m_movie->currentFrameNumber();
 | 
			
		||||
  QStringList realizationList = this->frame_realization_hellstring.split("^");
 | 
			
		||||
  for (int i = 0; i < realizationList.length(); i++) {
 | 
			
		||||
    QString screenshakeList = realizationList.at(i);
 | 
			
		||||
    QStringList extra_garbage = screenshakeList.split("|");
 | 
			
		||||
    if (extra_garbage.at(0) != current_emote) {
 | 
			
		||||
      continue;
 | 
			
		||||
    }
 | 
			
		||||
    for (int ii = 1; ii < extra_garbage.length(); ii++) {
 | 
			
		||||
      QString levels_of_garbage = extra_garbage.at(ii);
 | 
			
		||||
      QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
 | 
			
		||||
      if (that_shouldnt_be_possible.at(0).toInt() == current_frame &&
 | 
			
		||||
          that_shouldnt_be_possible.at(1) != "") {
 | 
			
		||||
        mycourtroom->doRealization();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharMovie::screenshake_two_network_boogaloo()
 | 
			
		||||
{
 | 
			
		||||
    int current_frame = m_movie->currentFrameNumber();
 | 
			
		||||
    QStringList realizationList = this->frame_screenshake_hellstring.split("^");
 | 
			
		||||
    for (int i = 0; i < realizationList.length(); i++) {
 | 
			
		||||
        QString screenshakeList = realizationList.at(i);
 | 
			
		||||
        QStringList extra_garbage = screenshakeList.split("|");
 | 
			
		||||
        if(extra_garbage.at(0) != current_emote){
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        for (int ii = 1; ii < extra_garbage.length(); ii++) {
 | 
			
		||||
            QString levels_of_garbage = extra_garbage.at(ii);
 | 
			
		||||
            QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
 | 
			
		||||
            if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") {
 | 
			
		||||
                mycourtroom->doScreenShake();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
  int current_frame = m_movie->currentFrameNumber();
 | 
			
		||||
  QStringList realizationList = this->frame_screenshake_hellstring.split("^");
 | 
			
		||||
  for (int i = 0; i < realizationList.length(); i++) {
 | 
			
		||||
    QString screenshakeList = realizationList.at(i);
 | 
			
		||||
    QStringList extra_garbage = screenshakeList.split("|");
 | 
			
		||||
    if (extra_garbage.at(0) != current_emote) {
 | 
			
		||||
      continue;
 | 
			
		||||
    }
 | 
			
		||||
    for (int ii = 1; ii < extra_garbage.length(); ii++) {
 | 
			
		||||
      QString levels_of_garbage = extra_garbage.at(ii);
 | 
			
		||||
      QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
 | 
			
		||||
      if (that_shouldnt_be_possible.at(0).toInt() == current_frame &&
 | 
			
		||||
          that_shouldnt_be_possible.at(1) != "") {
 | 
			
		||||
        mycourtroom->doScreenShake();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharMovie::sfx_two_network_boogaloo()
 | 
			
		||||
{
 | 
			
		||||
    int current_frame = m_movie->currentFrameNumber();
 | 
			
		||||
    QStringList realizationList = this->frame_sfx_hellstring.split("^");
 | 
			
		||||
    for (int i = 0; i < realizationList.length(); i++) {
 | 
			
		||||
        QString screenshakeList = realizationList.at(i);
 | 
			
		||||
        QStringList extra_garbage = screenshakeList.split("|");
 | 
			
		||||
        if(extra_garbage.at(0) != current_emote){
 | 
			
		||||
            continue;
 | 
			
		||||
        }
 | 
			
		||||
        for (int ii = 1; ii < extra_garbage.length(); ii++) {
 | 
			
		||||
            QString levels_of_garbage = extra_garbage.at(ii);
 | 
			
		||||
            QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
 | 
			
		||||
            if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") {
 | 
			
		||||
                frame_specific_sfx_player->play(ao_app->get_sfx_suffix(that_shouldnt_be_possible.at(1)));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
  int current_frame = m_movie->currentFrameNumber();
 | 
			
		||||
  QStringList realizationList = this->frame_sfx_hellstring.split("^");
 | 
			
		||||
  for (int i = 0; i < realizationList.length(); i++) {
 | 
			
		||||
    QString screenshakeList = realizationList.at(i);
 | 
			
		||||
    QStringList extra_garbage = screenshakeList.split("|");
 | 
			
		||||
    if (extra_garbage.at(0) != current_emote) {
 | 
			
		||||
      continue;
 | 
			
		||||
    }
 | 
			
		||||
    for (int ii = 1; ii < extra_garbage.length(); ii++) {
 | 
			
		||||
      QString levels_of_garbage = extra_garbage.at(ii);
 | 
			
		||||
      QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
 | 
			
		||||
      if (that_shouldnt_be_possible.at(0).toInt() == current_frame &&
 | 
			
		||||
          that_shouldnt_be_possible.at(1) != "") {
 | 
			
		||||
        frame_specific_sfx_player->play(
 | 
			
		||||
            ao_app->get_sfx_suffix(that_shouldnt_be_possible.at(1)));
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void AOCharMovie::movie_ticker()
 | 
			
		||||
{
 | 
			
		||||
  if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1)
 | 
			
		||||
  {
 | 
			
		||||
  if (m_movie->currentFrameNumber() == m_movie->frameCount() - 1) {
 | 
			
		||||
    delete m_movie;
 | 
			
		||||
    m_movie = new QMovie(this);
 | 
			
		||||
    m_movie->stop();
 | 
			
		||||
    this->clear();
 | 
			
		||||
    m_movie->setFileName(last_path);
 | 
			
		||||
    m_movie->jumpToFrame(0);
 | 
			
		||||
    if(play_once)
 | 
			
		||||
    {
 | 
			
		||||
         timer_done();
 | 
			
		||||
    if (play_once) {
 | 
			
		||||
      timer_done();
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    m_movie->jumpToNextFrame();
 | 
			
		||||
  }
 | 
			
		||||
  this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
 | 
			
		||||
  // imagine if QT had sane stuff like "mirror on QMovie" or "resize the image on QT" or "interface with the current QMovie image" or anything else
 | 
			
		||||
  // imagine if QT had sane stuff like "mirror on QMovie" or "resize the image
 | 
			
		||||
  // on QT" or "interface with the current QMovie image" or anything else
 | 
			
		||||
 | 
			
		||||
  this->play_frame_sfx();
 | 
			
		||||
 | 
			
		||||
  if (m_movie->frameCount() == 0)
 | 
			
		||||
  {
 | 
			
		||||
  if (m_movie->frameCount() == 0) {
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  else if (!apng)
 | 
			
		||||
  {
 | 
			
		||||
  else if (!apng) {
 | 
			
		||||
    ticker->start(m_movie->nextFrameDelay());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image)
 | 
			
		||||
{
 | 
			
		||||
    QPixmap f_pixmap;
 | 
			
		||||
    if(m_flipped)
 | 
			
		||||
        f_pixmap = QPixmap::fromImage(image.mirrored(true, false));
 | 
			
		||||
    else
 | 
			
		||||
        f_pixmap = QPixmap::fromImage(image);
 | 
			
		||||
    auto aspect_ratio = Qt::KeepAspectRatio;
 | 
			
		||||
  QPixmap f_pixmap;
 | 
			
		||||
  if (m_flipped)
 | 
			
		||||
    f_pixmap = QPixmap::fromImage(image.mirrored(true, false));
 | 
			
		||||
  else
 | 
			
		||||
    f_pixmap = QPixmap::fromImage(image);
 | 
			
		||||
  auto aspect_ratio = Qt::KeepAspectRatio;
 | 
			
		||||
 | 
			
		||||
    if (f_pixmap.size().width() > f_pixmap.size().height())
 | 
			
		||||
      aspect_ratio = Qt::KeepAspectRatioByExpanding;
 | 
			
		||||
  if (f_pixmap.size().width() > f_pixmap.size().height())
 | 
			
		||||
    aspect_ratio = Qt::KeepAspectRatioByExpanding;
 | 
			
		||||
 | 
			
		||||
    if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height())
 | 
			
		||||
      this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::SmoothTransformation));
 | 
			
		||||
    else
 | 
			
		||||
      this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation));
 | 
			
		||||
  if (f_pixmap.size().width() > this->size().width() ||
 | 
			
		||||
      f_pixmap.size().height() > this->size().height())
 | 
			
		||||
    this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio,
 | 
			
		||||
                                    Qt::SmoothTransformation));
 | 
			
		||||
  else
 | 
			
		||||
    this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio,
 | 
			
		||||
                                    Qt::FastTransformation));
 | 
			
		||||
 | 
			
		||||
    QLabel::move(x + (this->width() - this->pixmap()->width())/2, y);
 | 
			
		||||
  QLabel::move(x + (this->width() - this->pixmap()->width()) / 2, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
 | 
			
		||||
@ -231,7 +237,8 @@ void AOCharMovie::play_idle(QString p_char, QString p_emote)
 | 
			
		||||
 | 
			
		||||
void AOCharMovie::stop()
 | 
			
		||||
{
 | 
			
		||||
  //for all intents and purposes, stopping is the same as hiding. at no point do we want a frozen gif to display
 | 
			
		||||
  // for all intents and purposes, stopping is the same as hiding. at no point
 | 
			
		||||
  // do we want a frozen gif to display
 | 
			
		||||
  m_movie->stop();
 | 
			
		||||
  frame_specific_sfx_player->stop();
 | 
			
		||||
  this->hide();
 | 
			
		||||
@ -250,7 +257,4 @@ void AOCharMovie::move(int ax, int ay)
 | 
			
		||||
  QLabel::move(x, y);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOCharMovie::timer_done()
 | 
			
		||||
{
 | 
			
		||||
  done();
 | 
			
		||||
}
 | 
			
		||||
void AOCharMovie::timer_done() { done(); }
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,9 @@
 | 
			
		||||
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
 | 
			
		||||
AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app,
 | 
			
		||||
                             int p_x, int p_y)
 | 
			
		||||
    : QPushButton(p_parent)
 | 
			
		||||
{
 | 
			
		||||
  parent = p_parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
@ -16,21 +18,17 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x
 | 
			
		||||
void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix)
 | 
			
		||||
{
 | 
			
		||||
  QString emotion_number = QString::number(p_emote + 1);
 | 
			
		||||
  QString image_path = ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix);
 | 
			
		||||
  QString image_path = ao_app->get_character_path(
 | 
			
		||||
      p_char, "emotions/button" + emotion_number + suffix);
 | 
			
		||||
 | 
			
		||||
  if (file_exists(image_path))
 | 
			
		||||
  {
 | 
			
		||||
  if (file_exists(image_path)) {
 | 
			
		||||
    this->setText("");
 | 
			
		||||
    this->setStyleSheet("border-image:url(\"" + image_path + "\")");
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    this->setText(ao_app->get_emote_comment(p_char, p_emote));
 | 
			
		||||
    this->setStyleSheet("border-image:url(\"\")");
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEmoteButton::on_clicked()
 | 
			
		||||
{
 | 
			
		||||
  emote_clicked(m_id);
 | 
			
		||||
}
 | 
			
		||||
void AOEmoteButton::on_clicked() { emote_clicked(m_id); }
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,9 @@
 | 
			
		||||
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
 | 
			
		||||
AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app,
 | 
			
		||||
                                   int p_x, int p_y)
 | 
			
		||||
    : QPushButton(p_parent)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
  m_parent = p_parent;
 | 
			
		||||
@ -39,13 +41,11 @@ void AOEvidenceButton::set_image(QString p_image)
 | 
			
		||||
{
 | 
			
		||||
  QString image_path = ao_app->get_evidence_path(p_image);
 | 
			
		||||
 | 
			
		||||
  if (file_exists(image_path))
 | 
			
		||||
  {
 | 
			
		||||
  if (file_exists(image_path)) {
 | 
			
		||||
    this->setText("");
 | 
			
		||||
    this->setStyleSheet("border-image:url(\"" + image_path + "\")");
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    this->setText(p_image);
 | 
			
		||||
    this->setStyleSheet("");
 | 
			
		||||
  }
 | 
			
		||||
@ -75,10 +75,7 @@ void AOEvidenceButton::set_selected(bool p_selected)
 | 
			
		||||
    ui_selected->hide();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::on_clicked()
 | 
			
		||||
{
 | 
			
		||||
  evidence_clicked(m_id);
 | 
			
		||||
}
 | 
			
		||||
void AOEvidenceButton::on_clicked() { evidence_clicked(m_id); }
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
 | 
			
		||||
{
 | 
			
		||||
@ -98,7 +95,7 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::enterEvent(QEvent * e)
 | 
			
		||||
void AOEvidenceButton::enterEvent(QEvent *e)
 | 
			
		||||
{
 | 
			
		||||
  ui_selector->show();
 | 
			
		||||
 | 
			
		||||
@ -108,7 +105,7 @@ void AOEvidenceButton::enterEvent(QEvent * e)
 | 
			
		||||
  QPushButton::enterEvent(e);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEvidenceButton::leaveEvent(QEvent * e)
 | 
			
		||||
void AOEvidenceButton::leaveEvent(QEvent *e)
 | 
			
		||||
{
 | 
			
		||||
  ui_selector->hide();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,11 @@
 | 
			
		||||
#include "aoevidencedisplay.h"
 | 
			
		||||
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include "datatypes.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include "misc_functions.h"
 | 
			
		||||
 | 
			
		||||
AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
 | 
			
		||||
AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app)
 | 
			
		||||
    : QLabel(p_parent)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
 | 
			
		||||
@ -12,10 +13,12 @@ AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app)
 | 
			
		||||
  evidence_icon = new QLabel(this);
 | 
			
		||||
  sfx_player = new AOSfxPlayer(this, ao_app);
 | 
			
		||||
 | 
			
		||||
  connect(evidence_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
 | 
			
		||||
  connect(evidence_movie, SIGNAL(frameChanged(int)), this,
 | 
			
		||||
          SLOT(frame_change(int)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_side, int p_volume)
 | 
			
		||||
void AOEvidenceDisplay::show_evidence(QString p_evidence_image,
 | 
			
		||||
                                      bool is_left_side, int p_volume)
 | 
			
		||||
{
 | 
			
		||||
  this->reset();
 | 
			
		||||
 | 
			
		||||
@ -29,23 +32,23 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid
 | 
			
		||||
  QString gif_name;
 | 
			
		||||
  QString icon_identifier;
 | 
			
		||||
 | 
			
		||||
  if (is_left_side)
 | 
			
		||||
  {
 | 
			
		||||
  if (is_left_side) {
 | 
			
		||||
    icon_identifier = "left_evidence_icon";
 | 
			
		||||
    gif_name = "evidence_appear_left.gif";
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    icon_identifier = "right_evidence_icon";
 | 
			
		||||
    gif_name = "evidence_appear_right.gif";
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  pos_size_type icon_dimensions = ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini");
 | 
			
		||||
  pos_size_type icon_dimensions =
 | 
			
		||||
      ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini");
 | 
			
		||||
 | 
			
		||||
  evidence_icon->move(icon_dimensions.x, icon_dimensions.y);
 | 
			
		||||
  evidence_icon->resize(icon_dimensions.width, icon_dimensions.height);
 | 
			
		||||
 | 
			
		||||
  evidence_icon->setPixmap(f_pixmap.scaled(evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio));
 | 
			
		||||
  evidence_icon->setPixmap(f_pixmap.scaled(
 | 
			
		||||
      evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio));
 | 
			
		||||
 | 
			
		||||
  QString f_default_gif_path = ao_app->get_default_theme_path(gif_name);
 | 
			
		||||
  QString f_gif_path = ao_app->get_theme_path(gif_name);
 | 
			
		||||
@ -57,7 +60,7 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid
 | 
			
		||||
 | 
			
		||||
  evidence_movie->setFileName(final_gif_path);
 | 
			
		||||
 | 
			
		||||
  if(evidence_movie->frameCount() < 1)
 | 
			
		||||
  if (evidence_movie->frameCount() < 1)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  this->setMovie(evidence_movie);
 | 
			
		||||
@ -68,9 +71,8 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid
 | 
			
		||||
 | 
			
		||||
void AOEvidenceDisplay::frame_change(int p_frame)
 | 
			
		||||
{
 | 
			
		||||
  if (p_frame == (evidence_movie->frameCount() - 1))
 | 
			
		||||
  {
 | 
			
		||||
    //we need this or else the last frame wont show
 | 
			
		||||
  if (p_frame == (evidence_movie->frameCount() - 1)) {
 | 
			
		||||
    // we need this or else the last frame wont show
 | 
			
		||||
    delay(evidence_movie->nextFrameDelay());
 | 
			
		||||
 | 
			
		||||
    evidence_movie->stop();
 | 
			
		||||
@ -88,9 +90,4 @@ void AOEvidenceDisplay::reset()
 | 
			
		||||
  this->clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QLabel* AOEvidenceDisplay::get_evidence_icon()
 | 
			
		||||
{
 | 
			
		||||
  return evidence_icon;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; }
 | 
			
		||||
 | 
			
		||||
@ -8,10 +8,7 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AOImage::~AOImage()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
AOImage::~AOImage() {}
 | 
			
		||||
 | 
			
		||||
void AOImage::set_image(QString p_image)
 | 
			
		||||
{
 | 
			
		||||
@ -27,7 +24,8 @@ void AOImage::set_image(QString p_image)
 | 
			
		||||
 | 
			
		||||
  QPixmap f_pixmap(final_image_path);
 | 
			
		||||
 | 
			
		||||
  this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
 | 
			
		||||
  this->setPixmap(
 | 
			
		||||
      f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOImage::set_image_from_path(QString p_path)
 | 
			
		||||
@ -43,5 +41,6 @@ void AOImage::set_image_from_path(QString p_path)
 | 
			
		||||
 | 
			
		||||
  QPixmap f_pixmap(final_path);
 | 
			
		||||
 | 
			
		||||
  this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
 | 
			
		||||
  this->setPixmap(
 | 
			
		||||
      f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -15,7 +15,4 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e)
 | 
			
		||||
  this->setReadOnly(false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOLineEdit::on_enter_pressed()
 | 
			
		||||
{
 | 
			
		||||
  this->setReadOnly(true);
 | 
			
		||||
}
 | 
			
		||||
void AOLineEdit::on_enter_pressed() { this->setReadOnly(true); }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										233
									
								
								src/aomovie.cpp
									
									
									
									
									
								
							
							
						
						
									
										233
									
								
								src/aomovie.cpp
									
									
									
									
									
								
							@ -1,119 +1,116 @@
 | 
			
		||||
#include "aomovie.h"
 | 
			
		||||
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
#include "aomovie.h"
 | 
			
		||||
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include "misc_functions.h"
 | 
			
		||||
 | 
			
		||||
AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
 | 
			
		||||
  m_movie = new QMovie();
 | 
			
		||||
 | 
			
		||||
  this->setMovie(m_movie);
 | 
			
		||||
  timer = new QTimer(this);
 | 
			
		||||
  timer->setTimerType(Qt::PreciseTimer);
 | 
			
		||||
  timer->setSingleShot(true);
 | 
			
		||||
  connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
 | 
			
		||||
  connect(timer, SIGNAL(timeout()), this, SLOT(timer_done()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::set_play_once(bool p_play_once)
 | 
			
		||||
{
 | 
			
		||||
  play_once = p_play_once;
 | 
			
		||||
}
 | 
			
		||||
void AOMovie::start_timer(int delay) { timer->start(delay); }
 | 
			
		||||
 | 
			
		||||
void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme,
 | 
			
		||||
                   int duration)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  m_movie->stop();
 | 
			
		||||
  // this->timer_done();
 | 
			
		||||
  QString shout_path = p_gif;
 | 
			
		||||
  QList<QString> pathlist;
 | 
			
		||||
 | 
			
		||||
  if (ao_app->get_character_path(p_char, p_gif)
 | 
			
		||||
          .contains(
 | 
			
		||||
              "custom_objections")) // checks if the file is located within the
 | 
			
		||||
                                    // folder of custom objections
 | 
			
		||||
    pathlist << ao_app->get_character_path(
 | 
			
		||||
        p_char,
 | 
			
		||||
        p_gif); // get_image_suffix is unecessery as it is already given.
 | 
			
		||||
  else if (p_gif == "custom")
 | 
			
		||||
    pathlist << ao_app->get_image_suffix(
 | 
			
		||||
        ao_app->get_character_path(p_char, p_gif));
 | 
			
		||||
  else
 | 
			
		||||
    pathlist << ao_app->get_image_suffix(
 | 
			
		||||
        ao_app->get_character_path(p_char, p_gif + "_bubble"));
 | 
			
		||||
 | 
			
		||||
  QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" +
 | 
			
		||||
                      p_gif + "_bubble.gif";
 | 
			
		||||
  QString custom_theme_path =
 | 
			
		||||
      ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif");
 | 
			
		||||
  QString theme_path = ao_app->get_theme_path(p_gif + ".gif");
 | 
			
		||||
  QString default_theme_path = ao_app->get_default_theme_path(p_gif + ".gif");
 | 
			
		||||
  QString placeholder_path = ao_app->get_theme_path("placeholder.gif");
 | 
			
		||||
  QString default_placeholder_path =
 | 
			
		||||
      ao_app->get_default_theme_path("placeholder.gif");
 | 
			
		||||
 | 
			
		||||
  pathlist << ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" +
 | 
			
		||||
                                       p_custom_theme + "/" + p_gif + "_bubble")
 | 
			
		||||
           << // Misc path
 | 
			
		||||
      ao_app->get_image_suffix(
 | 
			
		||||
          ao_app->get_custom_theme_path(p_custom_theme, p_gif))
 | 
			
		||||
           << // Custom theme path
 | 
			
		||||
      ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)) << // Theme path
 | 
			
		||||
      ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif))
 | 
			
		||||
           << // Default theme path
 | 
			
		||||
      ao_app->get_image_suffix(ao_app->get_theme_path("placeholder"))
 | 
			
		||||
           << // Placeholder path
 | 
			
		||||
      ao_app->get_image_suffix(ao_app->get_default_theme_path(
 | 
			
		||||
          "placeholder")); // Default placeholder path
 | 
			
		||||
 | 
			
		||||
  for (QString path : pathlist) {
 | 
			
		||||
    if (file_exists(path)) {
 | 
			
		||||
      shout_path = path;
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  m_movie->setFileName(shout_path);
 | 
			
		||||
  if (m_movie->loopCount() == 0)
 | 
			
		||||
    play_once = true;
 | 
			
		||||
 | 
			
		||||
  this->show();
 | 
			
		||||
  m_movie->start();
 | 
			
		||||
  if (m_movie->frameCount() == 0 && duration > 0)
 | 
			
		||||
    timer->start(duration);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::stop()
 | 
			
		||||
{
 | 
			
		||||
  m_movie->stop();
 | 
			
		||||
  this->hide();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::frame_change(int n_frame)
 | 
			
		||||
{
 | 
			
		||||
  // If it's a "static movie" (only one frame - png image), we can't change
 | 
			
		||||
  // frames - ignore this function (use timer instead). If the frame didn't
 | 
			
		||||
  // reach the last frame or the movie is continuous, don't stop the movie.
 | 
			
		||||
  if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) ||
 | 
			
		||||
      !play_once)
 | 
			
		||||
    return;
 | 
			
		||||
  // we need this or else the last frame wont show
 | 
			
		||||
  timer->start(m_movie->nextFrameDelay());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::timer_done()
 | 
			
		||||
{
 | 
			
		||||
  this->stop();
 | 
			
		||||
  done();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::combo_resize(int w, int h)
 | 
			
		||||
{
 | 
			
		||||
  QSize f_size(w, h);
 | 
			
		||||
  this->resize(f_size);
 | 
			
		||||
  m_movie->setScaledSize(f_size);
 | 
			
		||||
}
 | 
			
		||||
#include "misc_functions.h"
 | 
			
		||||
 | 
			
		||||
AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
 | 
			
		||||
  m_movie = new QMovie();
 | 
			
		||||
 | 
			
		||||
  this->setMovie(m_movie);
 | 
			
		||||
  timer = new QTimer(this);
 | 
			
		||||
  timer->setTimerType(Qt::PreciseTimer);
 | 
			
		||||
  timer->setSingleShot(true);
 | 
			
		||||
  connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
 | 
			
		||||
  connect(timer, SIGNAL(timeout()), this, SLOT(timer_done()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::set_play_once(bool p_play_once) { play_once = p_play_once; }
 | 
			
		||||
void AOMovie::start_timer(int delay) { timer->start(delay); }
 | 
			
		||||
 | 
			
		||||
void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme,
 | 
			
		||||
                   int duration)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
  m_movie->stop();
 | 
			
		||||
  // this->timer_done();
 | 
			
		||||
  QString shout_path = p_gif;
 | 
			
		||||
  QList<QString> pathlist;
 | 
			
		||||
 | 
			
		||||
  if (ao_app->get_character_path(p_char, p_gif)
 | 
			
		||||
          .contains(
 | 
			
		||||
              "custom_objections")) // checks if the file is located within the
 | 
			
		||||
                                    // folder of custom objections
 | 
			
		||||
    pathlist << ao_app->get_character_path(
 | 
			
		||||
        p_char,
 | 
			
		||||
        p_gif); // get_image_suffix is unecessery as it is already given.
 | 
			
		||||
  else if (p_gif == "custom")
 | 
			
		||||
    pathlist << ao_app->get_image_suffix(
 | 
			
		||||
        ao_app->get_character_path(p_char, p_gif));
 | 
			
		||||
  else
 | 
			
		||||
    pathlist << ao_app->get_image_suffix(
 | 
			
		||||
        ao_app->get_character_path(p_char, p_gif + "_bubble"));
 | 
			
		||||
 | 
			
		||||
  QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" +
 | 
			
		||||
                      p_gif + "_bubble.gif";
 | 
			
		||||
  QString custom_theme_path =
 | 
			
		||||
      ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif");
 | 
			
		||||
  QString theme_path = ao_app->get_theme_path(p_gif + ".gif");
 | 
			
		||||
  QString default_theme_path = ao_app->get_default_theme_path(p_gif + ".gif");
 | 
			
		||||
  QString placeholder_path = ao_app->get_theme_path("placeholder.gif");
 | 
			
		||||
  QString default_placeholder_path =
 | 
			
		||||
      ao_app->get_default_theme_path("placeholder.gif");
 | 
			
		||||
 | 
			
		||||
  pathlist << ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" +
 | 
			
		||||
                                       p_custom_theme + "/" + p_gif + "_bubble")
 | 
			
		||||
           << // Misc path
 | 
			
		||||
      ao_app->get_image_suffix(
 | 
			
		||||
          ao_app->get_custom_theme_path(p_custom_theme, p_gif))
 | 
			
		||||
           << // Custom theme path
 | 
			
		||||
      ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)) << // Theme path
 | 
			
		||||
      ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif))
 | 
			
		||||
           << // Default theme path
 | 
			
		||||
      ao_app->get_image_suffix(ao_app->get_theme_path("placeholder"))
 | 
			
		||||
           << // Placeholder path
 | 
			
		||||
      ao_app->get_image_suffix(ao_app->get_default_theme_path(
 | 
			
		||||
          "placeholder")); // Default placeholder path
 | 
			
		||||
 | 
			
		||||
  for (QString path : pathlist) {
 | 
			
		||||
    if (file_exists(path)) {
 | 
			
		||||
      shout_path = path;
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  m_movie->setFileName(shout_path);
 | 
			
		||||
  if (m_movie->loopCount() == 0)
 | 
			
		||||
    play_once = true;
 | 
			
		||||
 | 
			
		||||
  this->show();
 | 
			
		||||
  m_movie->start();
 | 
			
		||||
  if (m_movie->frameCount() == 0 && duration > 0)
 | 
			
		||||
    timer->start(duration);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::stop()
 | 
			
		||||
{
 | 
			
		||||
  m_movie->stop();
 | 
			
		||||
  this->hide();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::frame_change(int n_frame)
 | 
			
		||||
{
 | 
			
		||||
  // If it's a "static movie" (only one frame - png image), we can't change
 | 
			
		||||
  // frames - ignore this function (use timer instead). If the frame didn't
 | 
			
		||||
  // reach the last frame or the movie is continuous, don't stop the movie.
 | 
			
		||||
  if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) ||
 | 
			
		||||
      !play_once)
 | 
			
		||||
    return;
 | 
			
		||||
  // we need this or else the last frame wont show
 | 
			
		||||
  timer->start(m_movie->nextFrameDelay());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::timer_done()
 | 
			
		||||
{
 | 
			
		||||
  this->stop();
 | 
			
		||||
  done();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMovie::combo_resize(int w, int h)
 | 
			
		||||
{
 | 
			
		||||
  QSize f_size(w, h);
 | 
			
		||||
  this->resize(f_size);
 | 
			
		||||
  m_movie->setScaledSize(f_size);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,16 +1,14 @@
 | 
			
		||||
#include "aomusicplayer.h"
 | 
			
		||||
 | 
			
		||||
#if defined(BASSAUDIO)
 | 
			
		||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
 | 
			
		||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
			
		||||
    : QObject()
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AOMusicPlayer::~AOMusicPlayer()
 | 
			
		||||
{
 | 
			
		||||
  kill_loop();
 | 
			
		||||
}
 | 
			
		||||
AOMusicPlayer::~AOMusicPlayer() { kill_loop(); }
 | 
			
		||||
 | 
			
		||||
void AOMusicPlayer::play(QString p_song)
 | 
			
		||||
{
 | 
			
		||||
@ -18,24 +16,21 @@ void AOMusicPlayer::play(QString p_song)
 | 
			
		||||
 | 
			
		||||
  f_path = ao_app->get_music_path(p_song);
 | 
			
		||||
 | 
			
		||||
  m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
 | 
			
		||||
  m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0,
 | 
			
		||||
                                   BASS_STREAM_AUTOFREE | BASS_UNICODE |
 | 
			
		||||
                                       BASS_ASYNCFILE);
 | 
			
		||||
 | 
			
		||||
  this->set_volume(m_volume);
 | 
			
		||||
 | 
			
		||||
  if (ao_app->get_audio_output_device() != "default")
 | 
			
		||||
    BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
 | 
			
		||||
  if(enable_looping)
 | 
			
		||||
  {
 | 
			
		||||
  if (enable_looping) {
 | 
			
		||||
    BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
 | 
			
		||||
  }
 | 
			
		||||
  BASS_ChannelPlay(m_stream, false);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMusicPlayer::set_volume(int p_value)
 | 
			
		||||
@ -45,27 +40,19 @@ void AOMusicPlayer::set_volume(int p_value)
 | 
			
		||||
  BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOMusicPlayer::get_path()
 | 
			
		||||
{
 | 
			
		||||
    return f_path;
 | 
			
		||||
}
 | 
			
		||||
QString AOMusicPlayer::get_path() { return f_path; }
 | 
			
		||||
 | 
			
		||||
void AOMusicPlayer::kill_loop()
 | 
			
		||||
{
 | 
			
		||||
    BASS_ChannelStop(m_stream);
 | 
			
		||||
}
 | 
			
		||||
void AOMusicPlayer::kill_loop() { BASS_ChannelStop(m_stream); }
 | 
			
		||||
 | 
			
		||||
#elif defined(QTAUDIO)
 | 
			
		||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
 | 
			
		||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
			
		||||
    : QObject()
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AOMusicPlayer::~AOMusicPlayer()
 | 
			
		||||
{
 | 
			
		||||
  m_player.stop();
 | 
			
		||||
}
 | 
			
		||||
AOMusicPlayer::~AOMusicPlayer() { m_player.stop(); }
 | 
			
		||||
 | 
			
		||||
void AOMusicPlayer::play(QString p_song)
 | 
			
		||||
{
 | 
			
		||||
@ -88,47 +75,27 @@ void AOMusicPlayer::set_volume(int p_value)
 | 
			
		||||
                                             QAudio::LogarithmicVolumeScale,
 | 
			
		||||
                                             QAudio::LinearVolumeScale);
 | 
			
		||||
 | 
			
		||||
  m_player.setVolume(linearVolume*100);
 | 
			
		||||
  m_player.setVolume(linearVolume * 100);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOMusicPlayer::get_path()
 | 
			
		||||
{
 | 
			
		||||
    return f_path;
 | 
			
		||||
}
 | 
			
		||||
QString AOMusicPlayer::get_path() { return f_path; }
 | 
			
		||||
 | 
			
		||||
void AOMusicPlayer::kill_loop()
 | 
			
		||||
{
 | 
			
		||||
    m_player.stop();
 | 
			
		||||
}
 | 
			
		||||
void AOMusicPlayer::kill_loop() { m_player.stop(); }
 | 
			
		||||
#else
 | 
			
		||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
 | 
			
		||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
 | 
			
		||||
    : QObject()
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AOMusicPlayer::~AOMusicPlayer()
 | 
			
		||||
{
 | 
			
		||||
AOMusicPlayer::~AOMusicPlayer() {}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void AOMusicPlayer::play(QString p_song) {}
 | 
			
		||||
 | 
			
		||||
void AOMusicPlayer::play(QString p_song)
 | 
			
		||||
{
 | 
			
		||||
void AOMusicPlayer::set_volume(int p_value) {}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
QString AOMusicPlayer::get_path() { return f_path; }
 | 
			
		||||
 | 
			
		||||
void AOMusicPlayer::set_volume(int p_value)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOMusicPlayer::get_path()
 | 
			
		||||
{
 | 
			
		||||
    return f_path;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOMusicPlayer::kill_loop()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void AOMusicPlayer::kill_loop() {}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -8,8 +8,7 @@ AOPacket::AOPacket(QString p_packet_string)
 | 
			
		||||
 | 
			
		||||
  m_header = packet_contents.at(0);
 | 
			
		||||
 | 
			
		||||
  for(int n_string = 1 ; n_string < packet_contents.size() - 1 ; ++n_string)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n_string = 1; n_string < packet_contents.size() - 1; ++n_string) {
 | 
			
		||||
    m_contents.append(packet_contents.at(n_string));
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -20,23 +19,18 @@ AOPacket::AOPacket(QString p_header, QStringList &p_contents)
 | 
			
		||||
  m_contents = p_contents;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
AOPacket::~AOPacket()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
AOPacket::~AOPacket() {}
 | 
			
		||||
 | 
			
		||||
QString AOPacket::to_string()
 | 
			
		||||
{
 | 
			
		||||
  QString f_string = m_header;
 | 
			
		||||
 | 
			
		||||
  for (QString i_string : m_contents)
 | 
			
		||||
  {
 | 
			
		||||
  for (QString i_string : m_contents) {
 | 
			
		||||
    f_string += ("#" + i_string);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  f_string += "#%";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  if (encrypted)
 | 
			
		||||
    return "#" + f_string;
 | 
			
		||||
  else
 | 
			
		||||
@ -59,10 +53,12 @@ void AOPacket::decrypt_header(unsigned int p_key)
 | 
			
		||||
 | 
			
		||||
void AOPacket::net_encode()
 | 
			
		||||
{
 | 
			
		||||
  for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n_element = 0; n_element < m_contents.size(); ++n_element) {
 | 
			
		||||
    QString f_element = m_contents.at(n_element);
 | 
			
		||||
    f_element.replace("#", "<num>").replace("%", "<percent>").replace("$", "<dollar>").replace("&", "<and>");
 | 
			
		||||
    f_element.replace("#", "<num>")
 | 
			
		||||
        .replace("%", "<percent>")
 | 
			
		||||
        .replace("$", "<dollar>")
 | 
			
		||||
        .replace("&", "<and>");
 | 
			
		||||
 | 
			
		||||
    m_contents.removeAt(n_element);
 | 
			
		||||
    m_contents.insert(n_element, f_element);
 | 
			
		||||
@ -71,13 +67,14 @@ void AOPacket::net_encode()
 | 
			
		||||
 | 
			
		||||
void AOPacket::net_decode()
 | 
			
		||||
{
 | 
			
		||||
  for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n_element = 0; n_element < m_contents.size(); ++n_element) {
 | 
			
		||||
    QString f_element = m_contents.at(n_element);
 | 
			
		||||
    f_element.replace("<num>", "#").replace("<percent>", "%").replace("<dollar>", "$").replace("<and>", "&");
 | 
			
		||||
    f_element.replace("<num>", "#")
 | 
			
		||||
        .replace("<percent>", "%")
 | 
			
		||||
        .replace("<dollar>", "$")
 | 
			
		||||
        .replace("<and>", "&");
 | 
			
		||||
 | 
			
		||||
    m_contents.removeAt(n_element);
 | 
			
		||||
    m_contents.insert(n_element, f_element);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,8 +1,8 @@
 | 
			
		||||
#include "aosfxplayer.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
#if defined(BASSAUDIO) //Using bass.dll for sfx
 | 
			
		||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
 | 
			
		||||
#if defined(BASSAUDIO) // Using bass.dll for sfx
 | 
			
		||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject()
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
@ -11,7 +11,7 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
 | 
			
		||||
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
 | 
			
		||||
{
 | 
			
		||||
  BASS_ChannelStop(m_stream);
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
  QString misc_path = "";
 | 
			
		||||
  QString char_path = "";
 | 
			
		||||
  QString sound_path = ao_app->get_sounds_path(p_sfx);
 | 
			
		||||
@ -24,38 +24,35 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
 | 
			
		||||
  QString f_path;
 | 
			
		||||
 | 
			
		||||
  if (file_exists(char_path))
 | 
			
		||||
      f_path = char_path;
 | 
			
		||||
    f_path = char_path;
 | 
			
		||||
  else if (file_exists(misc_path))
 | 
			
		||||
    f_path = misc_path;
 | 
			
		||||
  else
 | 
			
		||||
    f_path = sound_path;
 | 
			
		||||
  BASS_ChannelStop(m_stream);
 | 
			
		||||
  m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
 | 
			
		||||
  m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0,
 | 
			
		||||
                                   BASS_STREAM_AUTOFREE | BASS_UNICODE |
 | 
			
		||||
                                       BASS_ASYNCFILE);
 | 
			
		||||
 | 
			
		||||
  set_volume_internal(m_volume);
 | 
			
		||||
 | 
			
		||||
  if (ao_app->get_audio_output_device() != "default")
 | 
			
		||||
    BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
 | 
			
		||||
  BASS_ChannelPlay(m_stream, false);
 | 
			
		||||
  if(looping_sfx && ao_app->get_looping_sfx())
 | 
			
		||||
  {
 | 
			
		||||
  if (looping_sfx && ao_app->get_looping_sfx()) {
 | 
			
		||||
    BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::setLooping(bool is_looping)
 | 
			
		||||
{
 | 
			
		||||
    this->looping_sfx = is_looping;
 | 
			
		||||
  this->looping_sfx = is_looping;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::stop()
 | 
			
		||||
{
 | 
			
		||||
  BASS_ChannelStop(m_stream);
 | 
			
		||||
}
 | 
			
		||||
void AOSfxPlayer::stop() { BASS_ChannelStop(m_stream); }
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::set_volume(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
@ -65,11 +62,11 @@ void AOSfxPlayer::set_volume(qreal p_value)
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::set_volume_internal(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
    float volume = p_value;
 | 
			
		||||
    BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
 | 
			
		||||
  float volume = p_value;
 | 
			
		||||
  BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
 | 
			
		||||
}
 | 
			
		||||
#elif defined(QTAUDIO) //Using Qt's QSoundEffect class
 | 
			
		||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
 | 
			
		||||
#elif defined(QTAUDIO) // Using Qt's QSoundEffect class
 | 
			
		||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject()
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
@ -91,35 +88,32 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
 | 
			
		||||
  QString f_path;
 | 
			
		||||
 | 
			
		||||
  if (file_exists(char_path))
 | 
			
		||||
      f_path = char_path;
 | 
			
		||||
    f_path = char_path;
 | 
			
		||||
  else if (file_exists(misc_path))
 | 
			
		||||
    f_path = misc_path;
 | 
			
		||||
  else
 | 
			
		||||
    f_path = sound_path;
 | 
			
		||||
 | 
			
		||||
  if (file_exists(f_path)) //if its missing, it will glitch out
 | 
			
		||||
  if (file_exists(f_path)) // if its missing, it will glitch out
 | 
			
		||||
  {
 | 
			
		||||
  m_sfx.setSource(QUrl::fromLocalFile(f_path));
 | 
			
		||||
    m_sfx.setSource(QUrl::fromLocalFile(f_path));
 | 
			
		||||
 | 
			
		||||
  set_volume_internal(m_volume);
 | 
			
		||||
    set_volume_internal(m_volume);
 | 
			
		||||
 | 
			
		||||
  m_sfx.play();
 | 
			
		||||
    m_sfx.play();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::setLooping(bool is_looping)
 | 
			
		||||
{
 | 
			
		||||
    this->looping_sfx = is_looping;
 | 
			
		||||
  this->looping_sfx = is_looping;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::stop()
 | 
			
		||||
{
 | 
			
		||||
  m_sfx.stop();
 | 
			
		||||
}
 | 
			
		||||
void AOSfxPlayer::stop() { m_sfx.stop(); }
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::set_volume(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
  m_volume = p_value/100;
 | 
			
		||||
  m_volume = p_value / 100;
 | 
			
		||||
  set_volume_internal(m_volume);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -128,34 +122,22 @@ void AOSfxPlayer::set_volume_internal(qreal p_value)
 | 
			
		||||
  m_sfx.setVolume(m_volume);
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
 | 
			
		||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject()
 | 
			
		||||
{
 | 
			
		||||
  m_parent = parent;
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) {}
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::setLooping(bool is_looping)
 | 
			
		||||
{
 | 
			
		||||
    this->looping_sfx = is_looping;
 | 
			
		||||
  this->looping_sfx = is_looping;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::stop()
 | 
			
		||||
{
 | 
			
		||||
void AOSfxPlayer::stop() {}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void AOSfxPlayer::set_volume(qreal p_value) {}
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::set_volume(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOSfxPlayer::set_volume_internal(qreal p_value)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void AOSfxPlayer::set_volume_internal(qreal p_value) {}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -1,16 +1,14 @@
 | 
			
		||||
#include "aotextarea.h"
 | 
			
		||||
 | 
			
		||||
AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) {}
 | 
			
		||||
 | 
			
		||||
void AOTextArea::append_chatmessage(QString p_name, QString p_message,
 | 
			
		||||
                                    QString p_colour, bool song)
 | 
			
		||||
{
 | 
			
		||||
  const QTextCursor old_cursor = this->textCursor();
 | 
			
		||||
  const int old_scrollbar_value = this->verticalScrollBar()->value();
 | 
			
		||||
  const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum();
 | 
			
		||||
  const bool is_scrolled_down =
 | 
			
		||||
      old_scrollbar_value == this->verticalScrollBar()->maximum();
 | 
			
		||||
 | 
			
		||||
  this->moveCursor(QTextCursor::End);
 | 
			
		||||
 | 
			
		||||
@ -22,9 +20,11 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message,
 | 
			
		||||
    this->insertHtml("<b><font color=" + p_colour + ">" +
 | 
			
		||||
                     p_name.toHtmlEscaped() + "</font></b>: ");
 | 
			
		||||
 | 
			
		||||
  //cheap workarounds ahoy
 | 
			
		||||
  // cheap workarounds ahoy
 | 
			
		||||
  p_message += " ";
 | 
			
		||||
  QString result = p_message.toHtmlEscaped().replace("\n", "<br>").replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>" );
 | 
			
		||||
  QString result = p_message.toHtmlEscaped()
 | 
			
		||||
                       .replace("\n", "<br>")
 | 
			
		||||
                       .replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>");
 | 
			
		||||
 | 
			
		||||
  this->insertHtml(result);
 | 
			
		||||
 | 
			
		||||
@ -35,32 +35,35 @@ void AOTextArea::append_error(QString p_message)
 | 
			
		||||
{
 | 
			
		||||
  const QTextCursor old_cursor = this->textCursor();
 | 
			
		||||
  const int old_scrollbar_value = this->verticalScrollBar()->value();
 | 
			
		||||
  const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum();
 | 
			
		||||
  const bool is_scrolled_down =
 | 
			
		||||
      old_scrollbar_value == this->verticalScrollBar()->maximum();
 | 
			
		||||
 | 
			
		||||
  this->moveCursor(QTextCursor::End);
 | 
			
		||||
 | 
			
		||||
  this->append("");
 | 
			
		||||
 | 
			
		||||
  p_message += " ";
 | 
			
		||||
  QString result = p_message.replace("\n", "<br>").replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>" );
 | 
			
		||||
  QString result = p_message.replace("\n", "<br>")
 | 
			
		||||
                       .replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>");
 | 
			
		||||
 | 
			
		||||
  this->insertHtml("<font color='red'>" + result + "</font>");
 | 
			
		||||
 | 
			
		||||
  this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOTextArea::auto_scroll(QTextCursor old_cursor, int old_scrollbar_value, bool is_scrolled_down)
 | 
			
		||||
void AOTextArea::auto_scroll(QTextCursor old_cursor, int old_scrollbar_value,
 | 
			
		||||
                             bool is_scrolled_down)
 | 
			
		||||
{
 | 
			
		||||
  if (old_cursor.hasSelection() || !is_scrolled_down)
 | 
			
		||||
  {
 | 
			
		||||
      // The user has selected text or scrolled away from the bottom: maintain position.
 | 
			
		||||
      this->setTextCursor(old_cursor);
 | 
			
		||||
      this->verticalScrollBar()->setValue(old_scrollbar_value);
 | 
			
		||||
  if (old_cursor.hasSelection() || !is_scrolled_down) {
 | 
			
		||||
    // The user has selected text or scrolled away from the bottom: maintain
 | 
			
		||||
    // position.
 | 
			
		||||
    this->setTextCursor(old_cursor);
 | 
			
		||||
    this->verticalScrollBar()->setValue(old_scrollbar_value);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
      // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom.
 | 
			
		||||
      this->moveCursor(QTextCursor::End);
 | 
			
		||||
      this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum());
 | 
			
		||||
  else {
 | 
			
		||||
    // The user hasn't selected any text and the scrollbar is at the bottom:
 | 
			
		||||
    // scroll to the bottom.
 | 
			
		||||
    this->moveCursor(QTextCursor::End);
 | 
			
		||||
    this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@ AOTextEdit::AOTextEdit(QWidget *parent) : QPlainTextEdit(parent)
 | 
			
		||||
{
 | 
			
		||||
  this->setReadOnly(true);
 | 
			
		||||
 | 
			
		||||
  //connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed()));
 | 
			
		||||
  // connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
 | 
			
		||||
@ -14,8 +14,4 @@ void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
 | 
			
		||||
  this->setReadOnly(false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOTextEdit::on_enter_pressed()
 | 
			
		||||
{
 | 
			
		||||
  this->setReadOnly(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void AOTextEdit::on_enter_pressed() { this->setReadOnly(true); }
 | 
			
		||||
 | 
			
		||||
@ -1,12 +1,11 @@
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
#include "lobby.h"
 | 
			
		||||
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include "debug_functions.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
#include "hardware_functions.h"
 | 
			
		||||
 | 
			
		||||
class AOCharSelectGenerationThreading : public QRunnable
 | 
			
		||||
{
 | 
			
		||||
class AOCharSelectGenerationThreading : public QRunnable {
 | 
			
		||||
public:
 | 
			
		||||
  Courtroom *thisCourtroom;
 | 
			
		||||
  int char_num;
 | 
			
		||||
@ -93,28 +92,36 @@ void Courtroom::construct_char_select()
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_char_buttons, "char_buttons");
 | 
			
		||||
 | 
			
		||||
  connect(char_button_mapper, SIGNAL(mapped(int)), this, SLOT(char_clicked(int)));
 | 
			
		||||
  connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked()));
 | 
			
		||||
  connect(char_button_mapper, SIGNAL(mapped(int)), this,
 | 
			
		||||
          SLOT(char_clicked(int)));
 | 
			
		||||
  connect(ui_back_to_lobby, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_back_to_lobby_clicked()));
 | 
			
		||||
 | 
			
		||||
  connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked()));
 | 
			
		||||
  connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked()));
 | 
			
		||||
  connect(ui_char_select_left, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_char_select_left_clicked()));
 | 
			
		||||
  connect(ui_char_select_right, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_char_select_right_clicked()));
 | 
			
		||||
 | 
			
		||||
  connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked()));
 | 
			
		||||
 | 
			
		||||
  connect(ui_char_search, SIGNAL(textEdited(const QString&)), this, SLOT(on_char_search_changed()));
 | 
			
		||||
  connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, SLOT(on_char_passworded_clicked()));
 | 
			
		||||
  connect(ui_char_taken, SIGNAL(stateChanged(int)), this, SLOT(on_char_taken_clicked()));
 | 
			
		||||
  connect(ui_char_search, SIGNAL(textEdited(const QString &)), this,
 | 
			
		||||
          SLOT(on_char_search_changed()));
 | 
			
		||||
  connect(ui_char_passworded, SIGNAL(stateChanged(int)), this,
 | 
			
		||||
          SLOT(on_char_passworded_clicked()));
 | 
			
		||||
  connect(ui_char_taken, SIGNAL(stateChanged(int)), this,
 | 
			
		||||
          SLOT(on_char_taken_clicked()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::set_char_select()
 | 
			
		||||
{
 | 
			
		||||
  QString filename = "courtroom_design.ini";
 | 
			
		||||
 | 
			
		||||
  pos_size_type f_charselect = ao_app->get_element_dimensions("char_select", filename);
 | 
			
		||||
  pos_size_type f_charselect =
 | 
			
		||||
      ao_app->get_element_dimensions("char_select", filename);
 | 
			
		||||
 | 
			
		||||
  if (f_charselect.width < 0 || f_charselect.height < 0)
 | 
			
		||||
  {
 | 
			
		||||
    qDebug() << "W: did not find courtroom width or height in courtroom_design.ini!";
 | 
			
		||||
  if (f_charselect.width < 0 || f_charselect.height < 0) {
 | 
			
		||||
    qDebug()
 | 
			
		||||
        << "W: did not find courtroom width or height in courtroom_design.ini!";
 | 
			
		||||
    this->resize(714, 668);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
@ -135,25 +142,22 @@ void Courtroom::set_char_select_page()
 | 
			
		||||
  ui_char_select_left->hide();
 | 
			
		||||
  ui_char_select_right->hide();
 | 
			
		||||
 | 
			
		||||
  for (AOCharButton *i_button : ui_char_button_list)
 | 
			
		||||
  {
 | 
			
		||||
  for (AOCharButton *i_button : ui_char_button_list) {
 | 
			
		||||
    i_button->reset();
 | 
			
		||||
    i_button->hide();
 | 
			
		||||
    i_button->move(0,0);
 | 
			
		||||
    i_button->move(0, 0);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  int total_pages = ui_char_button_list_filtered.size() / max_chars_on_page;
 | 
			
		||||
  int chars_on_page = 0;
 | 
			
		||||
 | 
			
		||||
  if (ui_char_button_list_filtered.size() % max_chars_on_page != 0)
 | 
			
		||||
  {
 | 
			
		||||
  if (ui_char_button_list_filtered.size() % max_chars_on_page != 0) {
 | 
			
		||||
    ++total_pages;
 | 
			
		||||
    //i. e. not on the last page
 | 
			
		||||
    // i. e. not on the last page
 | 
			
		||||
    if (total_pages > current_char_page + 1)
 | 
			
		||||
      chars_on_page = max_chars_on_page;
 | 
			
		||||
    else
 | 
			
		||||
      chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page;
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    chars_on_page = max_chars_on_page;
 | 
			
		||||
@ -169,24 +173,25 @@ void Courtroom::set_char_select_page()
 | 
			
		||||
 | 
			
		||||
void Courtroom::char_clicked(int n_char)
 | 
			
		||||
{
 | 
			
		||||
  QString char_ini_path = ao_app->get_character_path(char_list.at(n_char).name, "char.ini");
 | 
			
		||||
  QString char_ini_path =
 | 
			
		||||
      ao_app->get_character_path(char_list.at(n_char).name, "char.ini");
 | 
			
		||||
 | 
			
		||||
  qDebug() << "char_ini_path" << char_ini_path;
 | 
			
		||||
 | 
			
		||||
  if (!file_exists(char_ini_path))
 | 
			
		||||
  {
 | 
			
		||||
  if (!file_exists(char_ini_path)) {
 | 
			
		||||
    call_notice(tr("Could not find %1").arg(char_ini_path, 1));
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (n_char == m_cid)
 | 
			
		||||
  {
 | 
			
		||||
  if (n_char == m_cid) {
 | 
			
		||||
    enter_courtroom(m_cid);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    ao_app->send_server_packet(new AOPacket("PW#" + ui_char_password->text() + "#%"));
 | 
			
		||||
    ao_app->send_server_packet(new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" + QString::number(n_char) + "#" + get_hdid() + "#%"));
 | 
			
		||||
  else {
 | 
			
		||||
    ao_app->send_server_packet(
 | 
			
		||||
        new AOPacket("PW#" + ui_char_password->text() + "#%"));
 | 
			
		||||
    ao_app->send_server_packet(
 | 
			
		||||
        new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" +
 | 
			
		||||
                     QString::number(n_char) + "#" + get_hdid() + "#%"));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name);
 | 
			
		||||
@ -194,53 +199,55 @@ void Courtroom::char_clicked(int n_char)
 | 
			
		||||
 | 
			
		||||
void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
 | 
			
		||||
{
 | 
			
		||||
    if (ui_char_button_list_filtered.size() == 0)
 | 
			
		||||
        return;
 | 
			
		||||
  if (ui_char_button_list_filtered.size() == 0)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
    QPoint f_spacing = ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini");
 | 
			
		||||
  QPoint f_spacing =
 | 
			
		||||
      ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini");
 | 
			
		||||
 | 
			
		||||
    int x_spacing = f_spacing.x();
 | 
			
		||||
    int x_mod_count = 0;
 | 
			
		||||
  int x_spacing = f_spacing.x();
 | 
			
		||||
  int x_mod_count = 0;
 | 
			
		||||
 | 
			
		||||
    int y_spacing = f_spacing.y();
 | 
			
		||||
    int y_mod_count = 0;
 | 
			
		||||
  int y_spacing = f_spacing.y();
 | 
			
		||||
  int y_mod_count = 0;
 | 
			
		||||
 | 
			
		||||
    char_columns = ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) + 1;
 | 
			
		||||
    char_rows = ((ui_char_buttons->height() - button_height) / (y_spacing + button_height)) + 1;
 | 
			
		||||
  char_columns =
 | 
			
		||||
      ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) +
 | 
			
		||||
      1;
 | 
			
		||||
  char_rows = ((ui_char_buttons->height() - button_height) /
 | 
			
		||||
               (y_spacing + button_height)) +
 | 
			
		||||
              1;
 | 
			
		||||
 | 
			
		||||
    max_chars_on_page = char_columns * char_rows;
 | 
			
		||||
  max_chars_on_page = char_columns * char_rows;
 | 
			
		||||
 | 
			
		||||
    int startout = starting;
 | 
			
		||||
    for (int n = starting ; n < startout+chars_on_this_page ; ++n)
 | 
			
		||||
    {
 | 
			
		||||
      int x_pos = (button_width + x_spacing) * x_mod_count;
 | 
			
		||||
      int y_pos = (button_height + y_spacing) * y_mod_count;
 | 
			
		||||
  int startout = starting;
 | 
			
		||||
  for (int n = starting; n < startout + chars_on_this_page; ++n) {
 | 
			
		||||
    int x_pos = (button_width + x_spacing) * x_mod_count;
 | 
			
		||||
    int y_pos = (button_height + y_spacing) * y_mod_count;
 | 
			
		||||
 | 
			
		||||
      ui_char_button_list_filtered.at(n)->move(x_pos, y_pos);
 | 
			
		||||
      ui_char_button_list_filtered.at(n)->show();
 | 
			
		||||
      ui_char_button_list_filtered.at(n)->apply_taken_image();
 | 
			
		||||
    ui_char_button_list_filtered.at(n)->move(x_pos, y_pos);
 | 
			
		||||
    ui_char_button_list_filtered.at(n)->show();
 | 
			
		||||
    ui_char_button_list_filtered.at(n)->apply_taken_image();
 | 
			
		||||
 | 
			
		||||
      ++x_mod_count;
 | 
			
		||||
    ++x_mod_count;
 | 
			
		||||
 | 
			
		||||
      if (x_mod_count == char_columns)
 | 
			
		||||
      {
 | 
			
		||||
        ++y_mod_count;
 | 
			
		||||
        x_mod_count = 0;
 | 
			
		||||
      }
 | 
			
		||||
    if (x_mod_count == char_columns) {
 | 
			
		||||
      ++y_mod_count;
 | 
			
		||||
      x_mod_count = 0;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::character_loading_finished()
 | 
			
		||||
{
 | 
			
		||||
    // Zeroeth, we'll clear any leftover characters from previous server visits.
 | 
			
		||||
    ao_app->generated_chars = 0;
 | 
			
		||||
    if (ui_char_button_list.size() > 0)
 | 
			
		||||
    {
 | 
			
		||||
        foreach (AOCharButton* item, ui_char_button_list) {
 | 
			
		||||
            delete item;
 | 
			
		||||
        }
 | 
			
		||||
        ui_char_button_list.clear();
 | 
			
		||||
  // Zeroeth, we'll clear any leftover characters from previous server visits.
 | 
			
		||||
  ao_app->generated_chars = 0;
 | 
			
		||||
  if (ui_char_button_list.size() > 0) {
 | 
			
		||||
    foreach (AOCharButton *item, ui_char_button_list) {
 | 
			
		||||
      delete item;
 | 
			
		||||
    }
 | 
			
		||||
    ui_char_button_list.clear();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // First, we'll make all the character buttons in the very beginning.
 | 
			
		||||
  // Since we can't trust what will happen during the multi threading process,
 | 
			
		||||
@ -278,17 +285,8 @@ void Courtroom::filter_character_list()
 | 
			
		||||
  set_char_select_page();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::on_char_search_changed()
 | 
			
		||||
{
 | 
			
		||||
    filter_character_list();
 | 
			
		||||
}
 | 
			
		||||
void Courtroom::on_char_search_changed() { filter_character_list(); }
 | 
			
		||||
 | 
			
		||||
void Courtroom::on_char_passworded_clicked()
 | 
			
		||||
{
 | 
			
		||||
    filter_character_list();
 | 
			
		||||
}
 | 
			
		||||
void Courtroom::on_char_passworded_clicked() { filter_character_list(); }
 | 
			
		||||
 | 
			
		||||
void Courtroom::on_char_taken_clicked()
 | 
			
		||||
{
 | 
			
		||||
    filter_character_list();
 | 
			
		||||
}
 | 
			
		||||
void Courtroom::on_char_taken_clicked() { filter_character_list(); }
 | 
			
		||||
 | 
			
		||||
@ -33,36 +33,17 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname,
 | 
			
		||||
  datetime = p_datetime.toUTC();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString chatlogpiece::get_name()
 | 
			
		||||
{
 | 
			
		||||
  return name;
 | 
			
		||||
}
 | 
			
		||||
QString chatlogpiece::get_name() { return name; }
 | 
			
		||||
 | 
			
		||||
QString chatlogpiece::get_showname()
 | 
			
		||||
{
 | 
			
		||||
  return showname;
 | 
			
		||||
}
 | 
			
		||||
QString chatlogpiece::get_showname() { return showname; }
 | 
			
		||||
 | 
			
		||||
QString chatlogpiece::get_message()
 | 
			
		||||
{
 | 
			
		||||
  return message;
 | 
			
		||||
}
 | 
			
		||||
QString chatlogpiece::get_message() { return message; }
 | 
			
		||||
 | 
			
		||||
QDateTime chatlogpiece::get_datetime()
 | 
			
		||||
{
 | 
			
		||||
  return datetime;
 | 
			
		||||
}
 | 
			
		||||
QDateTime chatlogpiece::get_datetime() { return datetime; }
 | 
			
		||||
 | 
			
		||||
bool chatlogpiece::get_is_song()
 | 
			
		||||
{
 | 
			
		||||
  return is_song;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString chatlogpiece::get_datetime_as_string()
 | 
			
		||||
{
 | 
			
		||||
  return datetime.toString();
 | 
			
		||||
}
 | 
			
		||||
bool chatlogpiece::get_is_song() { return is_song; }
 | 
			
		||||
 | 
			
		||||
QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); }
 | 
			
		||||
int chatlogpiece::get_chat_color() { return color; }
 | 
			
		||||
 | 
			
		||||
QString chatlogpiece::get_full()
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										7346
									
								
								src/courtroom.cpp
									
									
									
									
									
								
							
							
						
						
									
										7346
									
								
								src/courtroom.cpp
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1,5 +1,5 @@
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
#include <QCoreApplication>
 | 
			
		||||
#include <QMessageBox>
 | 
			
		||||
 | 
			
		||||
#include "debug_functions.h"
 | 
			
		||||
 | 
			
		||||
@ -7,11 +7,12 @@ void call_error(QString p_message)
 | 
			
		||||
{
 | 
			
		||||
  QMessageBox *msgBox = new QMessageBox;
 | 
			
		||||
 | 
			
		||||
  msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1").arg(p_message));
 | 
			
		||||
  msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Error"));
 | 
			
		||||
  msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1")
 | 
			
		||||
                      .arg(p_message));
 | 
			
		||||
  msgBox->setWindowTitle(
 | 
			
		||||
      QCoreApplication::translate("debug_functions", "Error"));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  //msgBox->setWindowModality(Qt::NonModal);
 | 
			
		||||
  // msgBox->setWindowModality(Qt::NonModal);
 | 
			
		||||
  msgBox->exec();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -20,9 +21,10 @@ void call_notice(QString p_message)
 | 
			
		||||
  QMessageBox *msgBox = new QMessageBox;
 | 
			
		||||
 | 
			
		||||
  msgBox->setText(p_message);
 | 
			
		||||
  msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Notice"));
 | 
			
		||||
 | 
			
		||||
  msgBox->setWindowTitle(
 | 
			
		||||
      QCoreApplication::translate("debug_functions", "Notice"));
 | 
			
		||||
 | 
			
		||||
  //msgBox->setWindowModality(Qt::NonModal);
 | 
			
		||||
  // msgBox->setWindowModality(Qt::NonModal);
 | 
			
		||||
  msgBox->exec();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -8,23 +8,18 @@ Discord::Discord()
 | 
			
		||||
  DiscordEventHandlers handlers;
 | 
			
		||||
  std::memset(&handlers, 0, sizeof(handlers));
 | 
			
		||||
  handlers = {};
 | 
			
		||||
  handlers.ready = [] {
 | 
			
		||||
    qInfo() << "Discord RPC ready";
 | 
			
		||||
  };
 | 
			
		||||
  handlers.disconnected = [](int errorCode, const char* message) {
 | 
			
		||||
  handlers.ready = [] { qInfo() << "Discord RPC ready"; };
 | 
			
		||||
  handlers.disconnected = [](int errorCode, const char *message) {
 | 
			
		||||
    qInfo() << "Discord RPC disconnected! " << message << errorCode;
 | 
			
		||||
  };
 | 
			
		||||
  handlers.errored = [](int errorCode, const char* message) {
 | 
			
		||||
  handlers.errored = [](int errorCode, const char *message) {
 | 
			
		||||
    qWarning() << "Discord RPC errored out! " << message << errorCode;
 | 
			
		||||
  };
 | 
			
		||||
  qInfo() << "Initializing Discord RPC";
 | 
			
		||||
  Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Discord::~Discord()
 | 
			
		||||
{
 | 
			
		||||
  Discord_Shutdown();
 | 
			
		||||
}
 | 
			
		||||
Discord::~Discord() { Discord_Shutdown(); }
 | 
			
		||||
 | 
			
		||||
void Discord::state_lobby()
 | 
			
		||||
{
 | 
			
		||||
@ -64,10 +59,12 @@ void Discord::state_server(std::string name, std::string server_id)
 | 
			
		||||
 | 
			
		||||
void Discord::state_character(std::string name)
 | 
			
		||||
{
 | 
			
		||||
  auto name_internal = QString(name.c_str()).toLower().replace(' ', '_').toStdString();
 | 
			
		||||
  auto name_internal =
 | 
			
		||||
      QString(name.c_str()).toLower().replace(' ', '_').toStdString();
 | 
			
		||||
  auto name_friendly = QString(name.c_str()).replace('_', ' ').toStdString();
 | 
			
		||||
  const std::string playing_as = "Playing as " + name_friendly;
 | 
			
		||||
  qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str() << ")";
 | 
			
		||||
  qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str()
 | 
			
		||||
           << ")";
 | 
			
		||||
 | 
			
		||||
  DiscordRichPresence presence;
 | 
			
		||||
  std::memset(&presence, 0, sizeof(presence));
 | 
			
		||||
@ -101,20 +98,11 @@ void Discord::state_spectate()
 | 
			
		||||
  Discord_UpdatePresence(&presence);
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
Discord::Discord()
 | 
			
		||||
{
 | 
			
		||||
Discord::Discord() {}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
Discord::~Discord() {}
 | 
			
		||||
 | 
			
		||||
Discord::~Discord()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Discord::state_lobby()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void Discord::state_lobby() {}
 | 
			
		||||
 | 
			
		||||
void Discord::state_server(std::string name, std::string server_id)
 | 
			
		||||
{
 | 
			
		||||
@ -129,7 +117,6 @@ void Discord::state_character(std::string name)
 | 
			
		||||
void Discord::state_spectate()
 | 
			
		||||
{
 | 
			
		||||
  qDebug() << "Discord RPC: Setting specator state";
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
} // namespace AttorneyOnline
 | 
			
		||||
 | 
			
		||||
@ -8,7 +8,8 @@ void Courtroom::construct_emotes()
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_emotes, "emotes");
 | 
			
		||||
 | 
			
		||||
  QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini");
 | 
			
		||||
  QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing",
 | 
			
		||||
                                                "courtroom_design.ini");
 | 
			
		||||
 | 
			
		||||
  const int button_width = 40;
 | 
			
		||||
  int x_spacing = f_spacing.x();
 | 
			
		||||
@ -18,13 +19,14 @@ void Courtroom::construct_emotes()
 | 
			
		||||
  int y_spacing = f_spacing.y();
 | 
			
		||||
  int y_mod_count = 0;
 | 
			
		||||
 | 
			
		||||
  emote_columns = ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1;
 | 
			
		||||
  emote_rows = ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1;
 | 
			
		||||
  emote_columns =
 | 
			
		||||
      ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1;
 | 
			
		||||
  emote_rows =
 | 
			
		||||
      ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1;
 | 
			
		||||
 | 
			
		||||
  max_emotes_on_page = emote_columns * emote_rows;
 | 
			
		||||
 | 
			
		||||
  for (int n = 0 ; n < max_emotes_on_page ; ++n)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n = 0; n < max_emotes_on_page; ++n) {
 | 
			
		||||
    int x_pos = (button_width + x_spacing) * x_mod_count;
 | 
			
		||||
    int y_pos = (button_height + y_spacing) * y_mod_count;
 | 
			
		||||
 | 
			
		||||
@ -34,12 +36,12 @@ void Courtroom::construct_emotes()
 | 
			
		||||
 | 
			
		||||
    f_emote->set_id(n);
 | 
			
		||||
 | 
			
		||||
    connect(f_emote, SIGNAL(emote_clicked(int)), this, SLOT(on_emote_clicked(int)));
 | 
			
		||||
    connect(f_emote, SIGNAL(emote_clicked(int)), this,
 | 
			
		||||
            SLOT(on_emote_clicked(int)));
 | 
			
		||||
 | 
			
		||||
    ++x_mod_count;
 | 
			
		||||
 | 
			
		||||
    if (x_mod_count == emote_columns)
 | 
			
		||||
    {
 | 
			
		||||
    if (x_mod_count == emote_columns) {
 | 
			
		||||
      ++y_mod_count;
 | 
			
		||||
      x_mod_count = 0;
 | 
			
		||||
    }
 | 
			
		||||
@ -56,23 +58,20 @@ void Courtroom::set_emote_page()
 | 
			
		||||
  ui_emote_left->hide();
 | 
			
		||||
  ui_emote_right->hide();
 | 
			
		||||
 | 
			
		||||
  for (AOEmoteButton *i_button : ui_emote_list)
 | 
			
		||||
  {
 | 
			
		||||
  for (AOEmoteButton *i_button : ui_emote_list) {
 | 
			
		||||
    i_button->hide();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  int total_pages = total_emotes / max_emotes_on_page;
 | 
			
		||||
  int emotes_on_page = 0;
 | 
			
		||||
 | 
			
		||||
  if (total_emotes % max_emotes_on_page != 0)
 | 
			
		||||
  {
 | 
			
		||||
  if (total_emotes % max_emotes_on_page != 0) {
 | 
			
		||||
    ++total_pages;
 | 
			
		||||
    //i. e. not on the last page
 | 
			
		||||
    // i. e. not on the last page
 | 
			
		||||
    if (total_pages > current_emote_page + 1)
 | 
			
		||||
      emotes_on_page = max_emotes_on_page;
 | 
			
		||||
    else
 | 
			
		||||
      emotes_on_page = total_emotes % max_emotes_on_page;
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    emotes_on_page = max_emotes_on_page;
 | 
			
		||||
@ -83,8 +82,7 @@ void Courtroom::set_emote_page()
 | 
			
		||||
  if (current_emote_page > 0)
 | 
			
		||||
    ui_emote_left->show();
 | 
			
		||||
 | 
			
		||||
  for (int n_emote = 0 ; n_emote < emotes_on_page ; ++n_emote)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n_emote = 0; n_emote < emotes_on_page; ++n_emote) {
 | 
			
		||||
    int n_real_emote = n_emote + current_emote_page * max_emotes_on_page;
 | 
			
		||||
    AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
 | 
			
		||||
 | 
			
		||||
@ -95,7 +93,6 @@ void Courtroom::set_emote_page()
 | 
			
		||||
 | 
			
		||||
    f_emote->show();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::set_emote_dropdown()
 | 
			
		||||
@ -105,8 +102,7 @@ void Courtroom::set_emote_dropdown()
 | 
			
		||||
  int total_emotes = ao_app->get_emote_number(current_char);
 | 
			
		||||
  QStringList emote_list;
 | 
			
		||||
 | 
			
		||||
  for (int n = 0 ; n < total_emotes ; ++n)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n = 0; n < total_emotes; ++n) {
 | 
			
		||||
    emote_list.append(ao_app->get_emote_comment(current_char, n));
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -119,19 +115,20 @@ void Courtroom::select_emote(int p_id)
 | 
			
		||||
  int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page;
 | 
			
		||||
 | 
			
		||||
  if (current_emote >= min && current_emote <= max)
 | 
			
		||||
    ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_off.png");
 | 
			
		||||
    ui_emote_list.at(current_emote % max_emotes_on_page)
 | 
			
		||||
        ->set_image(current_char, current_emote, "_off.png");
 | 
			
		||||
 | 
			
		||||
  int old_emote = current_emote;
 | 
			
		||||
 | 
			
		||||
  current_emote = p_id;
 | 
			
		||||
 | 
			
		||||
  if (current_emote >= min && current_emote <= max)
 | 
			
		||||
    ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png");
 | 
			
		||||
    ui_emote_list.at(current_emote % max_emotes_on_page)
 | 
			
		||||
        ->set_image(current_char, current_emote, "_on.png");
 | 
			
		||||
 | 
			
		||||
  int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
 | 
			
		||||
 | 
			
		||||
  if (old_emote == current_emote)
 | 
			
		||||
  {
 | 
			
		||||
  if (old_emote == current_emote) {
 | 
			
		||||
    ui_pre->setChecked(!ui_pre->isChecked());
 | 
			
		||||
  }
 | 
			
		||||
  else if (emote_mod == 1)
 | 
			
		||||
 | 
			
		||||
@ -4,8 +4,8 @@
 | 
			
		||||
 | 
			
		||||
QString fanta_encrypt(QString temp_input, unsigned int p_key)
 | 
			
		||||
{
 | 
			
		||||
  //using standard stdlib types is actually easier here because of implicit char<->int conversion
 | 
			
		||||
  //which in turn makes encryption arithmetic easier
 | 
			
		||||
  // using standard stdlib types is actually easier here because of implicit
 | 
			
		||||
  // char<->int conversion which in turn makes encryption arithmetic easier
 | 
			
		||||
 | 
			
		||||
  unsigned int key = p_key;
 | 
			
		||||
  unsigned int C1 = 53761;
 | 
			
		||||
@ -14,8 +14,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key)
 | 
			
		||||
  QVector<uint_fast8_t> temp_result;
 | 
			
		||||
  std::string input = temp_input.toUtf8().constData();
 | 
			
		||||
 | 
			
		||||
  for (unsigned int pos = 0 ; pos < input.size() ; ++pos)
 | 
			
		||||
  {
 | 
			
		||||
  for (unsigned int pos = 0; pos < input.size(); ++pos) {
 | 
			
		||||
    uint_fast8_t output = input.at(pos) ^ (key >> 8) % 256;
 | 
			
		||||
    temp_result.append(output);
 | 
			
		||||
    key = (temp_result.at(pos) + key) * C1 + C2;
 | 
			
		||||
@ -23,8 +22,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key)
 | 
			
		||||
 | 
			
		||||
  std::string result = "";
 | 
			
		||||
 | 
			
		||||
  for (uint_fast8_t i_int : temp_result)
 | 
			
		||||
  {
 | 
			
		||||
  for (uint_fast8_t i_int : temp_result) {
 | 
			
		||||
    result += omni::int_to_hex(i_int);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
@ -39,9 +37,8 @@ QString fanta_decrypt(QString temp_input, unsigned int key)
 | 
			
		||||
 | 
			
		||||
  QVector<unsigned int> unhexed_vector;
 | 
			
		||||
 | 
			
		||||
  for(unsigned int i=0; i< input.length(); i+=2)
 | 
			
		||||
  {
 | 
			
		||||
    std::string byte = input.substr(i,2);
 | 
			
		||||
  for (unsigned int i = 0; i < input.length(); i += 2) {
 | 
			
		||||
    std::string byte = input.substr(i, 2);
 | 
			
		||||
    unsigned int hex_int = strtoul(byte.c_str(), nullptr, 16);
 | 
			
		||||
    unhexed_vector.append(hex_int);
 | 
			
		||||
  }
 | 
			
		||||
@ -51,13 +48,11 @@ QString fanta_decrypt(QString temp_input, unsigned int key)
 | 
			
		||||
 | 
			
		||||
  std::string result = "";
 | 
			
		||||
 | 
			
		||||
  for (int pos = 0 ; pos < unhexed_vector.size() ; ++pos)
 | 
			
		||||
  {
 | 
			
		||||
  for (int pos = 0; pos < unhexed_vector.size(); ++pos) {
 | 
			
		||||
    unsigned char output = unhexed_vector.at(pos) ^ (key >> 8) % 256;
 | 
			
		||||
    result += output;
 | 
			
		||||
    key = (unhexed_vector.at(pos) + key) * C1 + C2;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return QString::fromStdString(result);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										100
									
								
								src/evidence.cpp
									
									
									
									
									
								
							
							
						
						
									
										100
									
								
								src/evidence.cpp
									
									
									
									
									
								
							@ -4,7 +4,7 @@ void Courtroom::construct_evidence()
 | 
			
		||||
{
 | 
			
		||||
  ui_evidence = new AOImage(this, ao_app);
 | 
			
		||||
 | 
			
		||||
  //ui_evidence_name = new QLabel(ui_evidence);
 | 
			
		||||
  // ui_evidence_name = new QLabel(ui_evidence);
 | 
			
		||||
  ui_evidence_name = new AOLineEdit(ui_evidence);
 | 
			
		||||
  ui_evidence_name->setAlignment(Qt::AlignCenter);
 | 
			
		||||
  ui_evidence_name->setFont(QFont("Arial", 14, QFont::Bold));
 | 
			
		||||
@ -32,7 +32,8 @@ void Courtroom::construct_evidence()
 | 
			
		||||
  set_size_and_pos(ui_evidence, "evidence_background");
 | 
			
		||||
  set_size_and_pos(ui_evidence_buttons, "evidence_buttons");
 | 
			
		||||
 | 
			
		||||
  QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini");
 | 
			
		||||
  QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing",
 | 
			
		||||
                                                "courtroom_design.ini");
 | 
			
		||||
 | 
			
		||||
  const int button_width = 70;
 | 
			
		||||
  int x_spacing = f_spacing.x();
 | 
			
		||||
@ -42,43 +43,57 @@ void Courtroom::construct_evidence()
 | 
			
		||||
  int y_spacing = f_spacing.y();
 | 
			
		||||
  int y_mod_count = 0;
 | 
			
		||||
 | 
			
		||||
  evidence_columns = ((ui_evidence_buttons->width() - button_width) / (x_spacing + button_width)) + 1;
 | 
			
		||||
  evidence_rows = ((ui_evidence_buttons->height() - button_height) / (y_spacing + button_height)) + 1;
 | 
			
		||||
  evidence_columns = ((ui_evidence_buttons->width() - button_width) /
 | 
			
		||||
                      (x_spacing + button_width)) +
 | 
			
		||||
                     1;
 | 
			
		||||
  evidence_rows = ((ui_evidence_buttons->height() - button_height) /
 | 
			
		||||
                   (y_spacing + button_height)) +
 | 
			
		||||
                  1;
 | 
			
		||||
 | 
			
		||||
  max_evidence_on_page = evidence_columns * evidence_rows;
 | 
			
		||||
 | 
			
		||||
  for (int n = 0 ; n < max_evidence_on_page ; ++n)
 | 
			
		||||
  {
 | 
			
		||||
  for (int n = 0; n < max_evidence_on_page; ++n) {
 | 
			
		||||
    int x_pos = (button_width + x_spacing) * x_mod_count;
 | 
			
		||||
    int y_pos = (button_height + y_spacing) * y_mod_count;
 | 
			
		||||
 | 
			
		||||
    AOEvidenceButton *f_evidence = new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos);
 | 
			
		||||
    AOEvidenceButton *f_evidence =
 | 
			
		||||
        new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos);
 | 
			
		||||
 | 
			
		||||
    ui_evidence_list.append(f_evidence);
 | 
			
		||||
 | 
			
		||||
    f_evidence->set_id(n);
 | 
			
		||||
 | 
			
		||||
    connect(f_evidence, SIGNAL(evidence_clicked(int)), this, SLOT(on_evidence_clicked(int)));
 | 
			
		||||
    connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this, SLOT(on_evidence_double_clicked(int)));
 | 
			
		||||
    connect(f_evidence, SIGNAL(on_hover(int, bool)), this, SLOT(on_evidence_hover(int, bool)));
 | 
			
		||||
    connect(f_evidence, SIGNAL(evidence_clicked(int)), this,
 | 
			
		||||
            SLOT(on_evidence_clicked(int)));
 | 
			
		||||
    connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this,
 | 
			
		||||
            SLOT(on_evidence_double_clicked(int)));
 | 
			
		||||
    connect(f_evidence, SIGNAL(on_hover(int, bool)), this,
 | 
			
		||||
            SLOT(on_evidence_hover(int, bool)));
 | 
			
		||||
 | 
			
		||||
    ++x_mod_count;
 | 
			
		||||
 | 
			
		||||
    if (x_mod_count == evidence_columns)
 | 
			
		||||
    {
 | 
			
		||||
    if (x_mod_count == evidence_columns) {
 | 
			
		||||
      ++y_mod_count;
 | 
			
		||||
      x_mod_count = 0;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited()));
 | 
			
		||||
  connect(ui_evidence_left, SIGNAL(clicked()), this, SLOT(on_evidence_left_clicked()));
 | 
			
		||||
  connect(ui_evidence_right, SIGNAL(clicked()), this, SLOT(on_evidence_right_clicked()));
 | 
			
		||||
  connect(ui_evidence_present, SIGNAL(clicked()), this, SLOT(on_evidence_present_clicked()));
 | 
			
		||||
  connect(ui_evidence_delete, SIGNAL(clicked()), this, SLOT(on_evidence_delete_clicked()));
 | 
			
		||||
  connect(ui_evidence_image_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_image_name_edited()));
 | 
			
		||||
  connect(ui_evidence_image_button, SIGNAL(clicked()), this, SLOT(on_evidence_image_button_clicked()));
 | 
			
		||||
  connect(ui_evidence_x, SIGNAL(clicked()), this, SLOT(on_evidence_x_clicked()));
 | 
			
		||||
  connect(ui_evidence_name, SIGNAL(returnPressed()), this,
 | 
			
		||||
          SLOT(on_evidence_name_edited()));
 | 
			
		||||
  connect(ui_evidence_left, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_evidence_left_clicked()));
 | 
			
		||||
  connect(ui_evidence_right, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_evidence_right_clicked()));
 | 
			
		||||
  connect(ui_evidence_present, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_evidence_present_clicked()));
 | 
			
		||||
  connect(ui_evidence_delete, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_evidence_delete_clicked()));
 | 
			
		||||
  connect(ui_evidence_image_name, SIGNAL(returnPressed()), this,
 | 
			
		||||
          SLOT(on_evidence_image_name_edited()));
 | 
			
		||||
  connect(ui_evidence_image_button, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_evidence_image_button_clicked()));
 | 
			
		||||
  connect(ui_evidence_x, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_evidence_x_clicked()));
 | 
			
		||||
 | 
			
		||||
  ui_evidence->hide();
 | 
			
		||||
}
 | 
			
		||||
@ -98,26 +113,23 @@ void Courtroom::set_evidence_page()
 | 
			
		||||
  ui_evidence_left->hide();
 | 
			
		||||
  ui_evidence_right->hide();
 | 
			
		||||
 | 
			
		||||
  for (AOEvidenceButton *i_button : ui_evidence_list)
 | 
			
		||||
  {
 | 
			
		||||
  for (AOEvidenceButton *i_button : ui_evidence_list) {
 | 
			
		||||
    i_button->reset();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  //to account for the "add evidence" button
 | 
			
		||||
  // to account for the "add evidence" button
 | 
			
		||||
  ++total_evidence;
 | 
			
		||||
 | 
			
		||||
  int total_pages = total_evidence / max_evidence_on_page;
 | 
			
		||||
  int evidence_on_page = 0;
 | 
			
		||||
 | 
			
		||||
  if ((total_evidence % max_evidence_on_page) != 0)
 | 
			
		||||
  {
 | 
			
		||||
  if ((total_evidence % max_evidence_on_page) != 0) {
 | 
			
		||||
    ++total_pages;
 | 
			
		||||
    //i. e. not on the last page
 | 
			
		||||
    // i. e. not on the last page
 | 
			
		||||
    if (total_pages > current_evidence_page + 1)
 | 
			
		||||
      evidence_on_page = max_evidence_on_page;
 | 
			
		||||
    else
 | 
			
		||||
      evidence_on_page = total_evidence % max_evidence_on_page;
 | 
			
		||||
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
    evidence_on_page = max_evidence_on_page;
 | 
			
		||||
@ -128,17 +140,19 @@ void Courtroom::set_evidence_page()
 | 
			
		||||
  if (current_evidence_page > 0)
 | 
			
		||||
    ui_evidence_left->show();
 | 
			
		||||
 | 
			
		||||
  for (int n_evidence_button = 0 ; n_evidence_button < evidence_on_page ; ++n_evidence_button)
 | 
			
		||||
  {
 | 
			
		||||
    int n_real_evidence = n_evidence_button + current_evidence_page * max_evidence_on_page;
 | 
			
		||||
    AOEvidenceButton *f_evidence_button = ui_evidence_list.at(n_evidence_button);
 | 
			
		||||
  for (int n_evidence_button = 0; n_evidence_button < evidence_on_page;
 | 
			
		||||
       ++n_evidence_button) {
 | 
			
		||||
    int n_real_evidence =
 | 
			
		||||
        n_evidence_button + current_evidence_page * max_evidence_on_page;
 | 
			
		||||
    AOEvidenceButton *f_evidence_button =
 | 
			
		||||
        ui_evidence_list.at(n_evidence_button);
 | 
			
		||||
 | 
			
		||||
    //ie. the add evidence button
 | 
			
		||||
    // ie. the add evidence button
 | 
			
		||||
    if (n_real_evidence == (total_evidence - 1))
 | 
			
		||||
      f_evidence_button->set_theme_image("addevidence.png");
 | 
			
		||||
    else if (n_real_evidence < (total_evidence - 1))
 | 
			
		||||
    {
 | 
			
		||||
      f_evidence_button->set_image(local_evidence_list.at(n_real_evidence).image);
 | 
			
		||||
    else if (n_real_evidence < (total_evidence - 1)) {
 | 
			
		||||
      f_evidence_button->set_image(
 | 
			
		||||
          local_evidence_list.at(n_real_evidence).image);
 | 
			
		||||
 | 
			
		||||
      if (n_real_evidence == current_evidence)
 | 
			
		||||
        f_evidence_button->set_selected(true);
 | 
			
		||||
@ -198,7 +212,7 @@ void Courtroom::on_evidence_image_button_clicked()
 | 
			
		||||
  QStringList filenames;
 | 
			
		||||
 | 
			
		||||
  if (dialog.exec())
 | 
			
		||||
      filenames = dialog.selectedFiles();
 | 
			
		||||
    filenames = dialog.selectedFiles();
 | 
			
		||||
 | 
			
		||||
  if (filenames.size() != 1)
 | 
			
		||||
    return;
 | 
			
		||||
@ -215,9 +229,9 @@ void Courtroom::on_evidence_clicked(int p_id)
 | 
			
		||||
 | 
			
		||||
  int f_real_id = p_id + max_evidence_on_page * current_evidence_page;
 | 
			
		||||
 | 
			
		||||
  if (f_real_id == local_evidence_list.size())
 | 
			
		||||
  {
 | 
			
		||||
    ao_app->send_server_packet(new AOPacket("PE#<name>#<description>#empty.png#%"));
 | 
			
		||||
  if (f_real_id == local_evidence_list.size()) {
 | 
			
		||||
    ao_app->send_server_packet(
 | 
			
		||||
        new AOPacket("PE#<name>#<description>#empty.png#%"));
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
  else if (f_real_id > local_evidence_list.size())
 | 
			
		||||
@ -233,7 +247,6 @@ void Courtroom::on_evidence_clicked(int p_id)
 | 
			
		||||
  current_evidence = f_real_id;
 | 
			
		||||
 | 
			
		||||
  ui_ic_chat_message->setFocus();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Courtroom::on_evidence_double_clicked(int p_id)
 | 
			
		||||
@ -262,8 +275,7 @@ void Courtroom::on_evidence_hover(int p_id, bool p_state)
 | 
			
		||||
  ui_evidence_name->setReadOnly(true);
 | 
			
		||||
  int final_id = p_id + max_evidence_on_page * current_evidence_page;
 | 
			
		||||
 | 
			
		||||
  if (p_state)
 | 
			
		||||
  {
 | 
			
		||||
  if (p_state) {
 | 
			
		||||
    if (final_id == local_evidence_list.size())
 | 
			
		||||
      ui_evidence_name->setText(tr("Add new evidence..."));
 | 
			
		||||
    else if (final_id < local_evidence_list.size())
 | 
			
		||||
@ -310,7 +322,8 @@ void Courtroom::on_evidence_delete_clicked()
 | 
			
		||||
  ui_evidence_description->setReadOnly(true);
 | 
			
		||||
  ui_evidence_overlay->hide();
 | 
			
		||||
 | 
			
		||||
  ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
 | 
			
		||||
  ao_app->send_server_packet(
 | 
			
		||||
      new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
 | 
			
		||||
 | 
			
		||||
  current_evidence = 0;
 | 
			
		||||
 | 
			
		||||
@ -338,4 +351,3 @@ void Courtroom::on_evidence_x_clicked()
 | 
			
		||||
 | 
			
		||||
  ui_ic_chat_message->setFocus();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,8 @@ bool dir_exists(QString dir_path)
 | 
			
		||||
  return check_dir.exists();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool exists(QString p_path) {
 | 
			
		||||
bool exists(QString p_path)
 | 
			
		||||
{
 | 
			
		||||
  QFile file(p_path);
 | 
			
		||||
 | 
			
		||||
  return file.exists();
 | 
			
		||||
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
 | 
			
		||||
#if (defined (_WIN32) || defined (_WIN64))
 | 
			
		||||
#if (defined(_WIN32) || defined(_WIN64))
 | 
			
		||||
#include <windows.h>
 | 
			
		||||
 | 
			
		||||
static DWORD dwVolSerial;
 | 
			
		||||
@ -10,17 +10,18 @@ static BOOL bIsRetrieved;
 | 
			
		||||
 | 
			
		||||
QString get_hdid()
 | 
			
		||||
{
 | 
			
		||||
  bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial, nullptr, nullptr, nullptr, 0);
 | 
			
		||||
  bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial,
 | 
			
		||||
                                      nullptr, nullptr, nullptr, 0);
 | 
			
		||||
 | 
			
		||||
  if (bIsRetrieved)
 | 
			
		||||
    return QString::number(dwVolSerial, 16);
 | 
			
		||||
  else
 | 
			
		||||
    //a totally random string
 | 
			
		||||
    //what could possibly go wrong
 | 
			
		||||
    // a totally random string
 | 
			
		||||
    // what could possibly go wrong
 | 
			
		||||
    return "gxsps32sa9fnwic92mfbs0";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#elif (defined (LINUX) || defined (__linux__))
 | 
			
		||||
#elif (defined(LINUX) || defined(__linux__))
 | 
			
		||||
 | 
			
		||||
#include <QFile>
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
@ -33,12 +34,10 @@ QString get_hdid()
 | 
			
		||||
 | 
			
		||||
  QTextStream in(&fstab_file);
 | 
			
		||||
 | 
			
		||||
  while(!in.atEnd())
 | 
			
		||||
  {
 | 
			
		||||
  while (!in.atEnd()) {
 | 
			
		||||
    QString line = in.readLine();
 | 
			
		||||
 | 
			
		||||
    if (line.startsWith("UUID"))
 | 
			
		||||
    {
 | 
			
		||||
    if (line.startsWith("UUID")) {
 | 
			
		||||
      QStringList line_elements = line.split("=");
 | 
			
		||||
 | 
			
		||||
      if (line_elements.size() > 1)
 | 
			
		||||
@ -55,26 +54,25 @@ QString get_hdid()
 | 
			
		||||
 | 
			
		||||
QString get_hdid()
 | 
			
		||||
{
 | 
			
		||||
    CFStringRef serial;
 | 
			
		||||
        char buffer[64] = {0};
 | 
			
		||||
        QString hdid;
 | 
			
		||||
        io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
 | 
			
		||||
                                                              IOServiceMatching("IOPlatformExpertDevice"));
 | 
			
		||||
        if (platformExpert)
 | 
			
		||||
        {
 | 
			
		||||
            CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert,
 | 
			
		||||
                                                                           CFSTR(kIOPlatformSerialNumberKey),
 | 
			
		||||
                                                                           kCFAllocatorDefault, 0);
 | 
			
		||||
            if (serialNumberAsCFString) {
 | 
			
		||||
                serial = (CFStringRef)serialNumberAsCFString;
 | 
			
		||||
            }
 | 
			
		||||
            if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) {
 | 
			
		||||
                hdid = buffer;
 | 
			
		||||
            }
 | 
			
		||||
  CFStringRef serial;
 | 
			
		||||
  char buffer[64] = {0};
 | 
			
		||||
  QString hdid;
 | 
			
		||||
  io_service_t platformExpert = IOServiceGetMatchingService(
 | 
			
		||||
      kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
 | 
			
		||||
  if (platformExpert) {
 | 
			
		||||
    CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(
 | 
			
		||||
        platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault,
 | 
			
		||||
        0);
 | 
			
		||||
    if (serialNumberAsCFString) {
 | 
			
		||||
      serial = (CFStringRef)serialNumberAsCFString;
 | 
			
		||||
    }
 | 
			
		||||
    if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) {
 | 
			
		||||
      hdid = buffer;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
            IOObjectRelease(platformExpert);
 | 
			
		||||
        }
 | 
			
		||||
        return hdid;
 | 
			
		||||
    IOObjectRelease(platformExpert);
 | 
			
		||||
  }
 | 
			
		||||
  return hdid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
@ -1,18 +1,17 @@
 | 
			
		||||
#include "hex_functions.h"
 | 
			
		||||
 | 
			
		||||
namespace omni
 | 
			
		||||
namespace omni {
 | 
			
		||||
std::string int_to_hex(unsigned int input)
 | 
			
		||||
{
 | 
			
		||||
  std::string int_to_hex(unsigned int input)
 | 
			
		||||
  {
 | 
			
		||||
    if (input > 255)
 | 
			
		||||
      return "FF";
 | 
			
		||||
  if (input > 255)
 | 
			
		||||
    return "FF";
 | 
			
		||||
 | 
			
		||||
    std::stringstream stream;
 | 
			
		||||
    stream << std::setfill('0') << std::setw(sizeof(char)*2)
 | 
			
		||||
           << std::hex << input;
 | 
			
		||||
    std::string result(stream.str());
 | 
			
		||||
    std::transform(result.begin(), result.end(), result.begin(), ::toupper);
 | 
			
		||||
  std::stringstream stream;
 | 
			
		||||
  stream << std::setfill('0') << std::setw(sizeof(char) * 2) << std::hex
 | 
			
		||||
         << input;
 | 
			
		||||
  std::string result(stream.str());
 | 
			
		||||
  std::transform(result.begin(), result.end(), result.begin(), ::toupper);
 | 
			
		||||
 | 
			
		||||
    return result;
 | 
			
		||||
  }
 | 
			
		||||
  return result;
 | 
			
		||||
}
 | 
			
		||||
} // namespace omni
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										795
									
								
								src/lobby.cpp
									
									
									
									
									
								
							
							
						
						
									
										795
									
								
								src/lobby.cpp
									
									
									
									
									
								
							@ -1,410 +1,403 @@
 | 
			
		||||
#include "lobby.h"
 | 
			
		||||
 | 
			
		||||
#include "debug_functions.h"
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "networkmanager.h"
 | 
			
		||||
#include "aosfxplayer.h"
 | 
			
		||||
 | 
			
		||||
Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
 | 
			
		||||
  this->setWindowTitle(tr("Attorney Online 2"));
 | 
			
		||||
  this->setWindowIcon(QIcon(":/logo.png"));
 | 
			
		||||
 | 
			
		||||
  ui_background = new AOImage(this, ao_app);
 | 
			
		||||
  ui_public_servers = new AOButton(this, ao_app);
 | 
			
		||||
  ui_favorites = new AOButton(this, ao_app);
 | 
			
		||||
  ui_refresh = new AOButton(this, ao_app);
 | 
			
		||||
  ui_add_to_fav = new AOButton(this, ao_app);
 | 
			
		||||
  ui_connect = new AOButton(this, ao_app);
 | 
			
		||||
  ui_version = new QLabel(this);
 | 
			
		||||
  ui_about = new AOButton(this, ao_app);
 | 
			
		||||
  ui_server_list = new QListWidget(this);
 | 
			
		||||
  ui_player_count = new QLabel(this);
 | 
			
		||||
  ui_description = new AOTextArea(this);
 | 
			
		||||
  ui_chatbox = new AOTextArea(this);
 | 
			
		||||
  ui_chatbox->setOpenExternalLinks(true);
 | 
			
		||||
  ui_chatname = new QLineEdit(this);
 | 
			
		||||
  ui_chatname->setPlaceholderText(tr("Name"));
 | 
			
		||||
  ui_chatname->setText(ao_app->get_ooc_name());
 | 
			
		||||
  ui_chatmessage = new QLineEdit(this);
 | 
			
		||||
  ui_loading_background = new AOImage(this, ao_app);
 | 
			
		||||
  ui_loading_text = new QTextEdit(ui_loading_background);
 | 
			
		||||
  ui_progress_bar = new QProgressBar(ui_loading_background);
 | 
			
		||||
  ui_progress_bar->setMinimum(0);
 | 
			
		||||
  ui_progress_bar->setMaximum(100);
 | 
			
		||||
  ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }");
 | 
			
		||||
  ui_cancel = new AOButton(ui_loading_background, ao_app);
 | 
			
		||||
 | 
			
		||||
  connect(ui_public_servers, SIGNAL(clicked()), this, SLOT(on_public_servers_clicked()));
 | 
			
		||||
  connect(ui_favorites, SIGNAL(clicked()), this, SLOT(on_favorites_clicked()));
 | 
			
		||||
  connect(ui_refresh, SIGNAL(pressed()), this, SLOT(on_refresh_pressed()));
 | 
			
		||||
  connect(ui_refresh, SIGNAL(released()), this, SLOT(on_refresh_released()));
 | 
			
		||||
  connect(ui_add_to_fav, SIGNAL(pressed()), this, SLOT(on_add_to_fav_pressed()));
 | 
			
		||||
  connect(ui_add_to_fav, SIGNAL(released()), this, SLOT(on_add_to_fav_released()));
 | 
			
		||||
  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()));
 | 
			
		||||
  connect(ui_server_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_server_list_clicked(QModelIndex)));
 | 
			
		||||
  connect(ui_server_list, SIGNAL(activated(QModelIndex)), this, SLOT(on_server_list_doubleclicked(QModelIndex)));
 | 
			
		||||
  connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed()));
 | 
			
		||||
  connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
 | 
			
		||||
 | 
			
		||||
  ui_connect->setEnabled(false);
 | 
			
		||||
 | 
			
		||||
  list_servers();
 | 
			
		||||
 | 
			
		||||
  set_widgets();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//sets images, position and size
 | 
			
		||||
void Lobby::set_widgets()
 | 
			
		||||
{
 | 
			
		||||
  ao_app->reload_theme();
 | 
			
		||||
 | 
			
		||||
  QString filename = "lobby_design.ini";
 | 
			
		||||
 | 
			
		||||
  pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename);
 | 
			
		||||
 | 
			
		||||
  if (f_lobby.width < 0 || f_lobby.height < 0)
 | 
			
		||||
  {
 | 
			
		||||
    qDebug() << "W: did not find lobby width or height in " << ao_app->get_theme_path(filename);
 | 
			
		||||
 | 
			
		||||
    // Most common symptom of bad config files and missing assets.
 | 
			
		||||
    call_notice(tr("It doesn't look like your client is set up correctly.\n"
 | 
			
		||||
                "Did you download all resources correctly from tiny.cc/getao, "
 | 
			
		||||
                "including the large 'base' folder?"));
 | 
			
		||||
 | 
			
		||||
    this->resize(517, 666);
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    this->resize(f_lobby.width, f_lobby.height);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_background, "lobby");
 | 
			
		||||
  ui_background->set_image("lobbybackground.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_public_servers, "public_servers");
 | 
			
		||||
  ui_public_servers->set_image("publicservers_selected.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_favorites, "favorites");
 | 
			
		||||
  ui_favorites->set_image("favorites.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_refresh, "refresh");
 | 
			
		||||
  ui_refresh->set_image("refresh.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_add_to_fav, "add_to_fav");
 | 
			
		||||
  ui_add_to_fav->set_image("addtofav.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_connect, "connect");
 | 
			
		||||
  ui_connect->set_image("connect.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_version, "version");
 | 
			
		||||
  ui_version->setText(tr("Version: %1").arg(ao_app->get_version_string()));
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_about, "about");
 | 
			
		||||
  ui_about->set_image("about.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_server_list, "server_list");
 | 
			
		||||
  ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
                                  "font: bold;");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_player_count, "player_count");
 | 
			
		||||
  ui_player_count->setText(tr("Offline"));
 | 
			
		||||
  ui_player_count->setStyleSheet("font: bold;"
 | 
			
		||||
                                 "color: white;"
 | 
			
		||||
                                 "qproperty-alignment: AlignCenter;");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_description, "description");
 | 
			
		||||
  ui_description->setReadOnly(true);
 | 
			
		||||
  ui_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
                                "color: white;");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_chatbox, "chatbox");
 | 
			
		||||
  ui_chatbox->setReadOnly(true);
 | 
			
		||||
  ui_chatbox->setStyleSheet("QTextBrowser{background-color: rgba(0, 0, 0, 0);}");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_chatname, "chatname");
 | 
			
		||||
  ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
                             "selection-background-color: rgba(0, 0, 0, 0);");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_chatmessage, "chatmessage");
 | 
			
		||||
  ui_chatmessage->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
                                "selection-background-color: rgba(0, 0, 0, 0);");
 | 
			
		||||
 | 
			
		||||
  ui_loading_background->resize(this->width(), this->height());
 | 
			
		||||
  ui_loading_background->set_image("loadingbackground.png");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_loading_text, "loading_label");
 | 
			
		||||
  ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold));
 | 
			
		||||
  ui_loading_text->setReadOnly(true);
 | 
			
		||||
  ui_loading_text->setAlignment(Qt::AlignCenter);
 | 
			
		||||
  ui_loading_text->setFrameStyle(QFrame::NoFrame);
 | 
			
		||||
  ui_loading_text->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
                                 "color: rgba(255, 128, 0, 255);");
 | 
			
		||||
  ui_loading_text->append(tr("Loading"));
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_progress_bar, "progress_bar");
 | 
			
		||||
  set_size_and_pos(ui_cancel, "cancel");
 | 
			
		||||
  ui_cancel->setText(tr("Cancel"));
 | 
			
		||||
 | 
			
		||||
  ui_loading_background->hide();
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
 | 
			
		||||
{
 | 
			
		||||
  QString filename = "lobby_design.ini";
 | 
			
		||||
 | 
			
		||||
  pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename);
 | 
			
		||||
 | 
			
		||||
  if (design_ini_result.width < 0 || design_ini_result.height < 0)
 | 
			
		||||
  {
 | 
			
		||||
    qDebug() << "W: could not find " << p_identifier << " in " << filename;
 | 
			
		||||
    p_widget->hide();
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    p_widget->move(design_ini_result.x, design_ini_result.y);
 | 
			
		||||
    p_widget->resize(design_ini_result.width, design_ini_result.height);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::lobbyThreadHandler(QString loadingText){
 | 
			
		||||
    this->set_loading_text(loadingText);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::set_loading_text(QString p_text)
 | 
			
		||||
{
 | 
			
		||||
  ui_loading_text->clear();
 | 
			
		||||
  ui_loading_text->setAlignment(Qt::AlignCenter);
 | 
			
		||||
  ui_loading_text->append(p_text);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString Lobby::get_chatlog()
 | 
			
		||||
{
 | 
			
		||||
  QString return_value = ui_chatbox->toPlainText();
 | 
			
		||||
 | 
			
		||||
  return return_value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int Lobby::get_selected_server()
 | 
			
		||||
{
 | 
			
		||||
  return ui_server_list->currentRow();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::set_loading_value(int p_value)
 | 
			
		||||
{
 | 
			
		||||
  ui_progress_bar->setValue(p_value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_public_servers_clicked()
 | 
			
		||||
{
 | 
			
		||||
  ui_public_servers->set_image("publicservers_selected.png");
 | 
			
		||||
  ui_favorites->set_image("favorites.png");
 | 
			
		||||
 | 
			
		||||
  list_servers();
 | 
			
		||||
 | 
			
		||||
  public_servers_selected = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_favorites_clicked()
 | 
			
		||||
{
 | 
			
		||||
  ui_favorites->set_image("favorites_selected.png");
 | 
			
		||||
  ui_public_servers->set_image("publicservers.png");
 | 
			
		||||
 | 
			
		||||
  ao_app->set_favorite_list();
 | 
			
		||||
  //ao_app->favorite_list = read_serverlist_txt();
 | 
			
		||||
 | 
			
		||||
  list_favorites();
 | 
			
		||||
 | 
			
		||||
  public_servers_selected = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_refresh_pressed()
 | 
			
		||||
{
 | 
			
		||||
  ui_refresh->set_image("refresh_pressed.png");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_refresh_released()
 | 
			
		||||
{
 | 
			
		||||
  ui_refresh->set_image("refresh.png");
 | 
			
		||||
 | 
			
		||||
  AOPacket *f_packet = new AOPacket("ALL#%");
 | 
			
		||||
 | 
			
		||||
  ao_app->send_ms_packet(f_packet);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_add_to_fav_pressed()
 | 
			
		||||
{
 | 
			
		||||
  ui_add_to_fav->set_image("addtofav_pressed.png");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_add_to_fav_released()
 | 
			
		||||
{
 | 
			
		||||
  ui_add_to_fav->set_image("addtofav.png");
 | 
			
		||||
 | 
			
		||||
  //you cant add favorites from favorites m8
 | 
			
		||||
  if (!public_servers_selected)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  ao_app->add_favorite_server(ui_server_list->currentRow());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_connect_pressed()
 | 
			
		||||
{
 | 
			
		||||
  ui_connect->set_image("connect_pressed.png");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_connect_released()
 | 
			
		||||
{
 | 
			
		||||
  ui_connect->set_image("connect.png");
 | 
			
		||||
 | 
			
		||||
  AOPacket *f_packet;
 | 
			
		||||
 | 
			
		||||
  f_packet = new AOPacket("askchaa#%");
 | 
			
		||||
 | 
			
		||||
  ao_app->send_server_packet(f_packet);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_about_clicked()
 | 
			
		||||
{
 | 
			
		||||
#include "lobby.h"
 | 
			
		||||
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "aosfxplayer.h"
 | 
			
		||||
#include "debug_functions.h"
 | 
			
		||||
#include "networkmanager.h"
 | 
			
		||||
 | 
			
		||||
Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
 | 
			
		||||
{
 | 
			
		||||
  ao_app = p_ao_app;
 | 
			
		||||
 | 
			
		||||
  this->setWindowTitle(tr("Attorney Online 2"));
 | 
			
		||||
  this->setWindowIcon(QIcon(":/logo.png"));
 | 
			
		||||
 | 
			
		||||
  ui_background = new AOImage(this, ao_app);
 | 
			
		||||
  ui_public_servers = new AOButton(this, ao_app);
 | 
			
		||||
  ui_favorites = new AOButton(this, ao_app);
 | 
			
		||||
  ui_refresh = new AOButton(this, ao_app);
 | 
			
		||||
  ui_add_to_fav = new AOButton(this, ao_app);
 | 
			
		||||
  ui_connect = new AOButton(this, ao_app);
 | 
			
		||||
  ui_version = new QLabel(this);
 | 
			
		||||
  ui_about = new AOButton(this, ao_app);
 | 
			
		||||
  ui_server_list = new QListWidget(this);
 | 
			
		||||
  ui_player_count = new QLabel(this);
 | 
			
		||||
  ui_description = new AOTextArea(this);
 | 
			
		||||
  ui_chatbox = new AOTextArea(this);
 | 
			
		||||
  ui_chatbox->setOpenExternalLinks(true);
 | 
			
		||||
  ui_chatname = new QLineEdit(this);
 | 
			
		||||
  ui_chatname->setPlaceholderText(tr("Name"));
 | 
			
		||||
  ui_chatname->setText(ao_app->get_ooc_name());
 | 
			
		||||
  ui_chatmessage = new QLineEdit(this);
 | 
			
		||||
  ui_loading_background = new AOImage(this, ao_app);
 | 
			
		||||
  ui_loading_text = new QTextEdit(ui_loading_background);
 | 
			
		||||
  ui_progress_bar = new QProgressBar(ui_loading_background);
 | 
			
		||||
  ui_progress_bar->setMinimum(0);
 | 
			
		||||
  ui_progress_bar->setMaximum(100);
 | 
			
		||||
  ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }");
 | 
			
		||||
  ui_cancel = new AOButton(ui_loading_background, ao_app);
 | 
			
		||||
 | 
			
		||||
  connect(ui_public_servers, SIGNAL(clicked()), this,
 | 
			
		||||
          SLOT(on_public_servers_clicked()));
 | 
			
		||||
  connect(ui_favorites, SIGNAL(clicked()), this, SLOT(on_favorites_clicked()));
 | 
			
		||||
  connect(ui_refresh, SIGNAL(pressed()), this, SLOT(on_refresh_pressed()));
 | 
			
		||||
  connect(ui_refresh, SIGNAL(released()), this, SLOT(on_refresh_released()));
 | 
			
		||||
  connect(ui_add_to_fav, SIGNAL(pressed()), this,
 | 
			
		||||
          SLOT(on_add_to_fav_pressed()));
 | 
			
		||||
  connect(ui_add_to_fav, SIGNAL(released()), this,
 | 
			
		||||
          SLOT(on_add_to_fav_released()));
 | 
			
		||||
  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()));
 | 
			
		||||
  connect(ui_server_list, SIGNAL(clicked(QModelIndex)), this,
 | 
			
		||||
          SLOT(on_server_list_clicked(QModelIndex)));
 | 
			
		||||
  connect(ui_server_list, SIGNAL(activated(QModelIndex)), this,
 | 
			
		||||
          SLOT(on_server_list_doubleclicked(QModelIndex)));
 | 
			
		||||
  connect(ui_chatmessage, SIGNAL(returnPressed()), this,
 | 
			
		||||
          SLOT(on_chatfield_return_pressed()));
 | 
			
		||||
  connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
 | 
			
		||||
 | 
			
		||||
  ui_connect->setEnabled(false);
 | 
			
		||||
 | 
			
		||||
  list_servers();
 | 
			
		||||
 | 
			
		||||
  set_widgets();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// sets images, position and size
 | 
			
		||||
void Lobby::set_widgets()
 | 
			
		||||
{
 | 
			
		||||
  ao_app->reload_theme();
 | 
			
		||||
 | 
			
		||||
  QString filename = "lobby_design.ini";
 | 
			
		||||
 | 
			
		||||
  pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename);
 | 
			
		||||
 | 
			
		||||
  if (f_lobby.width < 0 || f_lobby.height < 0) {
 | 
			
		||||
    qDebug() << "W: did not find lobby width or height in "
 | 
			
		||||
             << ao_app->get_theme_path(filename);
 | 
			
		||||
 | 
			
		||||
    // Most common symptom of bad config files and missing assets.
 | 
			
		||||
    call_notice(
 | 
			
		||||
        tr("It doesn't look like your client is set up correctly.\n"
 | 
			
		||||
           "Did you download all resources correctly from tiny.cc/getao, "
 | 
			
		||||
           "including the large 'base' folder?"));
 | 
			
		||||
 | 
			
		||||
    this->resize(517, 666);
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    this->resize(f_lobby.width, f_lobby.height);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_background, "lobby");
 | 
			
		||||
  ui_background->set_image("lobbybackground.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_public_servers, "public_servers");
 | 
			
		||||
  ui_public_servers->set_image("publicservers_selected.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_favorites, "favorites");
 | 
			
		||||
  ui_favorites->set_image("favorites.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_refresh, "refresh");
 | 
			
		||||
  ui_refresh->set_image("refresh.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_add_to_fav, "add_to_fav");
 | 
			
		||||
  ui_add_to_fav->set_image("addtofav.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_connect, "connect");
 | 
			
		||||
  ui_connect->set_image("connect.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_version, "version");
 | 
			
		||||
  ui_version->setText(tr("Version: %1").arg(ao_app->get_version_string()));
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_about, "about");
 | 
			
		||||
  ui_about->set_image("about.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_server_list, "server_list");
 | 
			
		||||
  ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
                                "font: bold;");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_player_count, "player_count");
 | 
			
		||||
  ui_player_count->setText(tr("Offline"));
 | 
			
		||||
  ui_player_count->setStyleSheet("font: bold;"
 | 
			
		||||
                                 "color: white;"
 | 
			
		||||
                                 "qproperty-alignment: AlignCenter;");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_description, "description");
 | 
			
		||||
  ui_description->setReadOnly(true);
 | 
			
		||||
  ui_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
                                "color: white;");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_chatbox, "chatbox");
 | 
			
		||||
  ui_chatbox->setReadOnly(true);
 | 
			
		||||
  ui_chatbox->setStyleSheet(
 | 
			
		||||
      "QTextBrowser{background-color: rgba(0, 0, 0, 0);}");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_chatname, "chatname");
 | 
			
		||||
  ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
                             "selection-background-color: rgba(0, 0, 0, 0);");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_chatmessage, "chatmessage");
 | 
			
		||||
  ui_chatmessage->setStyleSheet(
 | 
			
		||||
      "background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
      "selection-background-color: rgba(0, 0, 0, 0);");
 | 
			
		||||
 | 
			
		||||
  ui_loading_background->resize(this->width(), this->height());
 | 
			
		||||
  ui_loading_background->set_image("loadingbackground.png");
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_loading_text, "loading_label");
 | 
			
		||||
  ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold));
 | 
			
		||||
  ui_loading_text->setReadOnly(true);
 | 
			
		||||
  ui_loading_text->setAlignment(Qt::AlignCenter);
 | 
			
		||||
  ui_loading_text->setFrameStyle(QFrame::NoFrame);
 | 
			
		||||
  ui_loading_text->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
 | 
			
		||||
                                 "color: rgba(255, 128, 0, 255);");
 | 
			
		||||
  ui_loading_text->append(tr("Loading"));
 | 
			
		||||
 | 
			
		||||
  set_size_and_pos(ui_progress_bar, "progress_bar");
 | 
			
		||||
  set_size_and_pos(ui_cancel, "cancel");
 | 
			
		||||
  ui_cancel->setText(tr("Cancel"));
 | 
			
		||||
 | 
			
		||||
  ui_loading_background->hide();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::lobbyThreadHandler(QString loadingText)
 | 
			
		||||
{
 | 
			
		||||
  this->set_loading_text(loadingText);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
 | 
			
		||||
{
 | 
			
		||||
  QString filename = "lobby_design.ini";
 | 
			
		||||
 | 
			
		||||
  pos_size_type design_ini_result =
 | 
			
		||||
      ao_app->get_element_dimensions(p_identifier, filename);
 | 
			
		||||
 | 
			
		||||
  if (design_ini_result.width < 0 || design_ini_result.height < 0) {
 | 
			
		||||
    qDebug() << "W: could not find " << p_identifier << " in " << filename;
 | 
			
		||||
    p_widget->hide();
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    p_widget->move(design_ini_result.x, design_ini_result.y);
 | 
			
		||||
    p_widget->resize(design_ini_result.width, design_ini_result.height);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::set_loading_text(QString p_text)
 | 
			
		||||
{
 | 
			
		||||
  ui_loading_text->clear();
 | 
			
		||||
  ui_loading_text->setAlignment(Qt::AlignCenter);
 | 
			
		||||
  ui_loading_text->append(p_text);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString Lobby::get_chatlog()
 | 
			
		||||
{
 | 
			
		||||
  QString return_value = ui_chatbox->toPlainText();
 | 
			
		||||
 | 
			
		||||
  return return_value;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int Lobby::get_selected_server() { return ui_server_list->currentRow(); }
 | 
			
		||||
 | 
			
		||||
void Lobby::set_loading_value(int p_value)
 | 
			
		||||
{
 | 
			
		||||
  ui_progress_bar->setValue(p_value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_public_servers_clicked()
 | 
			
		||||
{
 | 
			
		||||
  ui_public_servers->set_image("publicservers_selected.png");
 | 
			
		||||
  ui_favorites->set_image("favorites.png");
 | 
			
		||||
 | 
			
		||||
  list_servers();
 | 
			
		||||
 | 
			
		||||
  public_servers_selected = true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_favorites_clicked()
 | 
			
		||||
{
 | 
			
		||||
  ui_favorites->set_image("favorites_selected.png");
 | 
			
		||||
  ui_public_servers->set_image("publicservers.png");
 | 
			
		||||
 | 
			
		||||
  ao_app->set_favorite_list();
 | 
			
		||||
  // ao_app->favorite_list = read_serverlist_txt();
 | 
			
		||||
 | 
			
		||||
  list_favorites();
 | 
			
		||||
 | 
			
		||||
  public_servers_selected = false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_refresh_pressed()
 | 
			
		||||
{
 | 
			
		||||
  ui_refresh->set_image("refresh_pressed.png");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_refresh_released()
 | 
			
		||||
{
 | 
			
		||||
  ui_refresh->set_image("refresh.png");
 | 
			
		||||
 | 
			
		||||
  AOPacket *f_packet = new AOPacket("ALL#%");
 | 
			
		||||
 | 
			
		||||
  ao_app->send_ms_packet(f_packet);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_add_to_fav_pressed()
 | 
			
		||||
{
 | 
			
		||||
  ui_add_to_fav->set_image("addtofav_pressed.png");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_add_to_fav_released()
 | 
			
		||||
{
 | 
			
		||||
  ui_add_to_fav->set_image("addtofav.png");
 | 
			
		||||
 | 
			
		||||
  // you cant add favorites from favorites m8
 | 
			
		||||
  if (!public_servers_selected)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  ao_app->add_favorite_server(ui_server_list->currentRow());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_connect_pressed()
 | 
			
		||||
{
 | 
			
		||||
  ui_connect->set_image("connect_pressed.png");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_connect_released()
 | 
			
		||||
{
 | 
			
		||||
  ui_connect->set_image("connect.png");
 | 
			
		||||
 | 
			
		||||
  AOPacket *f_packet;
 | 
			
		||||
 | 
			
		||||
  f_packet = new AOPacket("askchaa#%");
 | 
			
		||||
 | 
			
		||||
  ao_app->send_server_packet(f_packet);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_about_clicked()
 | 
			
		||||
{
 | 
			
		||||
  QString msg =
 | 
			
		||||
      tr("<h2>Attorney Online %1</h2>"
 | 
			
		||||
                   "The courtroom drama simulator"
 | 
			
		||||
                   "<p><b>Source code:</b> "
 | 
			
		||||
                   "<a href='https://github.com/AttorneyOnline/AO2-Client'>"
 | 
			
		||||
                   "https://github.com/AttorneyOnline/AO2-Client</a>"
 | 
			
		||||
                   "<p><b>Major development:</b><br>"
 | 
			
		||||
         "The courtroom drama simulator"
 | 
			
		||||
         "<p><b>Source code:</b> "
 | 
			
		||||
         "<a href='https://github.com/AttorneyOnline/AO2-Client'>"
 | 
			
		||||
         "https://github.com/AttorneyOnline/AO2-Client</a>"
 | 
			
		||||
         "<p><b>Major development:</b><br>"
 | 
			
		||||
         "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, "
 | 
			
		||||
         "Cents02"
 | 
			
		||||
                   "<p><b>Special thanks:</b><br>"
 | 
			
		||||
                   "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), "
 | 
			
		||||
                   "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, "
 | 
			
		||||
         "<p><b>Special thanks:</b><br>"
 | 
			
		||||
         "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), "
 | 
			
		||||
         "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, "
 | 
			
		||||
         "Noevain, Cronnicossy, Raidensnake")
 | 
			
		||||
          .arg(ao_app->get_version_string());
 | 
			
		||||
  QMessageBox::about(this, "About", msg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//clicked on an item in the serverlist
 | 
			
		||||
void Lobby::on_server_list_clicked(QModelIndex p_model)
 | 
			
		||||
{
 | 
			
		||||
  if (p_model != last_model)
 | 
			
		||||
  {
 | 
			
		||||
  server_type f_server;
 | 
			
		||||
  last_model = p_model;
 | 
			
		||||
  int n_server = p_model.row();
 | 
			
		||||
 | 
			
		||||
  if (n_server < 0)
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  if (public_servers_selected)
 | 
			
		||||
  {
 | 
			
		||||
    QVector<server_type> f_server_list = ao_app->get_server_list();
 | 
			
		||||
 | 
			
		||||
    if (n_server >= f_server_list.size())
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
    f_server = f_server_list.at(p_model.row());
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    if (n_server >= ao_app->get_favorite_list().size())
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
    f_server = ao_app->get_favorite_list().at(p_model.row());
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ui_description->clear();
 | 
			
		||||
  ui_description->append(f_server.desc);
 | 
			
		||||
 | 
			
		||||
  ui_description->moveCursor(QTextCursor::Start);
 | 
			
		||||
  ui_description->ensureCursorVisible();
 | 
			
		||||
 | 
			
		||||
  ui_player_count->setText(tr("Offline"));
 | 
			
		||||
 | 
			
		||||
  ui_connect->setEnabled(false);
 | 
			
		||||
 | 
			
		||||
  ao_app->net_manager->connect_to_server(f_server);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//doubleclicked on an item in the serverlist so we'll connect right away
 | 
			
		||||
void Lobby::on_server_list_doubleclicked(QModelIndex p_model)
 | 
			
		||||
{
 | 
			
		||||
    on_server_list_clicked(p_model);
 | 
			
		||||
    on_connect_released();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_chatfield_return_pressed()
 | 
			
		||||
{
 | 
			
		||||
  //no you can't send empty messages
 | 
			
		||||
  if (ui_chatname->text() == "" || ui_chatmessage->text() == "")
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  QString f_header = "CT";
 | 
			
		||||
  QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()};
 | 
			
		||||
 | 
			
		||||
  AOPacket *f_packet = new AOPacket(f_header, f_contents);
 | 
			
		||||
 | 
			
		||||
  ao_app->send_ms_packet(f_packet);
 | 
			
		||||
 | 
			
		||||
  ui_chatmessage->clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::list_servers()
 | 
			
		||||
{
 | 
			
		||||
  public_servers_selected = true;
 | 
			
		||||
  ui_favorites->set_image("favorites.png");
 | 
			
		||||
  ui_public_servers->set_image("publicservers_selected.png");
 | 
			
		||||
 | 
			
		||||
  ui_server_list->clear();
 | 
			
		||||
 | 
			
		||||
  for (server_type i_server : ao_app->get_server_list())
 | 
			
		||||
  {
 | 
			
		||||
    ui_server_list->addItem(i_server.name);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::list_favorites()
 | 
			
		||||
{
 | 
			
		||||
  ui_server_list->clear();
 | 
			
		||||
 | 
			
		||||
  for (server_type i_server : ao_app->get_favorite_list())
 | 
			
		||||
  {
 | 
			
		||||
    ui_server_list->addItem(i_server.name);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::append_chatmessage(QString f_name, QString f_message)
 | 
			
		||||
{
 | 
			
		||||
          .arg(ao_app->get_version_string());
 | 
			
		||||
  QMessageBox::about(this, "About", msg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// clicked on an item in the serverlist
 | 
			
		||||
void Lobby::on_server_list_clicked(QModelIndex p_model)
 | 
			
		||||
{
 | 
			
		||||
  if (p_model != last_model) {
 | 
			
		||||
    server_type f_server;
 | 
			
		||||
    last_model = p_model;
 | 
			
		||||
    int n_server = p_model.row();
 | 
			
		||||
 | 
			
		||||
    if (n_server < 0)
 | 
			
		||||
      return;
 | 
			
		||||
 | 
			
		||||
    if (public_servers_selected) {
 | 
			
		||||
      QVector<server_type> f_server_list = ao_app->get_server_list();
 | 
			
		||||
 | 
			
		||||
      if (n_server >= f_server_list.size())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
      f_server = f_server_list.at(p_model.row());
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      if (n_server >= ao_app->get_favorite_list().size())
 | 
			
		||||
        return;
 | 
			
		||||
 | 
			
		||||
      f_server = ao_app->get_favorite_list().at(p_model.row());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    ui_description->clear();
 | 
			
		||||
    ui_description->append(f_server.desc);
 | 
			
		||||
 | 
			
		||||
    ui_description->moveCursor(QTextCursor::Start);
 | 
			
		||||
    ui_description->ensureCursorVisible();
 | 
			
		||||
 | 
			
		||||
    ui_player_count->setText(tr("Offline"));
 | 
			
		||||
 | 
			
		||||
    ui_connect->setEnabled(false);
 | 
			
		||||
 | 
			
		||||
    ao_app->net_manager->connect_to_server(f_server);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// doubleclicked on an item in the serverlist so we'll connect right away
 | 
			
		||||
void Lobby::on_server_list_doubleclicked(QModelIndex p_model)
 | 
			
		||||
{
 | 
			
		||||
  on_server_list_clicked(p_model);
 | 
			
		||||
  on_connect_released();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::on_chatfield_return_pressed()
 | 
			
		||||
{
 | 
			
		||||
  // no you can't send empty messages
 | 
			
		||||
  if (ui_chatname->text() == "" || ui_chatmessage->text() == "")
 | 
			
		||||
    return;
 | 
			
		||||
 | 
			
		||||
  QString f_header = "CT";
 | 
			
		||||
  QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()};
 | 
			
		||||
 | 
			
		||||
  AOPacket *f_packet = new AOPacket(f_header, f_contents);
 | 
			
		||||
 | 
			
		||||
  ao_app->send_ms_packet(f_packet);
 | 
			
		||||
 | 
			
		||||
  ui_chatmessage->clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::list_servers()
 | 
			
		||||
{
 | 
			
		||||
  public_servers_selected = true;
 | 
			
		||||
  ui_favorites->set_image("favorites.png");
 | 
			
		||||
  ui_public_servers->set_image("publicservers_selected.png");
 | 
			
		||||
 | 
			
		||||
  ui_server_list->clear();
 | 
			
		||||
 | 
			
		||||
  for (server_type i_server : ao_app->get_server_list()) {
 | 
			
		||||
    ui_server_list->addItem(i_server.name);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::list_favorites()
 | 
			
		||||
{
 | 
			
		||||
  ui_server_list->clear();
 | 
			
		||||
 | 
			
		||||
  for (server_type i_server : ao_app->get_favorite_list()) {
 | 
			
		||||
    ui_server_list->addItem(i_server.name);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::append_chatmessage(QString f_name, QString f_message)
 | 
			
		||||
{
 | 
			
		||||
  ui_chatbox->append_chatmessage(
 | 
			
		||||
      f_name, f_message,
 | 
			
		||||
      ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(),
 | 
			
		||||
      false);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::append_error(QString f_message)
 | 
			
		||||
{
 | 
			
		||||
  ui_chatbox->append_error(f_message);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::set_player_count(int players_online, int max_players)
 | 
			
		||||
{
 | 
			
		||||
  QString f_string = tr("Online: %1/%2").arg(QString::number(players_online)).arg(QString::number(max_players));
 | 
			
		||||
  ui_player_count->setText(f_string);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::enable_connect_button()
 | 
			
		||||
{
 | 
			
		||||
  ui_connect->setEnabled(true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Lobby::~Lobby()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::append_error(QString f_message)
 | 
			
		||||
{
 | 
			
		||||
  ui_chatbox->append_error(f_message);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::set_player_count(int players_online, int max_players)
 | 
			
		||||
{
 | 
			
		||||
  QString f_string = tr("Online: %1/%2")
 | 
			
		||||
                         .arg(QString::number(players_online))
 | 
			
		||||
                         .arg(QString::number(max_players));
 | 
			
		||||
  ui_player_count->setText(f_string);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Lobby::enable_connect_button() { ui_connect->setEnabled(true); }
 | 
			
		||||
 | 
			
		||||
Lobby::~Lobby() {}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										53
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										53
									
								
								src/main.cpp
									
									
									
									
									
								
							@ -1,43 +1,44 @@
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
 | 
			
		||||
#include "datatypes.h"
 | 
			
		||||
#include "networkmanager.h"
 | 
			
		||||
#include "lobby.h"
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
#include <QPluginLoader>
 | 
			
		||||
#include "datatypes.h"
 | 
			
		||||
#include "lobby.h"
 | 
			
		||||
#include "networkmanager.h"
 | 
			
		||||
#include <QDebug>
 | 
			
		||||
#include <QTranslator>
 | 
			
		||||
#include <QLibraryInfo>
 | 
			
		||||
#include <QPluginLoader>
 | 
			
		||||
#include <QTranslator>
 | 
			
		||||
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
 | 
			
		||||
    // High-DPI support is for Qt version >=5.6.
 | 
			
		||||
    // However, many Linux distros still haven't brought their stable/LTS
 | 
			
		||||
    // packages up to Qt 5.6, so this is conditional.
 | 
			
		||||
    AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
 | 
			
		||||
  // High-DPI support is for Qt version >=5.6.
 | 
			
		||||
  // However, many Linux distros still haven't brought their stable/LTS
 | 
			
		||||
  // packages up to Qt 5.6, so this is conditional.
 | 
			
		||||
  AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    AOApplication main_app(argc, argv);
 | 
			
		||||
  AOApplication main_app(argc, argv);
 | 
			
		||||
 | 
			
		||||
    QSettings *configini = main_app.configini;
 | 
			
		||||
  QSettings *configini = main_app.configini;
 | 
			
		||||
 | 
			
		||||
    QString p_language = configini->value("language", QLocale::system().name()).toString();
 | 
			
		||||
    if (p_language == "  " || p_language == "")
 | 
			
		||||
        p_language = QLocale::system().name();
 | 
			
		||||
  QString p_language =
 | 
			
		||||
      configini->value("language", QLocale::system().name()).toString();
 | 
			
		||||
  if (p_language == "  " || p_language == "")
 | 
			
		||||
    p_language = QLocale::system().name();
 | 
			
		||||
 | 
			
		||||
    QTranslator qtTranslator;
 | 
			
		||||
    qtTranslator.load("qt_" + p_language,
 | 
			
		||||
            QLibraryInfo::location(QLibraryInfo::TranslationsPath));
 | 
			
		||||
    main_app.installTranslator(&qtTranslator);
 | 
			
		||||
  QTranslator qtTranslator;
 | 
			
		||||
  qtTranslator.load("qt_" + p_language,
 | 
			
		||||
                    QLibraryInfo::location(QLibraryInfo::TranslationsPath));
 | 
			
		||||
  main_app.installTranslator(&qtTranslator);
 | 
			
		||||
 | 
			
		||||
    QTranslator appTranslator;
 | 
			
		||||
    qDebug() << ":/resource/translations/ao_" + p_language;
 | 
			
		||||
    appTranslator.load("ao_" + p_language, ":/resource/translations/");
 | 
			
		||||
    main_app.installTranslator(&appTranslator);
 | 
			
		||||
  QTranslator appTranslator;
 | 
			
		||||
  qDebug() << ":/resource/translations/ao_" + p_language;
 | 
			
		||||
  appTranslator.load("ao_" + p_language, ":/resource/translations/");
 | 
			
		||||
  main_app.installTranslator(&appTranslator);
 | 
			
		||||
 | 
			
		||||
    main_app.construct_lobby();
 | 
			
		||||
    main_app.w_lobby->show();
 | 
			
		||||
    main_app.net_manager->connect_to_master();
 | 
			
		||||
    return main_app.exec();
 | 
			
		||||
  main_app.construct_lobby();
 | 
			
		||||
  main_app.w_lobby->show();
 | 
			
		||||
  main_app.net_manager->connect_to_master();
 | 
			
		||||
  return main_app.exec();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,6 @@ void delay(int p_milliseconds)
 | 
			
		||||
{
 | 
			
		||||
  QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds);
 | 
			
		||||
 | 
			
		||||
  while(QTime::currentTime() < dieTime)
 | 
			
		||||
  while (QTime::currentTime() < dieTime)
 | 
			
		||||
    QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -13,21 +13,23 @@ NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent)
 | 
			
		||||
 | 
			
		||||
  ms_reconnect_timer = new QTimer(this);
 | 
			
		||||
  ms_reconnect_timer->setSingleShot(true);
 | 
			
		||||
  QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect()));
 | 
			
		||||
  QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this,
 | 
			
		||||
                   SLOT(retry_ms_connect()));
 | 
			
		||||
 | 
			
		||||
  QObject::connect(ms_socket, SIGNAL(readyRead()), this, SLOT(handle_ms_packet()));
 | 
			
		||||
  QObject::connect(server_socket, SIGNAL(readyRead()), this, SLOT(handle_server_packet()));
 | 
			
		||||
  QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, SLOT(server_disconnected()));
 | 
			
		||||
  QObject::connect(ms_socket, SIGNAL(readyRead()), this,
 | 
			
		||||
                   SLOT(handle_ms_packet()));
 | 
			
		||||
  QObject::connect(server_socket, SIGNAL(readyRead()), this,
 | 
			
		||||
                   SLOT(handle_server_packet()));
 | 
			
		||||
  QObject::connect(server_socket, SIGNAL(disconnected()), ao_app,
 | 
			
		||||
                   SLOT(server_disconnected()));
 | 
			
		||||
 | 
			
		||||
  QString master_config = ao_app->configini->value("master", "").value<QString>();
 | 
			
		||||
  QString master_config =
 | 
			
		||||
      ao_app->configini->value("master", "").value<QString>();
 | 
			
		||||
  if (master_config != "")
 | 
			
		||||
    ms_nosrv_hostname = master_config;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
NetworkManager::~NetworkManager()
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
NetworkManager::~NetworkManager() {}
 | 
			
		||||
 | 
			
		||||
void NetworkManager::connect_to_master()
 | 
			
		||||
{
 | 
			
		||||
@ -43,11 +45,11 @@ void NetworkManager::connect_to_master()
 | 
			
		||||
 | 
			
		||||
void NetworkManager::connect_to_master_nosrv()
 | 
			
		||||
{
 | 
			
		||||
  QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
 | 
			
		||||
                   this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
 | 
			
		||||
  QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
 | 
			
		||||
                   SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
 | 
			
		||||
 | 
			
		||||
  QObject::connect(ms_socket, SIGNAL(connected()),
 | 
			
		||||
                   this, SLOT(on_ms_nosrv_connect_success()));
 | 
			
		||||
  QObject::connect(ms_socket, SIGNAL(connected()), this,
 | 
			
		||||
                   SLOT(on_ms_nosrv_connect_success()));
 | 
			
		||||
  ms_socket->connectToHost(ms_nosrv_hostname, ms_port);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -61,12 +63,10 @@ void NetworkManager::connect_to_server(server_type p_server)
 | 
			
		||||
 | 
			
		||||
void NetworkManager::ship_ms_packet(QString p_packet)
 | 
			
		||||
{
 | 
			
		||||
  if (!ms_socket->isOpen())
 | 
			
		||||
  {
 | 
			
		||||
  if (!ms_socket->isOpen()) {
 | 
			
		||||
    retry_ms_connect();
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    ms_socket->write(p_packet.toUtf8());
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@ -81,93 +81,86 @@ void NetworkManager::handle_ms_packet()
 | 
			
		||||
  QByteArray buffer = ms_socket->readAll();
 | 
			
		||||
  QString in_data = QString::fromUtf8(buffer, buffer.size());
 | 
			
		||||
 | 
			
		||||
  if (!in_data.endsWith("%"))
 | 
			
		||||
  {
 | 
			
		||||
  if (!in_data.endsWith("%")) {
 | 
			
		||||
    ms_partial_packet = true;
 | 
			
		||||
    ms_temp_packet += in_data;
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    if (ms_partial_packet)
 | 
			
		||||
    {
 | 
			
		||||
  else {
 | 
			
		||||
    if (ms_partial_packet) {
 | 
			
		||||
      in_data = ms_temp_packet + in_data;
 | 
			
		||||
      ms_temp_packet = "";
 | 
			
		||||
      ms_partial_packet = false;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
 | 
			
		||||
  QStringList packet_list =
 | 
			
		||||
      in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
 | 
			
		||||
 | 
			
		||||
  for (QString packet : packet_list)
 | 
			
		||||
  {
 | 
			
		||||
  for (QString packet : packet_list) {
 | 
			
		||||
    AOPacket *f_packet = new AOPacket(packet);
 | 
			
		||||
 | 
			
		||||
    ao_app->ms_packet_received(f_packet);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void NetworkManager::perform_srv_lookup()
 | 
			
		||||
{
 | 
			
		||||
  #ifdef MS_FAILOVER_SUPPORTED
 | 
			
		||||
#ifdef MS_FAILOVER_SUPPORTED
 | 
			
		||||
  ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this);
 | 
			
		||||
 | 
			
		||||
  connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup()));
 | 
			
		||||
  ms_dns->lookup();
 | 
			
		||||
  #endif
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void NetworkManager::on_srv_lookup()
 | 
			
		||||
{
 | 
			
		||||
  #ifdef MS_FAILOVER_SUPPORTED
 | 
			
		||||
#ifdef MS_FAILOVER_SUPPORTED
 | 
			
		||||
  bool connected = false;
 | 
			
		||||
  if (ms_dns->error() != QDnsLookup::NoError)
 | 
			
		||||
  {
 | 
			
		||||
  if (ms_dns->error() != QDnsLookup::NoError) {
 | 
			
		||||
    qWarning("SRV lookup of the master server DNS failed.");
 | 
			
		||||
    ms_dns->deleteLater();
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
  else {
 | 
			
		||||
    const auto srv_records = ms_dns->serviceRecords();
 | 
			
		||||
 | 
			
		||||
    for (const QDnsServiceRecord &record : srv_records)
 | 
			
		||||
    {
 | 
			
		||||
      #ifdef DEBUG_NETWORK
 | 
			
		||||
    for (const QDnsServiceRecord &record : srv_records) {
 | 
			
		||||
#ifdef DEBUG_NETWORK
 | 
			
		||||
      qDebug() << "Connecting to " << record.target() << ":" << record.port();
 | 
			
		||||
      #endif
 | 
			
		||||
#endif
 | 
			
		||||
      ms_socket->connectToHost(record.target(), record.port());
 | 
			
		||||
      QTime timer;
 | 
			
		||||
      timer.start();
 | 
			
		||||
      do
 | 
			
		||||
      {
 | 
			
		||||
      do {
 | 
			
		||||
        ao_app->processEvents();
 | 
			
		||||
        if (ms_socket->state() == QAbstractSocket::ConnectedState)
 | 
			
		||||
        {
 | 
			
		||||
        if (ms_socket->state() == QAbstractSocket::ConnectedState) {
 | 
			
		||||
          connected = true;
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
        else if (ms_socket->state() != QAbstractSocket::ConnectingState
 | 
			
		||||
                 && ms_socket->state() != QAbstractSocket::HostLookupState
 | 
			
		||||
                 && ms_socket->error() != -1)
 | 
			
		||||
        {
 | 
			
		||||
        else if (ms_socket->state() != QAbstractSocket::ConnectingState &&
 | 
			
		||||
                 ms_socket->state() != QAbstractSocket::HostLookupState &&
 | 
			
		||||
                 ms_socket->error() != -1) {
 | 
			
		||||
          qDebug() << ms_socket->error();
 | 
			
		||||
          qWarning() << "Error connecting to master server:" << ms_socket->errorString();
 | 
			
		||||
          qWarning() << "Error connecting to master server:"
 | 
			
		||||
                     << ms_socket->errorString();
 | 
			
		||||
          ms_socket->abort();
 | 
			
		||||
          ms_socket->close();
 | 
			
		||||
          break;
 | 
			
		||||
        }
 | 
			
		||||
      } while (timer.elapsed() < timeout_milliseconds); // Very expensive spin-wait loop - it will bring CPU to 100%!
 | 
			
		||||
      if (connected)
 | 
			
		||||
      {
 | 
			
		||||
        // Connect a one-shot signal in case the master server disconnects randomly
 | 
			
		||||
        QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
 | 
			
		||||
                         this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
 | 
			
		||||
      } while (timer.elapsed() <
 | 
			
		||||
               timeout_milliseconds); // Very expensive spin-wait loop - it will
 | 
			
		||||
                                      // bring CPU to 100%!
 | 
			
		||||
      if (connected) {
 | 
			
		||||
        // Connect a one-shot signal in case the master server disconnects
 | 
			
		||||
        // randomly
 | 
			
		||||
        QObject::connect(
 | 
			
		||||
            ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
 | 
			
		||||
            SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
 | 
			
		||||
        break;
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
      else {
 | 
			
		||||
        ms_socket->abort();
 | 
			
		||||
        ms_socket->close();
 | 
			
		||||
      }
 | 
			
		||||
@ -179,29 +172,30 @@ void NetworkManager::on_srv_lookup()
 | 
			
		||||
    connect_to_master_nosrv();
 | 
			
		||||
  else
 | 
			
		||||
    emit ms_connect_finished(connected, false);
 | 
			
		||||
  #endif
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void NetworkManager::on_ms_nosrv_connect_success()
 | 
			
		||||
{
 | 
			
		||||
  emit ms_connect_finished(true, false);
 | 
			
		||||
 | 
			
		||||
  QObject::disconnect(ms_socket, SIGNAL(connected()),
 | 
			
		||||
                   this, SLOT(on_ms_nosrv_connect_success()));
 | 
			
		||||
  QObject::disconnect(ms_socket, SIGNAL(connected()), this,
 | 
			
		||||
                      SLOT(on_ms_nosrv_connect_success()));
 | 
			
		||||
 | 
			
		||||
  QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
 | 
			
		||||
                   this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
 | 
			
		||||
  QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
 | 
			
		||||
                   SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error)
 | 
			
		||||
{
 | 
			
		||||
  qWarning() << "Master server socket error:" << ms_socket->errorString()
 | 
			
		||||
             << "(" << error << ")";
 | 
			
		||||
  qWarning() << "Master server socket error:" << ms_socket->errorString() << "("
 | 
			
		||||
             << error << ")";
 | 
			
		||||
 | 
			
		||||
  // Disconnect the one-shot signal - this way, failover connect attempts
 | 
			
		||||
  // don't trigger a full retry
 | 
			
		||||
  QObject::disconnect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
 | 
			
		||||
                   this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
 | 
			
		||||
                      this,
 | 
			
		||||
                      SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
 | 
			
		||||
 | 
			
		||||
  emit ms_connect_finished(false, true);
 | 
			
		||||
 | 
			
		||||
@ -210,7 +204,8 @@ void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error)
 | 
			
		||||
 | 
			
		||||
void NetworkManager::retry_ms_connect()
 | 
			
		||||
{
 | 
			
		||||
  if (!ms_reconnect_timer->isActive() && ms_socket->state() != QAbstractSocket::ConnectingState)
 | 
			
		||||
  if (!ms_reconnect_timer->isActive() &&
 | 
			
		||||
      ms_socket->state() != QAbstractSocket::ConnectingState)
 | 
			
		||||
    connect_to_master();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -219,27 +214,24 @@ void NetworkManager::handle_server_packet()
 | 
			
		||||
  QByteArray buffer = server_socket->readAll();
 | 
			
		||||
  QString in_data = QString::fromUtf8(buffer, buffer.size());
 | 
			
		||||
 | 
			
		||||
  if (!in_data.endsWith("%"))
 | 
			
		||||
  {
 | 
			
		||||
  if (!in_data.endsWith("%")) {
 | 
			
		||||
    partial_packet = true;
 | 
			
		||||
    temp_packet += in_data;
 | 
			
		||||
    return;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
    if (partial_packet)
 | 
			
		||||
    {
 | 
			
		||||
  else {
 | 
			
		||||
    if (partial_packet) {
 | 
			
		||||
      in_data = temp_packet + in_data;
 | 
			
		||||
      temp_packet = "";
 | 
			
		||||
      partial_packet = false;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
 | 
			
		||||
  QStringList packet_list =
 | 
			
		||||
      in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
 | 
			
		||||
 | 
			
		||||
  for (QString packet : packet_list)
 | 
			
		||||
  {
 | 
			
		||||
  for (QString packet : packet_list) {
 | 
			
		||||
    AOPacket *f_packet = new AOPacket(packet);
 | 
			
		||||
 | 
			
		||||
    ao_app->server_packet_received(f_packet);
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1,191 +1,191 @@
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
#include <QRegExp>
 | 
			
		||||
 | 
			
		||||
#ifdef BASE_OVERRIDE
 | 
			
		||||
#include "base_override.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
//this is a quite broad generalization
 | 
			
		||||
//the most common OSes(mac and windows) are _usually_ case insensitive
 | 
			
		||||
//however, there do exist mac installations with case sensitive filesystems
 | 
			
		||||
//in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac
 | 
			
		||||
#if (defined (LINUX) || defined (__linux__))
 | 
			
		||||
#define CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_base_path()
 | 
			
		||||
{
 | 
			
		||||
  QString base_path = "";
 | 
			
		||||
#ifdef ANDROID
 | 
			
		||||
  QString sdcard_storage = getenv("SECONDARY_STORAGE");
 | 
			
		||||
  if (dir_exists(sdcard_storage + "/AO2/")){
 | 
			
		||||
    base_path = sdcard_storage + "/AO2/";
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    QString external_storage = getenv("EXTERNAL_STORAGE");
 | 
			
		||||
    base_path = external_storage + "/AO2/";
 | 
			
		||||
  }
 | 
			
		||||
#elif defined __APPLE__
 | 
			
		||||
  base_path = applicationDirPath() + "/../../../base/";
 | 
			
		||||
#else
 | 
			
		||||
  base_path = applicationDirPath() + "/base/";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  return base_path;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_data_path()
 | 
			
		||||
{
 | 
			
		||||
  return get_base_path() + "data/";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_default_theme_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "themes/default/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_custom_theme_path(QString p_theme, QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "themes/" + p_theme + "/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_theme_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "themes/" + current_theme + "/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_character_path(QString p_char, QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "characters/" + p_char + "/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_sounds_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "sounds/general/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_music_path(QString p_song)
 | 
			
		||||
{
 | 
			
		||||
  QString withending_check = get_base_path() + "sounds/music/" + p_song;
 | 
			
		||||
  QString mp3_check = get_base_path() + "sounds/music/" + p_song + ".mp3";
 | 
			
		||||
  QString opus_check = get_base_path() + "sounds/music/" + p_song + ".opus";
 | 
			
		||||
  if (file_exists(opus_check))
 | 
			
		||||
  {
 | 
			
		||||
    #ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
      return opus_check;
 | 
			
		||||
    #else
 | 
			
		||||
      return get_case_sensitive_path(opus_check);
 | 
			
		||||
    #endif
 | 
			
		||||
  }
 | 
			
		||||
  else if (file_exists(mp3_check))
 | 
			
		||||
  {
 | 
			
		||||
    #ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
      return mp3_check;
 | 
			
		||||
    #else
 | 
			
		||||
      return get_case_sensitive_path(mp3_check);
 | 
			
		||||
    #endif
 | 
			
		||||
  }
 | 
			
		||||
  else if (file_exists(withending_check))
 | 
			
		||||
  {
 | 
			
		||||
    #ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
      return withending_check;
 | 
			
		||||
    #else
 | 
			
		||||
      return get_case_sensitive_path(withending_check);
 | 
			
		||||
    #endif
 | 
			
		||||
  }
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return get_base_path() + "sounds/music/" + p_song + ".wav";
 | 
			
		||||
#include "aoapplication.h"
 | 
			
		||||
#include "courtroom.h"
 | 
			
		||||
#include "file_functions.h"
 | 
			
		||||
 | 
			
		||||
#include <QDir>
 | 
			
		||||
#include <QRegExp>
 | 
			
		||||
#include <QStandardPaths>
 | 
			
		||||
 | 
			
		||||
#ifdef BASE_OVERRIDE
 | 
			
		||||
#include "base_override.h"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// this is a quite broad generalization
 | 
			
		||||
// the most common OSes(mac and windows) are _usually_ case insensitive
 | 
			
		||||
// however, there do exist mac installations with case sensitive filesystems
 | 
			
		||||
// in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac
 | 
			
		||||
#if (defined(LINUX) || defined(__linux__))
 | 
			
		||||
#define CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_base_path()
 | 
			
		||||
{
 | 
			
		||||
  QString base_path = "";
 | 
			
		||||
#ifdef ANDROID
 | 
			
		||||
  QString sdcard_storage = getenv("SECONDARY_STORAGE");
 | 
			
		||||
  if (dir_exists(sdcard_storage + "/AO2/")) {
 | 
			
		||||
    base_path = sdcard_storage + "/AO2/";
 | 
			
		||||
  }
 | 
			
		||||
  else {
 | 
			
		||||
    QString external_storage = getenv("EXTERNAL_STORAGE");
 | 
			
		||||
    base_path = external_storage + "/AO2/";
 | 
			
		||||
  }
 | 
			
		||||
#elif defined __APPLE__
 | 
			
		||||
  base_path = applicationDirPath() + "/../../../base/";
 | 
			
		||||
#else
 | 
			
		||||
  base_path = applicationDirPath() + "/base/";
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
  return base_path;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_data_path() { return get_base_path() + "data/"; }
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_default_theme_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "themes/default/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_custom_theme_path(QString p_theme, QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "themes/" + p_theme + "/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_theme_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "themes/" + current_theme + "/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_character_path(QString p_char, QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "characters/" + p_char + "/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_sounds_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "sounds/general/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_music_path(QString p_song)
 | 
			
		||||
{
 | 
			
		||||
  QString withending_check = get_base_path() + "sounds/music/" + p_song;
 | 
			
		||||
  QString mp3_check = get_base_path() + "sounds/music/" + p_song + ".mp3";
 | 
			
		||||
  QString opus_check = get_base_path() + "sounds/music/" + p_song + ".opus";
 | 
			
		||||
  if (file_exists(opus_check)) {
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
    return opus_check;
 | 
			
		||||
#else
 | 
			
		||||
    return get_case_sensitive_path(opus_check);
 | 
			
		||||
#endif
 | 
			
		||||
  }
 | 
			
		||||
  else if (file_exists(mp3_check)) {
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
    return mp3_check;
 | 
			
		||||
#else
 | 
			
		||||
    return get_case_sensitive_path(mp3_check);
 | 
			
		||||
#endif
 | 
			
		||||
  }
 | 
			
		||||
  else if (file_exists(withending_check)) {
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
    return withending_check;
 | 
			
		||||
#else
 | 
			
		||||
    return get_case_sensitive_path(withending_check);
 | 
			
		||||
#endif
 | 
			
		||||
  }
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return get_base_path() + "sounds/music/" + p_song + ".wav";
 | 
			
		||||
  ;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".wav");
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_background_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "background/" + w_courtroom->get_current_background() + "/" + p_file;
 | 
			
		||||
  if (courtroom_constructed) {
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
    return path;
 | 
			
		||||
#else
 | 
			
		||||
    return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
  }
 | 
			
		||||
  return get_default_background_path(p_file);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_default_background_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "background/default/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_evidence_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "evidence/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_case_sensitive_path(QString p_file) {
 | 
			
		||||
  //first, check to see if it's actually there (also serves as base case for recursion)
 | 
			
		||||
  if (exists(p_file)) return p_file;
 | 
			
		||||
 | 
			
		||||
  QFileInfo file(p_file);
 | 
			
		||||
 | 
			
		||||
  QString file_basename = file.fileName();
 | 
			
		||||
  QString file_parent_dir = get_case_sensitive_path(file.absolutePath());
 | 
			
		||||
 | 
			
		||||
  //second, does it exist in the new parent dir?
 | 
			
		||||
  if (exists(file_parent_dir + "/" + file_basename))
 | 
			
		||||
    return file_parent_dir + "/" + file_basename;
 | 
			
		||||
 | 
			
		||||
  //last resort, dirlist parent dir and find case insensitive match
 | 
			
		||||
  QRegExp file_rx = QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString);
 | 
			
		||||
  QStringList files = QDir(file_parent_dir).entryList();
 | 
			
		||||
 | 
			
		||||
  int result = files.indexOf(file_rx);
 | 
			
		||||
 | 
			
		||||
  if (result != -1)
 | 
			
		||||
    return file_parent_dir + "/" + files.at(result);
 | 
			
		||||
 | 
			
		||||
  //if nothing is found, let the caller handle the missing file
 | 
			
		||||
  return file_parent_dir + "/" + file_basename;
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song +
 | 
			
		||||
                                 ".wav");
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_background_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "background/" +
 | 
			
		||||
                 w_courtroom->get_current_background() + "/" + p_file;
 | 
			
		||||
  if (courtroom_constructed) {
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
    return path;
 | 
			
		||||
#else
 | 
			
		||||
    return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
  }
 | 
			
		||||
  return get_default_background_path(p_file);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_default_background_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "background/default/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_evidence_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  QString path = get_base_path() + "evidence/" + p_file;
 | 
			
		||||
#ifndef CASE_SENSITIVE_FILESYSTEM
 | 
			
		||||
  return path;
 | 
			
		||||
#else
 | 
			
		||||
  return get_case_sensitive_path(path);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString AOApplication::get_case_sensitive_path(QString p_file)
 | 
			
		||||
{
 | 
			
		||||
  // first, check to see if it's actually there (also serves as base case for
 | 
			
		||||
  // recursion)
 | 
			
		||||
  if (exists(p_file))
 | 
			
		||||
    return p_file;
 | 
			
		||||
 | 
			
		||||
  QFileInfo file(p_file);
 | 
			
		||||
 | 
			
		||||
  QString file_basename = file.fileName();
 | 
			
		||||
  QString file_parent_dir = get_case_sensitive_path(file.absolutePath());
 | 
			
		||||
 | 
			
		||||
  // second, does it exist in the new parent dir?
 | 
			
		||||
  if (exists(file_parent_dir + "/" + file_basename))
 | 
			
		||||
    return file_parent_dir + "/" + file_basename;
 | 
			
		||||
 | 
			
		||||
  // last resort, dirlist parent dir and find case insensitive match
 | 
			
		||||
  QRegExp file_rx =
 | 
			
		||||
      QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString);
 | 
			
		||||
  QStringList files = QDir(file_parent_dir).entryList();
 | 
			
		||||
 | 
			
		||||
  int result = files.indexOf(file_rx);
 | 
			
		||||
 | 
			
		||||
  if (result != -1)
 | 
			
		||||
    return file_parent_dir + "/" + files.at(result);
 | 
			
		||||
 | 
			
		||||
  // if nothing is found, let the caller handle the missing file
 | 
			
		||||
  return file_parent_dir + "/" + file_basename;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user