Merge branch '2.7-rc'
Includes full code reformat. # Conflicts: # src/aomusicplayer.cpp # src/path_functions.cpp
This commit is contained in:
commit
bbdad2a40d
2
.gitignore
vendored
2
.gitignore
vendored
@ -33,3 +33,5 @@ discord/
|
|||||||
moc*
|
moc*
|
||||||
/Attorney_Online_CC_resource.rc
|
/Attorney_Online_CC_resource.rc
|
||||||
/attorney_online_cc_plugin_import.cpp
|
/attorney_online_cc_plugin_import.cpp
|
||||||
|
|
||||||
|
*.autosave
|
||||||
|
@ -16,6 +16,7 @@ HEADERS += $$files($$PWD/include/*.h)
|
|||||||
|
|
||||||
LIBS += -L$$PWD/lib
|
LIBS += -L$$PWD/lib
|
||||||
|
|
||||||
|
|
||||||
#DEFINES += DISCORD
|
#DEFINES += DISCORD
|
||||||
|
|
||||||
contains(DEFINES, DISCORD) {
|
contains(DEFINES, DISCORD) {
|
||||||
|
10
README.md
10
README.md
@ -157,19 +157,19 @@ Areas can be listed by clicking the A/M button (or `/switch_am`). The statuses o
|
|||||||
- `ic_chat_name`, which is an input field for your custom showname. Needs the same stuff.
|
- `ic_chat_name`, which is an input field for your custom showname. Needs the same stuff.
|
||||||
- `ao2_ic_chat_name`, which is the same as above, but comes into play when the background has a desk.
|
- `ao2_ic_chat_name`, which is the same as above, but comes into play when the background has a desk.
|
||||||
- Further comments on this: all `ao2_` UI elements come into play when the background has a desk. However, in AO2 nowadays, it's customary for every background to have a desk, even if it's just an empty gif. So you most likely have never seen the `ao2_`-less UI elements ever come into play, unless someone mis-named a desk or something.
|
- Further comments on this: all `ao2_` UI elements come into play when the background has a desk. However, in AO2 nowadays, it's customary for every background to have a desk, even if it's just an empty gif. So you most likely have never seen the `ao2_`-less UI elements ever come into play, unless someone mis-named a desk or something.
|
||||||
- `showname_enable` is a tickbox that toggles whether you should see shownames or not. This does not influence whether you can USE custom shownames or not, so you can have it off, while still showing a custom showname to everyone else. Needs X, Y, width, height as usual.
|
- `showname_enable` is a checkbox that toggles whether you should see shownames or not. This does not influence whether you can USE custom shownames or not, so you can have it off, while still showing a custom showname to everyone else. Needs X, Y, width, height as usual.
|
||||||
- `settings` is a plain button that takes up the OS's looks, like the 'Call mod' button. Takes the same arguments as above.
|
- `settings` is a plain button that takes up the OS's looks, like the 'Call mod' button. Takes the same arguments as above.
|
||||||
- You can also just type `/settings` in OOC.
|
- You can also just type `/settings` in OOC.
|
||||||
- `char_search` is a text input box on the character selection screen, which allows you to filter characters down to name. Needs the same arguments.
|
- `char_search` is a text input box on the character selection screen, which allows you to filter characters down to name. Needs the same arguments.
|
||||||
- `char_passworded` is a tickbox, that when ticked, shows all passworded characters on the character selection screen. Needs the same as above.
|
- `char_passworded` is a checkbox, that when ticked, shows all passworded characters on the character selection screen. Needs the same as above.
|
||||||
- `char_taken` is another tickbox, that does the same, but for characters that are taken.
|
- `char_taken` is another checkbox, that does the same, but for characters that are taken.
|
||||||
- `not_guilty` is a button similar to the CE / WT buttons, that if pressed, plays the Not Guilty verdict animation. Needs the same arguments.
|
- `not_guilty` is a button similar to the CE / WT buttons, that if pressed, plays the Not Guilty verdict animation. Needs the same arguments.
|
||||||
- `guilty` is similar to `not_guilty`, but for the Guilty verdict.
|
- `guilty` is similar to `not_guilty`, but for the Guilty verdict.
|
||||||
- `pair_button` is a toggleable button, that shows and hides the pairing list and the offset spinbox. Works similarly to the mute button.
|
- `pair_button` is a toggleable button, that shows and hides the pairing list and the offset spinbox. Works similarly to the mute button.
|
||||||
- `pair_list` is a list of all characters in alphabetical order, shown when the user presses the Pair button. If a character is clicked on it, it is selected as the character the user wants to pair up with.
|
- `pair_list` is a list of all characters in alphabetical order, shown when the user presses the Pair button. If a character is clicked on it, it is selected as the character the user wants to pair up with.
|
||||||
- `pair_offset_spinbox` is a spinbox that allows the user to choose between offsets of -100% to 100%.
|
- `pair_offset_spinbox` is a spinbox that allows the user to choose between offsets of -100% to 100%.
|
||||||
- `switch_area_music` is a button with the text 'A/M', that toggles between the music list and the areas list. Though the two are different, they are programmed to take the same space.
|
- `switch_area_music` is a button with the text 'A/M', that toggles between the music list and the areas list. Though the two are different, they are programmed to take the same space.
|
||||||
- `pre_no_interrupt` is a tickbox with the text 'No Intrpt', that toggles whether preanimations should delay the text or not.
|
- `pre_no_interrupt` is a checkbox with the text 'No Intrpt', that toggles whether preanimations should delay the text or not.
|
||||||
- `area_free_color` is a combination of red, green, and blue values ranging from 0 to 255. This determines the colour of the area in the Area list if it's free, and has a status of `IDLE`.
|
- `area_free_color` is a combination of red, green, and blue values ranging from 0 to 255. This determines the colour of the area in the Area list if it's free, and has a status of `IDLE`.
|
||||||
- `area_lfp_color` determines the colour of the area if its status is `LOOKING-FOR-PLAYERS`.
|
- `area_lfp_color` determines the colour of the area if its status is `LOOKING-FOR-PLAYERS`.
|
||||||
- `area_casing_color` determines the colour of the area if its status is `CASING`.
|
- `area_casing_color` determines the colour of the area if its status is `CASING`.
|
||||||
@ -180,7 +180,7 @@ Areas can be listed by clicking the A/M button (or `/switch_am`). The statuses o
|
|||||||
- `ooc_default_color` determines the colour of the username in the OOC chat if the message doesn't come from the server.
|
- `ooc_default_color` determines the colour of the username in the OOC chat if the message doesn't come from the server.
|
||||||
- `ooc_server_color` determines the colour of the username if the message arrived from the server.
|
- `ooc_server_color` determines the colour of the username if the message arrived from the server.
|
||||||
- `casing_button` is a button with the text 'Casing' that when clicked, brings up the Case Announcements dialog. You can give the case a name, and tick whom do you want to alert. You need to be a CM for it to go through. Only people who have at least one of the roles ticked will get the alert.
|
- `casing_button` is a button with the text 'Casing' that when clicked, brings up the Case Announcements dialog. You can give the case a name, and tick whom do you want to alert. You need to be a CM for it to go through. Only people who have at least one of the roles ticked will get the alert.
|
||||||
- `casing` is a tickbox with the text 'Casing'. If ticked, you will get the case announcements alerts you should get, in accordance to the above. In the settings, you can change your defaults on the 'Casing' tab. (That's a buncha things titled 'Casing'!)
|
- `casing` is a checkbox with the text 'Casing'. If ticked, you will get the case announcements alerts you should get, in accordance to the above. In the settings, you can change your defaults on the 'Casing' tab. (That's a buncha things titled 'Casing'!)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
@ -6,38 +6,36 @@
|
|||||||
#include "discord_rich_presence.h"
|
#include "discord_rich_presence.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QVector>
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QRect>
|
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#include <QRect>
|
||||||
|
|
||||||
#include <QCryptographicHash>
|
#include <QCryptographicHash>
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include <QTextStream>
|
|
||||||
#include <QStringList>
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QTextStream>
|
||||||
#ifdef QTAUDIO
|
#ifdef QTAUDIO
|
||||||
#include <QAudioDeviceInfo>
|
#include <QAudioDeviceInfo>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QFuture>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <QFuture>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
|
||||||
class NetworkManager;
|
class NetworkManager;
|
||||||
class Lobby;
|
class Lobby;
|
||||||
class Courtroom;
|
class Courtroom;
|
||||||
|
class AOApplication : public QApplication {
|
||||||
class AOApplication : public QApplication
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -89,7 +87,7 @@ public:
|
|||||||
|
|
||||||
///////////////loading info///////////////////
|
///////////////loading info///////////////////
|
||||||
|
|
||||||
//player number, it's hardly used but might be needed for some old servers
|
// player number, it's hardly used but might be needed for some old servers
|
||||||
int s_pv = 0;
|
int s_pv = 0;
|
||||||
|
|
||||||
QString server_software = "";
|
QString server_software = "";
|
||||||
@ -102,7 +100,6 @@ public:
|
|||||||
int music_list_size = 0;
|
int music_list_size = 0;
|
||||||
int loaded_music = 0;
|
int loaded_music = 0;
|
||||||
int area_count = 0;
|
int area_count = 0;
|
||||||
|
|
||||||
bool courtroom_loaded = false;
|
bool courtroom_loaded = false;
|
||||||
|
|
||||||
//////////////////versioning///////////////
|
//////////////////versioning///////////////
|
||||||
@ -115,19 +112,19 @@ public:
|
|||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
|
|
||||||
void set_favorite_list();
|
void set_favorite_list();
|
||||||
QVector<server_type>& get_favorite_list() {return favorite_list;}
|
QVector<server_type> &get_favorite_list() { return favorite_list; }
|
||||||
void add_favorite_server(int p_server);
|
void add_favorite_server(int p_server);
|
||||||
|
|
||||||
void set_server_list();
|
void set_server_list();
|
||||||
QVector<server_type>& get_server_list() {return server_list;}
|
QVector<server_type> &get_server_list() { return server_list; }
|
||||||
|
|
||||||
//reads the theme from config.ini and sets it accordingly
|
// reads the theme from config.ini and sets it accordingly
|
||||||
void reload_theme();
|
void reload_theme();
|
||||||
|
|
||||||
//Returns the character the player has currently selected
|
// Returns the character the player has currently selected
|
||||||
QString get_current_char();
|
QString get_current_char();
|
||||||
|
|
||||||
//implementation in path_functions.cpp
|
// implementation in path_functions.cpp
|
||||||
QString get_base_path();
|
QString get_base_path();
|
||||||
QString get_data_path();
|
QString get_data_path();
|
||||||
QString get_theme_path(QString p_file);
|
QString get_theme_path(QString p_file);
|
||||||
@ -147,31 +144,32 @@ public:
|
|||||||
// Instead of reinventing the wheel, we'll use a QSettings class.
|
// Instead of reinventing the wheel, we'll use a QSettings class.
|
||||||
QSettings *configini;
|
QSettings *configini;
|
||||||
|
|
||||||
//Reads the theme from config.ini and loads it into the current_theme variable
|
// Reads the theme from config.ini and loads it into the current_theme
|
||||||
|
// variable
|
||||||
QString read_theme();
|
QString read_theme();
|
||||||
|
|
||||||
//Returns the value of ooc_name in config.ini
|
// Returns the value of ooc_name in config.ini
|
||||||
QString get_ooc_name();
|
QString get_ooc_name();
|
||||||
|
|
||||||
//Returns the blip rate from config.ini
|
// Returns the blip rate from config.ini
|
||||||
int read_blip_rate();
|
int read_blip_rate();
|
||||||
|
|
||||||
//Returns true if blank blips is enabled in config.ini and false otherwise
|
// Returns true if blank blips is enabled in config.ini and false otherwise
|
||||||
bool get_blank_blip();
|
bool get_blank_blip();
|
||||||
|
|
||||||
//Returns true if looping sound effects are enabled in the config.ini
|
// Returns true if looping sound effects are enabled in the config.ini
|
||||||
bool get_looping_sfx();
|
bool get_looping_sfx();
|
||||||
|
|
||||||
//Returns true if kill music on object is enabled in the config.ini
|
// Returns true if kill music on object is enabled in the config.ini
|
||||||
bool get_objectmusic();
|
bool get_objectmusic();
|
||||||
|
|
||||||
//Returns the value of default_music in config.ini
|
// Returns the value of default_music in config.ini
|
||||||
int get_default_music();
|
int get_default_music();
|
||||||
|
|
||||||
//Returns the value of default_sfx in config.ini
|
// Returns the value of default_sfx in config.ini
|
||||||
int get_default_sfx();
|
int get_default_sfx();
|
||||||
|
|
||||||
//Returns the value of default_blip in config.ini
|
// Returns the value of default_blip in config.ini
|
||||||
int get_default_blip();
|
int get_default_blip();
|
||||||
|
|
||||||
// Returns the value of whether Discord should be enabled on startup
|
// Returns the value of whether Discord should be enabled on startup
|
||||||
@ -182,10 +180,18 @@ public:
|
|||||||
// from the config.ini.
|
// from the config.ini.
|
||||||
bool is_shakeandflash_enabled();
|
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
|
// Returns the value of the maximum amount of lines the IC chatlog
|
||||||
// may contain, from config.ini.
|
// may contain, from config.ini.
|
||||||
int get_max_log_size();
|
int get_max_log_size();
|
||||||
|
|
||||||
|
// Gets the punctuation delay modifier
|
||||||
|
bool get_pundelay();
|
||||||
|
|
||||||
|
//Gets whether slower text speed is enabled
|
||||||
|
bool get_slower_blips();
|
||||||
// Returns whether the log should go upwards (new behaviour)
|
// Returns whether the log should go upwards (new behaviour)
|
||||||
// or downwards (vanilla behaviour).
|
// or downwards (vanilla behaviour).
|
||||||
bool get_log_goes_downwards();
|
bool get_log_goes_downwards();
|
||||||
@ -195,119 +201,125 @@ public:
|
|||||||
|
|
||||||
// Returns the audio device used for the client.
|
// Returns the audio device used for the client.
|
||||||
QString get_audio_output_device();
|
QString get_audio_output_device();
|
||||||
#ifdef QTAUDIO
|
#ifdef QTAUDIO
|
||||||
QAudioDeviceInfo QtAudioDevice;
|
QAudioDeviceInfo QtAudioDevice;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Returns whether the user would like to have custom shownames on by default.
|
// Returns whether the user would like to have custom shownames on by default.
|
||||||
bool get_showname_enabled_by_default();
|
bool get_showname_enabled_by_default();
|
||||||
|
|
||||||
//Returns the list of words in callwords.ini
|
// Returns the list of words in callwords.ini
|
||||||
QStringList get_call_words();
|
QStringList get_call_words();
|
||||||
|
|
||||||
//Appends the argument string to serverlist.txt
|
// Appends the argument string to serverlist.txt
|
||||||
void write_to_serverlist_txt(QString p_line);
|
void write_to_serverlist_txt(QString p_line);
|
||||||
|
|
||||||
//Returns the contents of serverlist.txt
|
// Returns the contents of serverlist.txt
|
||||||
QVector<server_type> read_serverlist_txt();
|
QVector<server_type> read_serverlist_txt();
|
||||||
|
|
||||||
//Returns the value of p_identifier in the design.ini file in p_design_path
|
// 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);
|
QString read_design_ini(QString p_identifier, QString p_design_path);
|
||||||
|
|
||||||
//Returns the coordinates of widget with p_identifier from p_file
|
// Returns the coordinates of widget with p_identifier from p_file
|
||||||
QPoint get_button_spacing(QString p_identifier, QString p_file);
|
QPoint get_button_spacing(QString p_identifier, QString p_file);
|
||||||
|
|
||||||
//Returns the dimensions of widget with specified identifier from 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);
|
pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
|
||||||
|
|
||||||
//Returns the name of the font with p_identifier from p_file
|
// Returns the name of the font with p_identifier from p_file
|
||||||
QString get_font_name(QString p_identifier, QString p_file);
|
QString get_font_name(QString p_identifier, QString p_file);
|
||||||
|
|
||||||
//Returns the value of font_size with p_identifier from p_file
|
// Returns the value of font_size with p_identifier from p_file
|
||||||
int get_font_size(QString p_identifier, QString p_file);
|
int get_font_size(QString p_identifier, QString p_file);
|
||||||
|
|
||||||
//Returns the color with p_identifier from p_file
|
// Returns the color with p_identifier from p_file
|
||||||
QColor get_color(QString p_identifier, QString p_file);
|
QColor get_color(QString p_identifier, QString p_file);
|
||||||
|
|
||||||
// Returns the colour from the misc folder.
|
// Returns the colour from the misc folder.
|
||||||
QColor get_chat_color(QString p_identifier, QString p_chat);
|
QColor get_chat_color(QString p_identifier, QString p_chat);
|
||||||
|
|
||||||
//Returns the sfx with p_identifier from sounds.ini in the current theme path
|
// Returns the sfx with p_identifier from sounds.ini in the current theme path
|
||||||
QString get_sfx(QString p_identifier);
|
QString get_sfx(QString p_identifier);
|
||||||
|
|
||||||
//Figure out if we can opus this or if we should fall back to wav
|
// Figure out if we can opus this or if we should fall back to wav
|
||||||
QString get_sfx_suffix(QString sound_to_check);
|
QString get_sfx_suffix(QString sound_to_check);
|
||||||
|
|
||||||
// Can we use APNG for this? If not, fall back to a gif.
|
// 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);
|
QString get_image_suffix(QString path_to_check);
|
||||||
|
|
||||||
//Returns the value of p_search_line within target_tag and terminator_tag
|
// 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);
|
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
|
// Returns the side of the p_char character from that characters ini file
|
||||||
QString get_char_side(QString p_char);
|
QString get_char_side(QString p_char);
|
||||||
|
|
||||||
//Returns the showname from the ini of p_char
|
// Returns the showname from the ini of p_char
|
||||||
QString get_showname(QString p_char);
|
QString get_showname(QString p_char);
|
||||||
|
|
||||||
//Returns the value of chat from the specific p_char's ini file
|
// Returns the value of chat from the specific p_char's ini file
|
||||||
QString get_chat(QString p_char);
|
QString get_chat(QString p_char);
|
||||||
|
|
||||||
//Returns the value of shouts from the specified p_char's ini file
|
// Returns the value of shouts from the specified p_char's ini file
|
||||||
QString get_char_shouts(QString p_char);
|
QString get_char_shouts(QString p_char);
|
||||||
|
|
||||||
//Returns the preanim duration of p_char's p_emote
|
// Returns the preanim duration of p_char's p_emote
|
||||||
int get_preanim_duration(QString p_char, QString 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)
|
// 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);
|
int get_ao2_preanim_duration(QString p_char, QString p_emote);
|
||||||
|
|
||||||
//Not in use
|
// Not in use
|
||||||
int get_text_delay(QString p_char, QString p_emote);
|
int get_text_delay(QString p_char, QString p_emote);
|
||||||
|
|
||||||
// Returns the custom realisation used by the character.
|
// Returns the custom realisation used by the character.
|
||||||
QString get_custom_realization(QString p_char);
|
QString get_custom_realization(QString p_char);
|
||||||
|
|
||||||
//Returns the name of p_char
|
// Returns the name of p_char
|
||||||
QString get_char_name(QString p_char);
|
QString get_char_name(QString p_char);
|
||||||
|
|
||||||
//Returns the total amount of emotes of p_char
|
// Returns the total amount of emotes of p_char
|
||||||
int get_emote_number(QString p_char);
|
int get_emote_number(QString p_char);
|
||||||
|
|
||||||
//Returns the emote comment of p_char's p_emote
|
// Returns the emote comment of p_char's p_emote
|
||||||
QString get_emote_comment(QString p_char, int p_emote);
|
QString get_emote_comment(QString p_char, int p_emote);
|
||||||
|
|
||||||
//Returns the base name of p_char's p_emote
|
// Returns if an emote loops it's SFX
|
||||||
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);
|
QString get_sfx_looping(QString p_char, int p_emote);
|
||||||
|
|
||||||
//Returns if an emote has a frame specific SFX for it
|
// 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);
|
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
|
// Returns if an emote has a frame specific SFX for it
|
||||||
QString get_realization_frame(QString p_char, QString p_emote, int n_frame);
|
QString get_realization_frame(QString p_char, QString p_emote, int n_frame);
|
||||||
|
|
||||||
//Returns if an emote has a frame specific SFX for it
|
// Returns if an emote has a frame specific SFX for it
|
||||||
QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame);
|
QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame);
|
||||||
|
|
||||||
//Not in use
|
// 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);
|
int get_sfx_delay(QString p_char, int p_emote);
|
||||||
|
|
||||||
//Returns the modifier for p_char's p_emote
|
// Returns the modifier for p_char's p_emote
|
||||||
int get_emote_mod(QString p_char, int p_emote);
|
int get_emote_mod(QString p_char, int p_emote);
|
||||||
|
|
||||||
//Returns the desk modifier for p_char's p_emote
|
// Returns the desk modifier for p_char's p_emote
|
||||||
int get_desk_mod(QString p_char, int p_emote);
|
int get_desk_mod(QString p_char, int p_emote);
|
||||||
|
|
||||||
//Returns p_char's gender
|
// Returns p_char's gender
|
||||||
QString get_gender(QString p_char);
|
QString get_gender(QString p_char);
|
||||||
|
|
||||||
// ======
|
// ======
|
||||||
@ -326,6 +338,9 @@ public:
|
|||||||
// Same for judge.
|
// Same for judge.
|
||||||
bool get_casing_judge_enabled();
|
bool get_casing_judge_enabled();
|
||||||
|
|
||||||
|
// Same for witnesses.
|
||||||
|
bool get_casing_wit_enabled();
|
||||||
|
|
||||||
// Same for juror.
|
// Same for juror.
|
||||||
bool get_casing_juror_enabled();
|
bool get_casing_juror_enabled();
|
||||||
|
|
||||||
@ -335,12 +350,18 @@ public:
|
|||||||
// Same for CM.
|
// Same for CM.
|
||||||
bool get_casing_cm_enabled();
|
bool get_casing_cm_enabled();
|
||||||
|
|
||||||
// Same for witnesses.
|
|
||||||
bool get_casing_wit_enabled();
|
|
||||||
|
|
||||||
// Get the message for the CM for casing alerts.
|
// Get the message for the CM for casing alerts.
|
||||||
QString get_casing_can_host_cases();
|
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:
|
private:
|
||||||
const int RELEASE = 2;
|
const int RELEASE = 2;
|
||||||
const int MAJOR_VERSION = 7;
|
const int MAJOR_VERSION = 7;
|
||||||
|
@ -9,13 +9,11 @@
|
|||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
|
class AOBlipPlayer {
|
||||||
class AOBlipPlayer
|
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app);
|
AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||||
|
|
||||||
@ -32,11 +30,11 @@ private:
|
|||||||
|
|
||||||
void set_volume_internal(qreal p_volume);
|
void set_volume_internal(qreal p_volume);
|
||||||
|
|
||||||
#if defined(BASSAUDIO)
|
#if defined(BASSAUDIO)
|
||||||
HSTREAM m_stream_list[5];
|
HSTREAM m_stream_list[5];
|
||||||
#elif defined(QTAUDIO)
|
#elif defined(QTAUDIO)
|
||||||
QSoundEffect m_blips;
|
QSoundEffect m_blips;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOBLIPPLAYER_H
|
#endif // AOBLIPPLAYER_H
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
class AOButton : public QPushButton
|
class AOButton : public QPushButton {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -4,20 +4,21 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
#include "courtroom.h"
|
#include "courtroom.h"
|
||||||
|
|
||||||
#include <QtWidgets/QDialog>
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QtWidgets/QVBoxLayout>
|
|
||||||
#include <QtWidgets/QFormLayout>
|
|
||||||
#include <QtWidgets/QCheckBox>
|
#include <QtWidgets/QCheckBox>
|
||||||
|
#include <QtWidgets/QDialog>
|
||||||
|
#include <QtWidgets/QFormLayout>
|
||||||
#include <QtWidgets/QLabel>
|
#include <QtWidgets/QLabel>
|
||||||
#include <QtWidgets/QLineEdit>
|
#include <QtWidgets/QLineEdit>
|
||||||
|
#include <QtWidgets/QVBoxLayout>
|
||||||
|
|
||||||
class AOCaseAnnouncerDialog : public QDialog
|
class AOCaseAnnouncerDialog : public QDialog {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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:
|
private:
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
@ -4,17 +4,17 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
#include "aoimage.h"
|
#include "aoimage.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QFile>
|
|
||||||
|
|
||||||
class AOCharButton : public QPushButton
|
class AOCharButton : public QPushButton {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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;
|
AOApplication *ao_app;
|
||||||
|
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
#ifndef AOCHARMOVIE_H
|
#ifndef AOCHARMOVIE_H
|
||||||
#define AOCHARMOVIE_H
|
#define AOCHARMOVIE_H
|
||||||
|
|
||||||
#include <QMovie>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QImageReader>
|
|
||||||
#include <QPainter>
|
|
||||||
#include "include/aosfxplayer.h"
|
#include "include/aosfxplayer.h"
|
||||||
#include "include/courtroom.h"
|
#include "include/courtroom.h"
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QImageReader>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QMovie>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
class AOApplication;
|
class AOApplication;
|
||||||
class AOCharMovie : public QLabel
|
class AOCharMovie : public QLabel {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -24,12 +22,10 @@ public:
|
|||||||
void play_talking(QString p_char, QString p_emote);
|
void play_talking(QString p_char, QString p_emote);
|
||||||
void play_idle(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 LoadImageWithStupidMethodForFlipSupport(QImage image);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void move(int ax, int ay);
|
|
||||||
void combo_resize(int w, int h);
|
|
||||||
void play_frame_sfx();
|
void play_frame_sfx();
|
||||||
|
|
||||||
void sfx_two_network_boogaloo();
|
void sfx_two_network_boogaloo();
|
||||||
@ -42,6 +38,10 @@ public:
|
|||||||
QString frame_screenshake_hellstring = "";
|
QString frame_screenshake_hellstring = "";
|
||||||
QString frame_realization_hellstring = "";
|
QString frame_realization_hellstring = "";
|
||||||
bool use_networked_framehell = false;
|
bool use_networked_framehell = false;
|
||||||
|
|
||||||
|
void move(int ax, int ay);
|
||||||
|
void combo_resize(int w, int h);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
|
||||||
@ -52,14 +52,15 @@ private:
|
|||||||
QString last_path;
|
QString last_path;
|
||||||
QString current_emote;
|
QString current_emote;
|
||||||
QString current_char;
|
QString current_char;
|
||||||
|
int default_w;
|
||||||
|
int default_h;
|
||||||
|
|
||||||
const int time_mod = 62;
|
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 x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int default_w;
|
|
||||||
int default_h;
|
|
||||||
|
|
||||||
bool m_flipped = false;
|
bool m_flipped = false;
|
||||||
|
|
||||||
|
@ -3,22 +3,21 @@
|
|||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QPushButton>
|
||||||
|
|
||||||
class AOEmoteButton : public QPushButton
|
class AOEmoteButton : public QPushButton {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
|
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_on(QString p_char, int p_emote);
|
||||||
//void set_off(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_image(QString p_char, int p_emote, QString suffix);
|
||||||
|
|
||||||
void set_id(int p_id) {m_id = p_id;}
|
void set_id(int p_id) { m_id = p_id; }
|
||||||
int get_id() {return m_id;}
|
int get_id() { return m_id; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget *parent;
|
QWidget *parent;
|
||||||
|
@ -4,21 +4,21 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
#include "aoimage.h"
|
#include "aoimage.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
class AOEvidenceButton : public QPushButton
|
class AOEvidenceButton : public QPushButton {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
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 reset();
|
||||||
void set_image(QString p_image);
|
void set_image(QString p_image);
|
||||||
void set_theme_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);
|
void set_selected(bool p_selected);
|
||||||
|
|
||||||
|
@ -4,19 +4,18 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
#include "aosfxplayer.h"
|
#include "aosfxplayer.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
class AOEvidenceDisplay : public QLabel
|
class AOEvidenceDisplay : public QLabel {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app);
|
AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app);
|
||||||
|
|
||||||
void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume);
|
void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume);
|
||||||
QLabel* get_evidence_icon();
|
QLabel *get_evidence_icon();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
//This class represents a static theme-dependent image
|
// This class represents a static theme-dependent image
|
||||||
|
|
||||||
#ifndef AOIMAGE_H
|
#ifndef AOIMAGE_H
|
||||||
#define AOIMAGE_H
|
#define AOIMAGE_H
|
||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QLabel>
|
||||||
|
|
||||||
class AOImage : public QLabel
|
class AOImage : public QLabel {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
AOImage(QWidget *parent, AOApplication *p_ao_app);
|
AOImage(QWidget *parent, AOApplication *p_ao_app);
|
||||||
~AOImage();
|
~AOImage();
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
|
|
||||||
class AOLineEdit : public QLineEdit
|
class AOLineEdit : public QLineEdit {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -19,8 +18,6 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_enter_pressed();
|
void on_enter_pressed();
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOLINEEDIT_H
|
#endif // AOLINEEDIT_H
|
||||||
|
@ -7,21 +7,23 @@
|
|||||||
class Courtroom;
|
class Courtroom;
|
||||||
class AOApplication;
|
class AOApplication;
|
||||||
|
|
||||||
class AOMovie : public QLabel
|
class AOMovie : public QLabel {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AOMovie(QWidget *p_parent, AOApplication *p_ao_app);
|
AOMovie(QWidget *p_parent, AOApplication *p_ao_app);
|
||||||
|
|
||||||
void set_play_once(bool p_play_once);
|
void set_play_once(bool p_play_once);
|
||||||
void play(QString p_gif, QString p_char = "", QString p_custom_theme = "");
|
void start_timer(int delay);
|
||||||
|
void play(QString p_gif, QString p_char = "", QString p_custom_theme = "",
|
||||||
|
int default_duration = 0);
|
||||||
void combo_resize(int w, int h);
|
void combo_resize(int w, int h);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMovie *m_movie;
|
QMovie *m_movie;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
QTimer *timer;
|
||||||
bool play_once = true;
|
bool play_once = true;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@ -29,6 +31,7 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void frame_change(int n_frame);
|
void frame_change(int n_frame);
|
||||||
|
void timer_done();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOMOVIE_H
|
#endif // AOMOVIE_H
|
||||||
|
@ -9,15 +9,14 @@
|
|||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTimer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <QDebug>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QObject>
|
|
||||||
|
|
||||||
#if defined(BASSAUDIO)
|
#if defined(BASSAUDIO)
|
||||||
class AOMusicPlayer : public QObject
|
class AOMusicPlayer : public QObject {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||||
@ -38,11 +37,9 @@ private:
|
|||||||
QString f_path;
|
QString f_path;
|
||||||
|
|
||||||
HSTREAM m_stream;
|
HSTREAM m_stream;
|
||||||
|
|
||||||
};
|
};
|
||||||
#elif defined(QTAUDIO)
|
#elif defined(QTAUDIO)
|
||||||
class AOMusicPlayer : public QObject
|
class AOMusicPlayer : public QObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||||
~AOMusicPlayer();
|
~AOMusicPlayer();
|
||||||
@ -64,8 +61,7 @@ private:
|
|||||||
QString f_path;
|
QString f_path;
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
class AOMusicPlayer : public QObject
|
class AOMusicPlayer : public QObject {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||||
~AOMusicPlayer();
|
~AOMusicPlayer();
|
||||||
|
@ -29,103 +29,125 @@
|
|||||||
#include <QDirIterator>
|
#include <QDirIterator>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
|
|
||||||
class AOOptionsDialog: public QDialog
|
class AOOptionsDialog : public QDialog {
|
||||||
{
|
Q_OBJECT
|
||||||
Q_OBJECT
|
|
||||||
public:
|
public:
|
||||||
explicit AOOptionsDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr);
|
explicit AOOptionsDialog(QWidget *parent = nullptr,
|
||||||
|
AOApplication *p_ao_app = nullptr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
|
||||||
QVBoxLayout *ui_vertical_layout;
|
QVBoxLayout *ui_vertical_layout;
|
||||||
QTabWidget *ui_settings_tabs;
|
QTabWidget *ui_settings_tabs;
|
||||||
|
|
||||||
QWidget *ui_gameplay_tab;
|
QWidget *ui_gameplay_tab;
|
||||||
QWidget *ui_form_layout_widget;
|
QWidget *ui_form_layout_widget;
|
||||||
QFormLayout *ui_gameplay_form;
|
QFormLayout *ui_gameplay_form;
|
||||||
QLabel *ui_theme_label;
|
QLabel *ui_theme_label;
|
||||||
QComboBox *ui_theme_combobox;
|
QComboBox *ui_theme_combobox;
|
||||||
QFrame *ui_theme_log_divider;
|
QFrame *ui_theme_log_divider;
|
||||||
QLabel *ui_downwards_lbl;
|
QLabel *ui_downwards_lbl;
|
||||||
QCheckBox *ui_downwards_cb;
|
QCheckBox *ui_downwards_cb;
|
||||||
QLabel *ui_length_lbl;
|
QLabel *ui_length_lbl;
|
||||||
QSpinBox *ui_length_spinbox;
|
QSpinBox *ui_length_spinbox;
|
||||||
QFrame *ui_log_names_divider;
|
QLabel *ui_pun_delay;
|
||||||
QLineEdit *ui_username_textbox;
|
QCheckBox *ui_pun_delay_cb;
|
||||||
QLabel *ui_username_lbl;
|
QLabel *ui_slower_blips_lb;
|
||||||
QLabel *ui_showname_lbl;
|
QCheckBox *ui_slower_blips_cb;
|
||||||
QCheckBox *ui_showname_cb;
|
QLineEdit *ui_username_textbox;
|
||||||
QFrame *ui_net_divider;
|
QLabel *ui_username_lbl;
|
||||||
QLabel *ui_ms_lbl;
|
QLabel *ui_showname_lbl;
|
||||||
QLineEdit *ui_ms_textbox;
|
QCheckBox *ui_showname_cb;
|
||||||
QLabel *ui_discord_lbl;
|
QFrame *ui_net_divider;
|
||||||
QCheckBox *ui_discord_cb;
|
QLabel *ui_ms_lbl;
|
||||||
QLabel *ui_epilepsy_lbl;
|
QLineEdit *ui_ms_textbox;
|
||||||
QCheckBox *ui_epilepsy_cb;
|
QLabel *ui_discord_lbl;
|
||||||
QLabel *ui_language_label;
|
QLabel *ui_epilepsy_lbl;
|
||||||
QComboBox *ui_language_combobox;
|
QCheckBox *ui_epilepsy_cb;
|
||||||
|
|
||||||
QWidget *ui_callwords_tab;
|
QCheckBox *ui_discord_cb;
|
||||||
QWidget *ui_callwords_widget;
|
QLabel *ui_language_label;
|
||||||
QVBoxLayout *ui_callwords_layout;
|
QComboBox *ui_language_combobox;
|
||||||
QPlainTextEdit *ui_callwords_textbox;
|
|
||||||
QLabel *ui_callwords_explain_lbl;
|
|
||||||
QCheckBox *ui_callwords_char_textbox;
|
|
||||||
|
|
||||||
QWidget *ui_audio_tab;
|
QLabel *ui_keepevi_lbl;
|
||||||
QWidget *ui_audio_widget;
|
QCheckBox *ui_keepevi_cb;
|
||||||
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;
|
QLabel *ui_keepcobj_lbl;
|
||||||
QWidget *ui_casing_widget;
|
QCheckBox *ui_keepcobj_cb;
|
||||||
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;
|
|
||||||
|
|
||||||
bool needs_default_audiodev();
|
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:
|
signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void save_pressed();
|
void save_pressed();
|
||||||
void discard_pressed();
|
void discard_pressed();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOOPTIONSDIALOG_H
|
#endif // AOOPTIONSDIALOG_H
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
#ifndef AOPACKET_H
|
#ifndef AOPACKET_H
|
||||||
#define AOPACKET_H
|
#define AOPACKET_H
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
class AOPacket
|
class AOPacket {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
AOPacket(QString p_packet_string);
|
AOPacket(QString p_packet_string);
|
||||||
AOPacket(QString header, QStringList &p_contents);
|
AOPacket(QString header, QStringList &p_contents);
|
||||||
~AOPacket();
|
~AOPacket();
|
||||||
|
|
||||||
QString get_header() {return m_header;}
|
QString get_header() { return m_header; }
|
||||||
QStringList &get_contents() {return m_contents;}
|
QStringList &get_contents() { return m_contents; }
|
||||||
QString to_string();
|
QString to_string();
|
||||||
|
|
||||||
void encrypt_header(unsigned int p_key);
|
void encrypt_header(unsigned int p_key);
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
#ifndef AOSCENE_H
|
#ifndef AOSCENE_H
|
||||||
#define AOSCENE_H
|
#define AOSCENE_H
|
||||||
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QLabel>
|
||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
|
|
||||||
class Courtroom;
|
class Courtroom;
|
||||||
class AOApplication;
|
class AOApplication;
|
||||||
|
|
||||||
class AOScene : public QLabel
|
class AOScene : public QLabel {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AOScene(QWidget *parent, AOApplication *p_ao_app);
|
explicit AOScene(QWidget *parent, AOApplication *p_ao_app);
|
||||||
@ -21,7 +20,7 @@ private:
|
|||||||
QWidget *m_parent;
|
QWidget *m_parent;
|
||||||
QMovie *m_movie;
|
QMovie *m_movie;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
QString last_image;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOSCENE_H
|
#endif // AOSCENE_H
|
||||||
|
@ -9,13 +9,12 @@
|
|||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <string.h>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
class AOSfxPlayer : public QObject
|
class AOSfxPlayer : public QObject {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
|
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||||
@ -33,11 +32,11 @@ private:
|
|||||||
|
|
||||||
void set_volume_internal(qreal p_volume);
|
void set_volume_internal(qreal p_volume);
|
||||||
|
|
||||||
#if defined(BASSAUDIO)
|
#if defined(BASSAUDIO)
|
||||||
HSTREAM m_stream;
|
HSTREAM m_stream;
|
||||||
#elif defined(QTAUDIO)
|
#elif defined(QTAUDIO)
|
||||||
QSoundEffect m_sfx;
|
QSoundEffect m_sfx;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOSFXPLAYER_H
|
#endif // AOSFXPLAYER_H
|
||||||
|
@ -1,24 +1,25 @@
|
|||||||
#ifndef AOTEXTAREA_H
|
#ifndef AOTEXTAREA_H
|
||||||
#define AOTEXTAREA_H
|
#define AOTEXTAREA_H
|
||||||
|
|
||||||
#include <QTextBrowser>
|
|
||||||
#include <QScrollBar>
|
|
||||||
#include <QTextCursor>
|
|
||||||
#include <QRegExp>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QRegExp>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QTextBrowser>
|
||||||
|
#include <QTextCursor>
|
||||||
|
|
||||||
class AOTextArea : public QTextBrowser
|
class AOTextArea : public QTextBrowser {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
AOTextArea(QWidget *p_parent = nullptr);
|
AOTextArea(QWidget *p_parent = nullptr);
|
||||||
|
|
||||||
void append_chatmessage(QString p_name, QString p_message, QString p_colour);
|
void append_chatmessage(QString p_name, QString p_message, QString p_colour,
|
||||||
|
bool song);
|
||||||
void append_error(QString p_message);
|
void append_error(QString p_message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const QRegExp omnis_dank_url_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
|
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
|
#endif // AOTEXTAREA_H
|
||||||
|
@ -3,8 +3,7 @@
|
|||||||
|
|
||||||
#include <QPlainTextEdit>
|
#include <QPlainTextEdit>
|
||||||
|
|
||||||
class AOTextEdit : public QPlainTextEdit
|
class AOTextEdit : public QPlainTextEdit {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
AOTextEdit(QWidget *parent);
|
AOTextEdit(QWidget *parent);
|
||||||
@ -17,7 +16,6 @@ signals:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_enter_pressed();
|
void on_enter_pressed();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AOTEXTEDIT_H
|
#endif // AOTEXTEDIT_H
|
||||||
|
1562
include/bass.h
1562
include/bass.h
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,23 @@
|
|||||||
#ifndef CHATLOGPIECE_H
|
#ifndef CHATLOGPIECE_H
|
||||||
#define CHATLOGPIECE_H
|
#define CHATLOGPIECE_H
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
class chatlogpiece
|
class chatlogpiece {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
chatlogpiece();
|
chatlogpiece();
|
||||||
chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song);
|
chatlogpiece(QString p_name, QString p_showname, QString p_message,
|
||||||
chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime);
|
bool p_song, int color);
|
||||||
|
chatlogpiece(QString p_name, QString p_showname, QString p_message,
|
||||||
|
bool p_song, int color, QDateTime p_datetime);
|
||||||
QString get_name();
|
QString get_name();
|
||||||
QString get_showname();
|
QString get_showname();
|
||||||
QString get_message();
|
QString get_message();
|
||||||
bool get_is_song();
|
bool get_is_song();
|
||||||
QDateTime get_datetime();
|
QDateTime get_datetime();
|
||||||
QString get_datetime_as_string();
|
QString get_datetime_as_string();
|
||||||
|
int get_chat_color();
|
||||||
|
|
||||||
QString get_full();
|
QString get_full();
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ private:
|
|||||||
QString message;
|
QString message;
|
||||||
QDateTime datetime;
|
QDateTime datetime;
|
||||||
bool is_song;
|
bool is_song;
|
||||||
|
int color;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHATLOGPIECE_H
|
#endif // CHATLOGPIECE_H
|
||||||
|
@ -1,139 +1,131 @@
|
|||||||
#ifndef COURTROOM_H
|
#ifndef COURTROOM_H
|
||||||
#define COURTROOM_H
|
#define COURTROOM_H
|
||||||
|
|
||||||
#include "aoimage.h"
|
#include "aoapplication.h"
|
||||||
|
#include "aoblipplayer.h"
|
||||||
#include "aobutton.h"
|
#include "aobutton.h"
|
||||||
#include "aocharbutton.h"
|
#include "aocharbutton.h"
|
||||||
#include "aoemotebutton.h"
|
|
||||||
#include "aopacket.h"
|
|
||||||
#include "aoscene.h"
|
|
||||||
#include "aomovie.h"
|
|
||||||
#include "aocharmovie.h"
|
#include "aocharmovie.h"
|
||||||
|
#include "aoemotebutton.h"
|
||||||
|
#include "aoevidencebutton.h"
|
||||||
|
#include "aoevidencedisplay.h"
|
||||||
|
#include "aoimage.h"
|
||||||
|
#include "aolineedit.h"
|
||||||
|
#include "aomovie.h"
|
||||||
#include "aomusicplayer.h"
|
#include "aomusicplayer.h"
|
||||||
#include "aooptionsdialog.h"
|
#include "aooptionsdialog.h"
|
||||||
|
#include "aopacket.h"
|
||||||
|
#include "aoscene.h"
|
||||||
#include "aosfxplayer.h"
|
#include "aosfxplayer.h"
|
||||||
#include "aoblipplayer.h"
|
|
||||||
#include "aoevidencebutton.h"
|
|
||||||
#include "aotextarea.h"
|
#include "aotextarea.h"
|
||||||
#include "aolineedit.h"
|
|
||||||
#include "aotextedit.h"
|
#include "aotextedit.h"
|
||||||
#include "aoevidencedisplay.h"
|
#include "chatlogpiece.h"
|
||||||
#include "datatypes.h"
|
|
||||||
#include "aoapplication.h"
|
|
||||||
#include "lobby.h"
|
|
||||||
#include "hardware_functions.h"
|
|
||||||
#include "file_functions.h"
|
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
#include "debug_functions.h"
|
#include "debug_functions.h"
|
||||||
#include "chatlogpiece.h"
|
#include "file_functions.h"
|
||||||
#include "aocharmovie.h"
|
#include "hardware_functions.h"
|
||||||
|
#include "lobby.h"
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QLineEdit>
|
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#include <QListWidget>
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QSlider>
|
|
||||||
#include <QVector>
|
|
||||||
#include <QSignalMapper>
|
|
||||||
#include <QCloseEvent>
|
|
||||||
#include <QMap>
|
|
||||||
#include <QTextBrowser>
|
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QMovie>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QScrollBar>
|
|
||||||
#include <QRegExp>
|
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QTextCharFormat>
|
#include <QCheckBox>
|
||||||
#include <QFont>
|
#include <QCloseEvent>
|
||||||
#include <QInputDialog>
|
#include <QComboBox>
|
||||||
|
#include <QDebug>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QWidget>
|
#include <QFont>
|
||||||
#include <QPropertyAnimation>
|
#include <QFuture>
|
||||||
#include <QTransform>
|
#include <QHeaderView>
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QLineEdit>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QMap>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QMetaObject>
|
||||||
|
#include <QMovie>
|
||||||
#include <QParallelAnimationGroup>
|
#include <QParallelAnimationGroup>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QPlainTextEdit>
|
||||||
#include <QtConcurrent/QtConcurrentRun>
|
#include <QPropertyAnimation>
|
||||||
|
#include <QRegExp>
|
||||||
|
#include <QScrollBar>
|
||||||
|
#include <QSignalMapper>
|
||||||
|
#include <QSlider>
|
||||||
|
#include <QSpinBox>
|
||||||
|
#include <QTextBoundaryFinder>
|
||||||
|
#include <QTextBrowser>
|
||||||
|
#include <QTextCharFormat>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <QFuture>
|
#include <QTransform>
|
||||||
#include <QMetaObject>
|
#include <QTreeWidget>
|
||||||
#include <QLayout>
|
#include <QVector>
|
||||||
#include <QTextBoundaryFinder>
|
#include <QWidget>
|
||||||
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
#include <QtConcurrent/QtConcurrentRun>
|
||||||
|
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
|
||||||
class AOApplication;
|
class AOApplication;
|
||||||
class AOCharMovie;
|
class AOCharMovie;
|
||||||
class Courtroom : public QMainWindow
|
class Courtroom : public QMainWindow {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Courtroom(AOApplication *p_ao_app);
|
explicit Courtroom(AOApplication *p_ao_app);
|
||||||
|
|
||||||
void append_char(char_type p_char){char_list.append(p_char);}
|
void append_char(char_type p_char) { char_list.append(p_char); }
|
||||||
void append_evidence(evi_type p_evi){evidence_list.append(p_evi);}
|
void append_evidence(evi_type p_evi) { evidence_list.append(p_evi); }
|
||||||
void append_music(QString f_music){music_list.append(f_music);}
|
void append_music(QString f_music) { music_list.append(f_music); }
|
||||||
void append_area(QString f_area){area_list.append(f_area);}
|
void append_area(QString f_area) { area_list.append(f_area); }
|
||||||
void clear_music(){music_list.clear();}
|
void clear_music() { music_list.clear(); }
|
||||||
void clear_areas(){area_list.clear();}
|
void clear_areas() { area_list.clear(); }
|
||||||
void handle_failed_login();
|
void handle_failed_login();
|
||||||
QString threading_sfx = "";
|
QString threading_sfx = "";
|
||||||
QString threading_shake = "";
|
QString threading_shake = "";
|
||||||
QString threading_flash = "";
|
QString threading_flash = "";
|
||||||
QString threading_prefix = "";
|
QString threading_prefix = "";
|
||||||
//cid and this may differ in cases of ini-editing
|
// cid and this may differ in cases of ini-editing
|
||||||
QString current_char = "";
|
QString current_char = "";
|
||||||
int current_emote = 0;
|
int current_emote = 0;
|
||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
//abstract widget to hold char buttons
|
// abstract widget to hold char buttons
|
||||||
QWidget *ui_char_buttons;
|
QWidget *ui_char_buttons;
|
||||||
QVector<char_type> char_list;
|
QVector<char_type> char_list;
|
||||||
QVector<evi_type> evidence_list;
|
QVector<evi_type> evidence_list;
|
||||||
QVector<QString> music_list;
|
QVector<QString> music_list;
|
||||||
QVector<QString> area_list;
|
QVector<QString> area_list;
|
||||||
QSignalMapper *char_button_mapper;
|
QSignalMapper *char_button_mapper;
|
||||||
QVector<AOCharButton*> ui_char_button_list;
|
QVector<AOCharButton *> ui_char_button_list;
|
||||||
QVector<AOCharButton*> ui_char_button_list_filtered;
|
QVector<AOCharButton *> ui_char_button_list_filtered;
|
||||||
QLineEdit *ui_char_search;
|
QLineEdit *ui_char_search;
|
||||||
QCheckBox *ui_char_passworded;
|
QCheckBox *ui_char_passworded;
|
||||||
QCheckBox *ui_char_taken;
|
QCheckBox *ui_char_taken;
|
||||||
void mt_pre_framegetter(int frameNumber);
|
void mt_pre_framegetter(int frameNumber);
|
||||||
void mt_framegetter(int frameNumber);
|
void mt_framegetter(int frameNumber);
|
||||||
void reset_music_list()
|
void reset_music_list() { music_list.clear(); }
|
||||||
{
|
|
||||||
music_list.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void arup_append(int players, QString status, QString cm, QString locked)
|
void arup_append(int players, QString status, QString cm, QString locked)
|
||||||
{
|
{
|
||||||
arup_players.append(players);
|
arup_players.append(players);
|
||||||
arup_statuses.append(status);
|
arup_statuses.append(status);
|
||||||
arup_cms.append(cm);
|
arup_cms.append(cm);
|
||||||
arup_locks.append(locked);
|
arup_locks.append(locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void arup_modify(int type, int place, QString value)
|
void arup_modify(int type, int place, QString value)
|
||||||
{
|
{
|
||||||
if (type == 0)
|
if (type == 0) {
|
||||||
{
|
|
||||||
if (arup_players.size() > place)
|
if (arup_players.size() > place)
|
||||||
arup_players[place] = value.toInt();
|
arup_players[place] = value.toInt();
|
||||||
}
|
}
|
||||||
else if (type == 1)
|
else if (type == 1) {
|
||||||
{
|
|
||||||
if (arup_statuses.size() > place)
|
if (arup_statuses.size() > place)
|
||||||
arup_statuses[place] = value;
|
arup_statuses[place] = value;
|
||||||
}
|
}
|
||||||
else if (type == 2)
|
else if (type == 2) {
|
||||||
{
|
|
||||||
if (arup_cms.size() > place)
|
if (arup_cms.size() > place)
|
||||||
arup_cms[place] = value;
|
arup_cms[place] = value;
|
||||||
}
|
}
|
||||||
else if (type == 3)
|
else if (type == 3) {
|
||||||
{
|
|
||||||
if (arup_locks.size() > place)
|
if (arup_locks.size() > place)
|
||||||
arup_locks[place] = value;
|
arup_locks[place] = value;
|
||||||
}
|
}
|
||||||
@ -142,120 +134,132 @@ public:
|
|||||||
|
|
||||||
void character_loading_finished();
|
void character_loading_finished();
|
||||||
|
|
||||||
//sets position of widgets based on theme ini files
|
// sets position of widgets based on theme ini files
|
||||||
void set_widgets();
|
void set_widgets();
|
||||||
//sets font size based on theme ini files
|
// sets font size based on theme ini files
|
||||||
void set_font(QWidget *widget, QString p_identifier);
|
void set_font(QWidget *widget, QString p_identifier);
|
||||||
//helper function that calls above function on the relevant widgets
|
// helper function that calls above function on the relevant widgets
|
||||||
void set_fonts();
|
void set_fonts();
|
||||||
|
|
||||||
void set_window_title(QString p_title);
|
void set_window_title(QString p_title);
|
||||||
|
|
||||||
//reads theme inis and sets size and pos based on the identifier
|
|
||||||
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
|
|
||||||
QPoint get_theme_pos(QString p_identifier);
|
QPoint get_theme_pos(QString p_identifier);
|
||||||
//sets status as taken on character with cid n_char and places proper shading on charselect
|
|
||||||
|
// reads theme inis and sets size and pos based on the identifier
|
||||||
|
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
|
||||||
|
// sets status as taken on character with cid n_char and places proper shading
|
||||||
|
// on charselect
|
||||||
void set_taken(int n_char, bool p_taken);
|
void set_taken(int n_char, bool p_taken);
|
||||||
|
|
||||||
//sets the current background to argument. also does some checks to see if it's a legacy bg
|
// sets the current background to argument. also does some checks to see if
|
||||||
|
// it's a legacy bg
|
||||||
void set_background(QString p_background);
|
void set_background(QString p_background);
|
||||||
|
|
||||||
//sets the evidence list member variable to argument
|
// sets the evidence list member variable to argument
|
||||||
void set_evidence_list(QVector<evi_type> &p_evi_list);
|
void set_evidence_list(QVector<evi_type> &p_evi_list);
|
||||||
|
|
||||||
//called when a DONE#% from the server was received
|
// called when a DONE#% from the server was received
|
||||||
void done_received();
|
void done_received();
|
||||||
|
|
||||||
//sets the local mute list based on characters available on the server
|
// sets the local mute list based on characters available on the server
|
||||||
void set_mute_list();
|
void set_mute_list();
|
||||||
|
|
||||||
// Sets the local pair list based on the characters available on the server.
|
// Sets the local pair list based on the characters available on the server.
|
||||||
void set_pair_list();
|
void set_pair_list();
|
||||||
|
|
||||||
//sets desk and bg based on pos in chatmessage
|
// sets desk and bg based on pos in chatmessage
|
||||||
void set_scene();
|
void set_scene();
|
||||||
|
|
||||||
//sets text color based on text color in chatmessage
|
// sets text color based on text color in chatmessage
|
||||||
void set_text_color();
|
void set_text_color();
|
||||||
|
|
||||||
// And gets the colour, too!
|
// And gets the colour, too!
|
||||||
QColor get_text_color(QString color);
|
QColor get_text_color(QString color);
|
||||||
|
|
||||||
//takes in serverD-formatted IP list as prints a converted version to server OOC
|
// takes in serverD-formatted IP list as prints a converted version to server
|
||||||
//admittedly poorly named
|
// OOC admittedly poorly named
|
||||||
void set_ip_list(QString p_list);
|
void set_ip_list(QString p_list);
|
||||||
|
|
||||||
//disables chat if current cid matches second argument
|
// disables chat if current cid matches second argument
|
||||||
//enables if p_muted is false
|
// enables if p_muted is false
|
||||||
void set_mute(bool p_muted, int p_cid);
|
void set_mute(bool p_muted, int p_cid);
|
||||||
|
|
||||||
//send a message that the player is banned and quits the server
|
// send a message that the player is banned and quits the server
|
||||||
void set_ban(int p_cid);
|
void set_ban(int p_cid);
|
||||||
|
|
||||||
//cid = character id, returns the cid of the currently selected character
|
// cid = character id, returns the cid of the currently selected character
|
||||||
int get_cid() {return m_cid;}
|
int get_cid() { return m_cid; }
|
||||||
QString get_current_char() {return current_char;}
|
QString get_current_char() { return current_char; }
|
||||||
QString get_current_background() {return current_background;}
|
QString get_current_background() { return current_background; }
|
||||||
|
|
||||||
//properly sets up some varibles: resets user state
|
|
||||||
void enter_courtroom(int p_cid);
|
|
||||||
|
|
||||||
// set the character using an ID
|
// set the character using an ID
|
||||||
void set_character(int char_id);
|
void set_character(int char_id);
|
||||||
|
|
||||||
//helper function that populates ui_music_list with the contents of music_list
|
// properly sets up some varibles: resets user state
|
||||||
|
void enter_courtroom(int p_cid);
|
||||||
|
|
||||||
|
// helper function that populates ui_music_list with the contents of
|
||||||
|
// music_list
|
||||||
void list_music();
|
void list_music();
|
||||||
void list_areas();
|
void list_areas();
|
||||||
|
|
||||||
//these are for OOC chat
|
// these are for OOC chat
|
||||||
void append_ms_chatmessage(QString f_name, QString f_message);
|
void append_ms_chatmessage(QString f_name, QString f_message);
|
||||||
void append_server_chatmessage(QString p_name, QString p_message, QString p_colour);
|
void append_server_chatmessage(QString p_name, QString p_message,
|
||||||
|
QString p_colour);
|
||||||
|
|
||||||
//check whether or not current theme has images for buttons with fallback text
|
// check whether or not current theme has images for buttons with fallback
|
||||||
|
// text
|
||||||
void detect_fallback_text();
|
void detect_fallback_text();
|
||||||
|
|
||||||
//these functions handle chatmessages sequentially.
|
// these functions handle chatmessages sequentially.
|
||||||
//The process itself is very convoluted and merits separate documentation
|
// The process itself is very convoluted and merits separate documentation
|
||||||
//But the general idea is objection animation->pre animation->talking->idle
|
// But the general idea is objection animation->pre animation->talking->idle
|
||||||
void handle_chatmessage(QStringList *p_contents);
|
void handle_chatmessage(QStringList *p_contents);
|
||||||
void handle_chatmessage_2();
|
void handle_chatmessage_2();
|
||||||
void handle_chatmessage_3();
|
void handle_chatmessage_3();
|
||||||
|
|
||||||
//This function filters out the common CC inline text trickery, for appending to
|
// This function filters out the common CC inline text trickery, for appending
|
||||||
//the IC chatlog.
|
// to the IC chatlog.
|
||||||
QString filter_ic_text(QString p_text);
|
QString filter_ic_text(QString p_text, bool skip_filter, int chat_color);
|
||||||
|
|
||||||
//adds text to the IC chatlog. p_name first as bold then p_text then a newlin
|
// adds text to the IC chatlog. p_name first as bold then p_text then a newlin
|
||||||
//this function keeps the chatlog scrolled to the top unless there's text selected
|
// this function keeps the chatlog scrolled to the top unless there's text
|
||||||
|
// selected
|
||||||
// or the user isn't already scrolled to the top
|
// or the user isn't already scrolled to the top
|
||||||
void append_ic_text(QString p_text, QString p_name = "", bool is_songchange = false);
|
void append_ic_text(QString p_text, QString p_name = "",
|
||||||
|
bool is_songchange = false, bool force_filter = false,
|
||||||
|
bool skip_filter = false, int chat_color = 0);
|
||||||
|
|
||||||
//prints who played the song to IC chat and plays said song(if found on local filesystem)
|
// prints who played the song to IC chat and plays said song(if found on local
|
||||||
//takes in a list where the first element is the song name and the second is the char id of who played it
|
// filesystem) takes in a list where the first element is the song name and
|
||||||
|
// the second is the char id of who played it
|
||||||
void handle_song(QStringList *p_contents);
|
void handle_song(QStringList *p_contents);
|
||||||
|
|
||||||
void play_preanim(bool noninterrupting);
|
void play_preanim(bool noninterrupting);
|
||||||
|
|
||||||
//plays the witness testimony or cross examination animation based on argument
|
// plays the witness testimony or cross examination animation based on
|
||||||
|
// argument
|
||||||
void handle_wtce(QString p_wtce, int variant);
|
void handle_wtce(QString p_wtce, int variant);
|
||||||
|
|
||||||
//sets the hp bar of defense(p_bar 1) or pro(p_bar 2)
|
// sets the hp bar of defense(p_bar 1) or pro(p_bar 2)
|
||||||
//state is an number between 0 and 10 inclusive
|
// state is an number between 0 and 10 inclusive
|
||||||
void set_hp_bar(int p_bar, int p_state);
|
void set_hp_bar(int p_bar, int p_state);
|
||||||
|
|
||||||
//Toggles the judge buttons, whether they should appear or not.
|
// Toggles the judge buttons, whether they should appear or not.
|
||||||
void toggle_judge_buttons(bool is_on);
|
void toggle_judge_buttons(bool is_on);
|
||||||
|
|
||||||
void announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno, bool wit);
|
|
||||||
|
|
||||||
void check_connection_received();
|
|
||||||
void doScreenShake();
|
void doScreenShake();
|
||||||
void doRealization();
|
void doRealization();
|
||||||
|
|
||||||
|
void announce_case(QString title, bool def, bool pro, bool jud, bool jur,
|
||||||
|
bool steno, bool wit);
|
||||||
|
|
||||||
|
void check_connection_received();
|
||||||
|
|
||||||
|
void refresh_iclog(bool skiplast);
|
||||||
|
|
||||||
~Courtroom();
|
~Courtroom();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
int m_courtroom_width = 714;
|
int m_courtroom_width = 714;
|
||||||
int m_courtroom_height = 668;
|
int m_courtroom_height = 668;
|
||||||
|
|
||||||
@ -273,22 +277,18 @@ private:
|
|||||||
QMovie *frame_emote_checker;
|
QMovie *frame_emote_checker;
|
||||||
// This is for inline message-colouring.
|
// This is for inline message-colouring.
|
||||||
|
|
||||||
enum INLINE_COLOURS {
|
enum INLINE_COLOURS { INLINE_BLUE, INLINE_GREEN, INLINE_ORANGE, INLINE_GREY };
|
||||||
INLINE_BLUE,
|
|
||||||
INLINE_GREEN,
|
|
||||||
INLINE_ORANGE,
|
|
||||||
INLINE_GREY
|
|
||||||
};
|
|
||||||
|
|
||||||
// A stack of inline colours.
|
// A stack of inline colours.
|
||||||
std::stack<INLINE_COLOURS> inline_colour_stack;
|
std::stack<INLINE_COLOURS> inline_colour_stack;
|
||||||
|
|
||||||
bool next_character_is_not_special = false; // If true, write the
|
bool next_character_is_not_special = false; // If true, write the
|
||||||
// next character as it is.
|
// next character as it is.
|
||||||
|
|
||||||
bool message_is_centered = false;
|
bool message_is_centered = false;
|
||||||
|
|
||||||
int current_display_speed = 3;
|
int current_display_speed = 3;
|
||||||
|
int message_display_speed_slow[7] = {30, 40, 50, 60, 75, 100, 120};
|
||||||
int message_display_speed[7] = {10, 20, 30, 40, 50, 60, 75};
|
int message_display_speed[7] = {10, 20, 30, 40, 50, 60, 75};
|
||||||
|
|
||||||
// This is for checking if the character should start talking again
|
// This is for checking if the character should start talking again
|
||||||
@ -316,75 +316,90 @@ private:
|
|||||||
QVector<int> music_row_to_number;
|
QVector<int> music_row_to_number;
|
||||||
QVector<int> area_row_to_number;
|
QVector<int> area_row_to_number;
|
||||||
|
|
||||||
//triggers ping_server() every 60 seconds
|
// triggers ping_server() every 60 seconds
|
||||||
QTimer *keepalive_timer;
|
QTimer *keepalive_timer;
|
||||||
|
|
||||||
//determines how fast messages tick onto screen
|
// determines how fast messages tick onto screen
|
||||||
QTimer *chat_tick_timer;
|
QTimer *chat_tick_timer;
|
||||||
//int chat_tick_interval = 60;
|
// int chat_tick_interval = 60;
|
||||||
//which tick position(character in chat message) we are at
|
// which tick position(character in chat message) we are at
|
||||||
int tick_pos = 0;
|
int tick_pos = 0;
|
||||||
//used to determine how often blips sound
|
// used to determine how often blips sound
|
||||||
int blip_pos = 0;
|
int blip_pos = 0;
|
||||||
int blip_rate = 1;
|
int blip_rate = 1;
|
||||||
int rainbow_counter = 0;
|
int rainbow_counter = 0;
|
||||||
bool rainbow_appended = false;
|
bool rainbow_appended = false;
|
||||||
bool blank_blip = false;
|
bool blank_blip = false;
|
||||||
|
|
||||||
|
// The cursor to write with in mirror mode
|
||||||
|
QTextCursor *mirror_cursor;
|
||||||
// Used for getting the current maximum blocks allowed in the IC chatlog.
|
// Used for getting the current maximum blocks allowed in the IC chatlog.
|
||||||
int log_maximum_blocks = 0;
|
int log_maximum_blocks = 0;
|
||||||
|
|
||||||
// True, if the log should go downwards.
|
// True, if the log should go downwards.
|
||||||
bool log_goes_downwards = false;
|
bool log_goes_downwards = false;
|
||||||
|
|
||||||
//delay before chat messages starts ticking
|
// delay before chat messages starts ticking
|
||||||
QTimer *text_delay_timer;
|
QTimer *text_delay_timer;
|
||||||
|
|
||||||
//delay before sfx plays
|
// delay before sfx plays
|
||||||
QTimer *sfx_delay_timer;
|
QTimer *sfx_delay_timer;
|
||||||
|
|
||||||
//keeps track of how long realization is visible(it's just a white square and should be visible less than a second)
|
// keeps track of how long realization is visible(it's just a white square and
|
||||||
|
// should be visible less than a second)
|
||||||
QTimer *realization_timer;
|
QTimer *realization_timer;
|
||||||
|
|
||||||
//times how long the blinking testimony should be shown(green one in the corner)
|
// every time point in char.inis times this equals the final time
|
||||||
QTimer *testimony_show_timer;
|
|
||||||
//times how long the blinking testimony should be hidden
|
|
||||||
QTimer *testimony_hide_timer;
|
|
||||||
|
|
||||||
//every time point in char.inis times this equals the final time
|
|
||||||
const int time_mod = 40;
|
const int time_mod = 40;
|
||||||
|
|
||||||
|
// the amount of time non-animated objection/hold it/takethat images stay
|
||||||
|
// onscreen for in ms
|
||||||
|
const int shout_stay_time = 724;
|
||||||
|
|
||||||
|
// the amount of time non-animated guilty/not guilty images stay onscreen for
|
||||||
|
// in ms
|
||||||
|
const int verdict_stay_time = 3000;
|
||||||
|
|
||||||
|
// the amount of time non-animated witness testimony/cross-examination images
|
||||||
|
// stay onscreen for in ms
|
||||||
|
const int wtce_stay_time = 1500;
|
||||||
|
|
||||||
static const int chatmessage_size = 28;
|
static const int chatmessage_size = 28;
|
||||||
QString m_chatmessage[chatmessage_size];
|
QString m_chatmessage[chatmessage_size];
|
||||||
bool chatmessage_is_empty = false;
|
bool chatmessage_is_empty = false;
|
||||||
|
|
||||||
QString previous_ic_message = "";
|
QString previous_ic_message = "";
|
||||||
|
|
||||||
bool testimony_in_progress = false;
|
// char id, muted or not
|
||||||
|
|
||||||
//in milliseconds
|
|
||||||
const int testimony_show_time = 1500;
|
|
||||||
|
|
||||||
//in milliseconds
|
|
||||||
const int testimony_hide_time = 500;
|
|
||||||
|
|
||||||
//char id, muted or not
|
|
||||||
QMap<int, bool> mute_map;
|
QMap<int, bool> mute_map;
|
||||||
|
|
||||||
//QVector<int> muted_cids;
|
// QVector<int> muted_cids;
|
||||||
|
|
||||||
bool is_muted = false;
|
bool is_muted = false;
|
||||||
|
|
||||||
//state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 = noniterrupting preanim
|
// state of animation, 0 = objecting, 1 = preanim, 2 = talking, 3 = idle, 4 =
|
||||||
|
// noniterrupting preanim
|
||||||
int anim_state = 3;
|
int anim_state = 3;
|
||||||
|
|
||||||
//state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = ticking done
|
// state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 =
|
||||||
|
// ticking done
|
||||||
int text_state = 2;
|
int text_state = 2;
|
||||||
|
|
||||||
//character id, which index of the char_list the player is
|
// characters we consider punctuation
|
||||||
|
const QString punctuation_chars = ".,?!:;";
|
||||||
|
|
||||||
|
// amount by which we multiply the delay when we parse punctuation chars
|
||||||
|
int punctuation_modifier = 0;
|
||||||
|
bool slower_blips = false;
|
||||||
|
// character id, which index of the char_list the player is
|
||||||
int m_cid = -1;
|
int m_cid = -1;
|
||||||
|
// cid and this may differ in cases of ini-editing
|
||||||
|
|
||||||
|
QString char_name = "";
|
||||||
|
|
||||||
int objection_state = 0;
|
int objection_state = 0;
|
||||||
|
bool keep_custom_objection = false;
|
||||||
|
QString objection_custom = "";
|
||||||
int realization_state = 0;
|
int realization_state = 0;
|
||||||
int screenshake_state = 0;
|
int screenshake_state = 0;
|
||||||
int text_color = 0;
|
int text_color = 0;
|
||||||
@ -414,7 +429,8 @@ private:
|
|||||||
int evidence_rows = 3;
|
int evidence_rows = 3;
|
||||||
int max_evidence_on_page = 18;
|
int max_evidence_on_page = 18;
|
||||||
|
|
||||||
//is set to true if the bg folder contains defensedesk.png, prosecutiondesk.png and stand.png
|
// is set to true if the bg folder contains defensedesk.png,
|
||||||
|
// prosecutiondesk.png and stand.png
|
||||||
bool is_ao2_bg = false;
|
bool is_ao2_bg = false;
|
||||||
|
|
||||||
// whether or not to use text for buttons instead of images, true is text
|
// whether or not to use text for buttons instead of images, true is text
|
||||||
@ -426,9 +442,11 @@ private:
|
|||||||
bool amswap_fallback = true;
|
bool amswap_fallback = true;
|
||||||
bool ooc_toggle_fallback = true;
|
bool ooc_toggle_fallback = true;
|
||||||
|
|
||||||
//whether the ooc chat is server or master chat, true is server
|
// whether the ooc chat is server or master chat, true is server
|
||||||
bool server_ooc = true;
|
bool server_ooc = true;
|
||||||
|
|
||||||
|
// Is AFK enabled
|
||||||
|
bool isafk = false;
|
||||||
QString current_background = "default";
|
QString current_background = "default";
|
||||||
|
|
||||||
AOMusicPlayer *music_player;
|
AOMusicPlayer *music_player;
|
||||||
@ -454,10 +472,17 @@ private:
|
|||||||
AOImage *ui_vp_chatbox;
|
AOImage *ui_vp_chatbox;
|
||||||
QLabel *ui_vp_showname;
|
QLabel *ui_vp_showname;
|
||||||
QTextEdit *ui_vp_message;
|
QTextEdit *ui_vp_message;
|
||||||
AOImage *ui_vp_testimony;
|
AOMovie *ui_vp_realization;
|
||||||
AOImage *ui_vp_realization;
|
AOMovie *ui_vp_testimony;
|
||||||
AOMovie *ui_vp_wtce;
|
AOMovie *ui_vp_wtce;
|
||||||
AOMovie *ui_vp_objection;
|
AOMovie *ui_vp_objection;
|
||||||
|
void realization_done();
|
||||||
|
|
||||||
|
bool colorf_iclog = false;
|
||||||
|
bool mirror_iclog = false;
|
||||||
|
bool colorf_limit = false;
|
||||||
|
|
||||||
|
bool keep_evidence_display = false;
|
||||||
|
|
||||||
QTextEdit *ui_ic_chatlog;
|
QTextEdit *ui_ic_chatlog;
|
||||||
|
|
||||||
@ -466,7 +491,7 @@ private:
|
|||||||
|
|
||||||
QListWidget *ui_mute_list;
|
QListWidget *ui_mute_list;
|
||||||
QListWidget *ui_area_list;
|
QListWidget *ui_area_list;
|
||||||
QListWidget *ui_music_list;
|
QTreeWidget *ui_music_list;
|
||||||
|
|
||||||
AOButton *ui_pair_button;
|
AOButton *ui_pair_button;
|
||||||
QListWidget *ui_pair_list;
|
QListWidget *ui_pair_list;
|
||||||
@ -478,11 +503,13 @@ private:
|
|||||||
QLineEdit *ui_ooc_chat_message;
|
QLineEdit *ui_ooc_chat_message;
|
||||||
QLineEdit *ui_ooc_chat_name;
|
QLineEdit *ui_ooc_chat_name;
|
||||||
|
|
||||||
//QLineEdit *ui_area_password;
|
// QLineEdit *ui_area_password;
|
||||||
QLineEdit *ui_music_search;
|
QLineEdit *ui_music_search;
|
||||||
|
QString music_search_par = "";
|
||||||
|
QString area_search_par = "";
|
||||||
|
|
||||||
QWidget *ui_emotes;
|
QWidget *ui_emotes;
|
||||||
QVector<AOEmoteButton*> ui_emote_list;
|
QVector<AOEmoteButton *> ui_emote_list;
|
||||||
AOButton *ui_emote_left;
|
AOButton *ui_emote_left;
|
||||||
AOButton *ui_emote_right;
|
AOButton *ui_emote_right;
|
||||||
|
|
||||||
@ -527,6 +554,8 @@ private:
|
|||||||
AOButton *ui_screenshake;
|
AOButton *ui_screenshake;
|
||||||
AOButton *ui_mute;
|
AOButton *ui_mute;
|
||||||
|
|
||||||
|
QMenu *custom_obj_menu;
|
||||||
|
|
||||||
AOButton *ui_defense_plus;
|
AOButton *ui_defense_plus;
|
||||||
AOButton *ui_defense_minus;
|
AOButton *ui_defense_minus;
|
||||||
|
|
||||||
@ -548,7 +577,7 @@ private:
|
|||||||
AOImage *ui_evidence;
|
AOImage *ui_evidence;
|
||||||
AOLineEdit *ui_evidence_name;
|
AOLineEdit *ui_evidence_name;
|
||||||
QWidget *ui_evidence_buttons;
|
QWidget *ui_evidence_buttons;
|
||||||
QVector<AOEvidenceButton*> ui_evidence_list;
|
QVector<AOEvidenceButton *> ui_evidence_list;
|
||||||
AOButton *ui_evidence_left;
|
AOButton *ui_evidence_left;
|
||||||
AOButton *ui_evidence_right;
|
AOButton *ui_evidence_right;
|
||||||
AOButton *ui_evidence_present;
|
AOButton *ui_evidence_present;
|
||||||
@ -589,14 +618,10 @@ public slots:
|
|||||||
void objection_done();
|
void objection_done();
|
||||||
void preanim_done();
|
void preanim_done();
|
||||||
|
|
||||||
void realization_done();
|
|
||||||
|
|
||||||
void show_testimony();
|
|
||||||
void hide_testimony();
|
|
||||||
|
|
||||||
void mod_called(QString p_ip);
|
void mod_called(QString p_ip);
|
||||||
|
|
||||||
void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno, bool witness);
|
void case_called(QString msg, bool def, bool pro, bool jud, bool jur,
|
||||||
|
bool steno, bool witness);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void start_chat_ticking();
|
void start_chat_ticking();
|
||||||
@ -611,8 +636,9 @@ private slots:
|
|||||||
|
|
||||||
void on_ooc_return_pressed();
|
void on_ooc_return_pressed();
|
||||||
|
|
||||||
|
void on_music_search_keypr();
|
||||||
void on_music_search_edited(QString p_text);
|
void on_music_search_edited(QString p_text);
|
||||||
void on_music_list_double_clicked(QModelIndex p_model);
|
void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column);
|
||||||
void on_area_list_double_clicked(QModelIndex p_model);
|
void on_area_list_double_clicked(QModelIndex p_model);
|
||||||
|
|
||||||
void select_emote(int p_id);
|
void select_emote(int p_id);
|
||||||
@ -641,6 +667,7 @@ private slots:
|
|||||||
void on_objection_clicked();
|
void on_objection_clicked();
|
||||||
void on_take_that_clicked();
|
void on_take_that_clicked();
|
||||||
void on_custom_objection_clicked();
|
void on_custom_objection_clicked();
|
||||||
|
void ShowContextMenu(const QPoint &pos);
|
||||||
|
|
||||||
void on_realization_clicked();
|
void on_realization_clicked();
|
||||||
void on_screenshake_clicked();
|
void on_screenshake_clicked();
|
||||||
@ -704,9 +731,9 @@ private slots:
|
|||||||
|
|
||||||
void ping_server();
|
void ping_server();
|
||||||
|
|
||||||
#ifdef BASSAUDIO
|
#ifdef BASSAUDIO
|
||||||
void load_bass_opus_plugin();
|
void load_bass_opus_plugin();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COURTROOM_H
|
#endif // COURTROOM_H
|
||||||
|
@ -3,16 +3,14 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
struct server_type
|
struct server_type {
|
||||||
{
|
|
||||||
QString name;
|
QString name;
|
||||||
QString desc;
|
QString desc;
|
||||||
QString ip;
|
QString ip;
|
||||||
int port;
|
int port;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct emote_type
|
struct emote_type {
|
||||||
{
|
|
||||||
QString comment;
|
QString comment;
|
||||||
QString preanim;
|
QString preanim;
|
||||||
QString anim;
|
QString anim;
|
||||||
@ -22,23 +20,20 @@ struct emote_type
|
|||||||
int sfx_duration;
|
int sfx_duration;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct char_type
|
struct char_type {
|
||||||
{
|
|
||||||
QString name;
|
QString name;
|
||||||
QString description;
|
QString description;
|
||||||
QString evidence_string;
|
QString evidence_string;
|
||||||
bool taken;
|
bool taken;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct evi_type
|
struct evi_type {
|
||||||
{
|
|
||||||
QString name;
|
QString name;
|
||||||
QString description;
|
QString description;
|
||||||
QString image;
|
QString image;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct chatmessage_type
|
struct chatmessage_type {
|
||||||
{
|
|
||||||
QString message;
|
QString message;
|
||||||
QString character;
|
QString character;
|
||||||
QString side;
|
QString side;
|
||||||
@ -55,29 +50,25 @@ struct chatmessage_type
|
|||||||
int flip;
|
int flip;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct area_type
|
struct area_type {
|
||||||
{
|
|
||||||
QString name;
|
QString name;
|
||||||
QString background;
|
QString background;
|
||||||
bool passworded;
|
bool passworded;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pos_type
|
struct pos_type {
|
||||||
{
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pos_size_type
|
struct pos_size_type {
|
||||||
{
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
int width = 0;
|
int width = 0;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum CHAT_MESSAGE
|
enum CHAT_MESSAGE {
|
||||||
{
|
|
||||||
DESK_MOD = 0,
|
DESK_MOD = 0,
|
||||||
PRE_EMOTE,
|
PRE_EMOTE,
|
||||||
CHAR_NAME,
|
CHAR_NAME,
|
||||||
@ -108,17 +99,6 @@ enum CHAT_MESSAGE
|
|||||||
FRAME_SFX
|
FRAME_SFX
|
||||||
};
|
};
|
||||||
|
|
||||||
enum COLOR
|
enum COLOR { WHITE = 0, GREEN, RED, ORANGE, BLUE, YELLOW, RAINBOW, PINK, CYAN };
|
||||||
{
|
|
||||||
WHITE = 0,
|
|
||||||
GREEN,
|
|
||||||
RED,
|
|
||||||
ORANGE,
|
|
||||||
BLUE,
|
|
||||||
YELLOW,
|
|
||||||
RAINBOW,
|
|
||||||
PINK,
|
|
||||||
CYAN
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // DATATYPES_H
|
#endif // DATATYPES_H
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef DEBUG_FUNCTIONS_H
|
#ifndef DEBUG_FUNCTIONS_H
|
||||||
#define DEBUG_FUNCTIONS_H
|
#define DEBUG_FUNCTIONS_H
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
void call_error(QString message);
|
void call_error(QString message);
|
||||||
void call_notice(QString message);
|
void call_notice(QString message);
|
||||||
|
@ -24,61 +24,63 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct DiscordRichPresence {
|
typedef struct DiscordRichPresence {
|
||||||
const char* state; /* max 128 bytes */
|
const char *state; /* max 128 bytes */
|
||||||
const char* details; /* max 128 bytes */
|
const char *details; /* max 128 bytes */
|
||||||
int64_t startTimestamp;
|
int64_t startTimestamp;
|
||||||
int64_t endTimestamp;
|
int64_t endTimestamp;
|
||||||
const char* largeImageKey; /* max 32 bytes */
|
const char *largeImageKey; /* max 32 bytes */
|
||||||
const char* largeImageText; /* max 128 bytes */
|
const char *largeImageText; /* max 128 bytes */
|
||||||
const char* smallImageKey; /* max 32 bytes */
|
const char *smallImageKey; /* max 32 bytes */
|
||||||
const char* smallImageText; /* max 128 bytes */
|
const char *smallImageText; /* max 128 bytes */
|
||||||
const char* partyId; /* max 128 bytes */
|
const char *partyId; /* max 128 bytes */
|
||||||
int partySize;
|
int partySize;
|
||||||
int partyMax;
|
int partyMax;
|
||||||
const char* matchSecret; /* max 128 bytes */
|
const char *matchSecret; /* max 128 bytes */
|
||||||
const char* joinSecret; /* max 128 bytes */
|
const char *joinSecret; /* max 128 bytes */
|
||||||
const char* spectateSecret; /* max 128 bytes */
|
const char *spectateSecret; /* max 128 bytes */
|
||||||
int8_t instance;
|
int8_t instance;
|
||||||
} DiscordRichPresence;
|
} DiscordRichPresence;
|
||||||
|
|
||||||
typedef struct DiscordJoinRequest {
|
typedef struct DiscordJoinRequest {
|
||||||
const char* userId;
|
const char *userId;
|
||||||
const char* username;
|
const char *username;
|
||||||
const char* discriminator;
|
const char *discriminator;
|
||||||
const char* avatar;
|
const char *avatar;
|
||||||
} DiscordJoinRequest;
|
} DiscordJoinRequest;
|
||||||
|
|
||||||
typedef struct DiscordEventHandlers {
|
typedef struct DiscordEventHandlers {
|
||||||
void (*ready)(void);
|
void (*ready)(void);
|
||||||
void (*disconnected)(int errorCode, const char* message);
|
void (*disconnected)(int errorCode, const char *message);
|
||||||
void (*errored)(int errorCode, const char* message);
|
void (*errored)(int errorCode, const char *message);
|
||||||
void (*joinGame)(const char* joinSecret);
|
void (*joinGame)(const char *joinSecret);
|
||||||
void (*spectateGame)(const char* spectateSecret);
|
void (*spectateGame)(const char *spectateSecret);
|
||||||
void (*joinRequest)(const DiscordJoinRequest* request);
|
void (*joinRequest)(const DiscordJoinRequest *request);
|
||||||
} DiscordEventHandlers;
|
} DiscordEventHandlers;
|
||||||
|
|
||||||
#define DISCORD_REPLY_NO 0
|
#define DISCORD_REPLY_NO 0
|
||||||
#define DISCORD_REPLY_YES 1
|
#define DISCORD_REPLY_YES 1
|
||||||
#define DISCORD_REPLY_IGNORE 2
|
#define DISCORD_REPLY_IGNORE 2
|
||||||
|
|
||||||
DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
|
DISCORD_EXPORT void Discord_Initialize(const char *applicationId,
|
||||||
DiscordEventHandlers* handlers,
|
DiscordEventHandlers *handlers,
|
||||||
int autoRegister,
|
int autoRegister,
|
||||||
const char* optionalSteamId);
|
const char *optionalSteamId);
|
||||||
DISCORD_EXPORT void Discord_Shutdown(void);
|
DISCORD_EXPORT void Discord_Shutdown(void);
|
||||||
|
|
||||||
/* checks for incoming messages, dispatches callbacks */
|
/* checks for incoming messages, dispatches callbacks */
|
||||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
|
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
|
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
|
DISCORD_EXPORT void Discord_UpdateConnection(void);
|
||||||
#endif
|
#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_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
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -1,25 +1,27 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#if defined(DISCORD_DYNAMIC_LIB)
|
#if defined(DISCORD_DYNAMIC_LIB)
|
||||||
# if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
# if defined(DISCORD_BUILDING_SDK)
|
#if defined(DISCORD_BUILDING_SDK)
|
||||||
# define DISCORD_EXPORT __declspec(dllexport)
|
#define DISCORD_EXPORT __declspec(dllexport)
|
||||||
# else
|
|
||||||
# define DISCORD_EXPORT __declspec(dllimport)
|
|
||||||
# endif
|
|
||||||
# else
|
|
||||||
# define DISCORD_EXPORT __attribute__((visibility("default")))
|
|
||||||
# endif
|
|
||||||
#else
|
#else
|
||||||
# define DISCORD_EXPORT
|
#define DISCORD_EXPORT __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define DISCORD_EXPORT __attribute__((visibility("default")))
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define DISCORD_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command);
|
DISCORD_EXPORT void Discord_Register(const char *applicationId,
|
||||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
|
const char *command);
|
||||||
|
DISCORD_EXPORT void Discord_RegisterSteamGame(const char *applicationId,
|
||||||
|
const char *steamId);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef DISCORD_RICH_PRESENCE_H
|
#ifndef DISCORD_RICH_PRESENCE_H
|
||||||
#define DISCORD_RICH_PRESENCE_H
|
#define DISCORD_RICH_PRESENCE_H
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDebug>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <QDebug>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
#include <discord-rpc.h>
|
#include <discord-rpc.h>
|
||||||
|
|
||||||
@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
namespace AttorneyOnline {
|
namespace AttorneyOnline {
|
||||||
|
|
||||||
class Discord
|
class Discord {
|
||||||
{
|
|
||||||
Q_DECLARE_TR_FUNCTIONS(Discord)
|
Q_DECLARE_TR_FUNCTIONS(Discord)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* APPLICATION_ID = "399779271737868288";
|
const char *APPLICATION_ID = "399779271737868288";
|
||||||
std::string server_name, server_id;
|
std::string server_name, server_id;
|
||||||
int64_t timestamp;
|
int64_t timestamp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Discord();
|
Discord();
|
||||||
~Discord();
|
~Discord();
|
||||||
@ -34,5 +34,5 @@ public:
|
|||||||
void state_spectate();
|
void state_spectate();
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
} // namespace AttorneyOnline
|
||||||
#endif // DISCORD_RICH_PRESENCE_H
|
#endif // DISCORD_RICH_PRESENCE_H
|
||||||
|
@ -24,63 +24,65 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct DiscordRichPresence {
|
typedef struct DiscordRichPresence {
|
||||||
const char* state; /* max 128 bytes */
|
const char *state; /* max 128 bytes */
|
||||||
const char* details; /* max 128 bytes */
|
const char *details; /* max 128 bytes */
|
||||||
int64_t startTimestamp;
|
int64_t startTimestamp;
|
||||||
int64_t endTimestamp;
|
int64_t endTimestamp;
|
||||||
const char* largeImageKey; /* max 32 bytes */
|
const char *largeImageKey; /* max 32 bytes */
|
||||||
const char* largeImageText; /* max 128 bytes */
|
const char *largeImageText; /* max 128 bytes */
|
||||||
const char* smallImageKey; /* max 32 bytes */
|
const char *smallImageKey; /* max 32 bytes */
|
||||||
const char* smallImageText; /* max 128 bytes */
|
const char *smallImageText; /* max 128 bytes */
|
||||||
const char* partyId; /* max 128 bytes */
|
const char *partyId; /* max 128 bytes */
|
||||||
int partySize;
|
int partySize;
|
||||||
int partyMax;
|
int partyMax;
|
||||||
const char* matchSecret; /* max 128 bytes */
|
const char *matchSecret; /* max 128 bytes */
|
||||||
const char* joinSecret; /* max 128 bytes */
|
const char *joinSecret; /* max 128 bytes */
|
||||||
const char* spectateSecret; /* max 128 bytes */
|
const char *spectateSecret; /* max 128 bytes */
|
||||||
int8_t instance;
|
int8_t instance;
|
||||||
} DiscordRichPresence;
|
} DiscordRichPresence;
|
||||||
|
|
||||||
typedef struct DiscordUser {
|
typedef struct DiscordUser {
|
||||||
const char* userId;
|
const char *userId;
|
||||||
const char* username;
|
const char *username;
|
||||||
const char* discriminator;
|
const char *discriminator;
|
||||||
const char* avatar;
|
const char *avatar;
|
||||||
} DiscordUser;
|
} DiscordUser;
|
||||||
|
|
||||||
typedef struct DiscordEventHandlers {
|
typedef struct DiscordEventHandlers {
|
||||||
void (*ready)(const DiscordUser* request);
|
void (*ready)(const DiscordUser *request);
|
||||||
void (*disconnected)(int errorCode, const char* message);
|
void (*disconnected)(int errorCode, const char *message);
|
||||||
void (*errored)(int errorCode, const char* message);
|
void (*errored)(int errorCode, const char *message);
|
||||||
void (*joinGame)(const char* joinSecret);
|
void (*joinGame)(const char *joinSecret);
|
||||||
void (*spectateGame)(const char* spectateSecret);
|
void (*spectateGame)(const char *spectateSecret);
|
||||||
void (*joinRequest)(const DiscordUser* request);
|
void (*joinRequest)(const DiscordUser *request);
|
||||||
} DiscordEventHandlers;
|
} DiscordEventHandlers;
|
||||||
|
|
||||||
#define DISCORD_REPLY_NO 0
|
#define DISCORD_REPLY_NO 0
|
||||||
#define DISCORD_REPLY_YES 1
|
#define DISCORD_REPLY_YES 1
|
||||||
#define DISCORD_REPLY_IGNORE 2
|
#define DISCORD_REPLY_IGNORE 2
|
||||||
|
|
||||||
DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
|
DISCORD_EXPORT void Discord_Initialize(const char *applicationId,
|
||||||
DiscordEventHandlers* handlers,
|
DiscordEventHandlers *handlers,
|
||||||
int autoRegister,
|
int autoRegister,
|
||||||
const char* optionalSteamId);
|
const char *optionalSteamId);
|
||||||
DISCORD_EXPORT void Discord_Shutdown(void);
|
DISCORD_EXPORT void Discord_Shutdown(void);
|
||||||
|
|
||||||
/* checks for incoming messages, dispatches callbacks */
|
/* checks for incoming messages, dispatches callbacks */
|
||||||
DISCORD_EXPORT void Discord_RunCallbacks(void);
|
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
|
#ifdef DISCORD_DISABLE_IO_THREAD
|
||||||
DISCORD_EXPORT void Discord_UpdateConnection(void);
|
DISCORD_EXPORT void Discord_UpdateConnection(void);
|
||||||
#endif
|
#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_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
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <sstream>
|
|
||||||
#include <iomanip>
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <sstream>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
QString fanta_encrypt(QString p_input, unsigned int key);
|
QString fanta_encrypt(QString p_input, unsigned int key);
|
||||||
QString fanta_decrypt(QString p_input, unsigned int key);
|
QString fanta_decrypt(QString p_input, unsigned int key);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef FILE_FUNCTIONS_H
|
#ifndef FILE_FUNCTIONS_H
|
||||||
#define FILE_FUNCTIONS_H
|
#define FILE_FUNCTIONS_H
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
bool file_exists(QString file_path);
|
bool file_exists(QString file_path);
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
#ifndef HEX_OPERATIONS_H
|
#ifndef HEX_OPERATIONS_H
|
||||||
#define HEX_OPERATIONS_H
|
#define HEX_OPERATIONS_H
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <bitset>
|
#include <bitset>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <iostream>
|
|
||||||
#include <algorithm>
|
|
||||||
#include <string>
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace omni
|
namespace omni {
|
||||||
{
|
std::string int_to_hex(unsigned int input);
|
||||||
std::string int_to_hex(unsigned int input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //HEX_OPERATIONS_H
|
#endif // HEX_OPERATIONS_H
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#ifndef LOBBY_H
|
#ifndef LOBBY_H
|
||||||
#define LOBBY_H
|
#define LOBBY_H
|
||||||
|
|
||||||
#include "aoimage.h"
|
|
||||||
#include "aobutton.h"
|
#include "aobutton.h"
|
||||||
|
#include "aoimage.h"
|
||||||
#include "aopacket.h"
|
#include "aopacket.h"
|
||||||
#include "aotextarea.h"
|
#include "aotextarea.h"
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QListWidget>
|
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QListWidget>
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QPlainTextEdit>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
#include <QTextBrowser>
|
#include <QTextBrowser>
|
||||||
|
|
||||||
@ -19,8 +19,7 @@
|
|||||||
|
|
||||||
class AOApplication;
|
class AOApplication;
|
||||||
|
|
||||||
class Lobby : public QMainWindow
|
class Lobby : public QMainWindow {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -33,12 +32,12 @@ public:
|
|||||||
void append_error(QString f_message);
|
void append_error(QString f_message);
|
||||||
void set_player_count(int players_online, int max_players);
|
void set_player_count(int players_online, int max_players);
|
||||||
void set_loading_text(QString p_text);
|
void set_loading_text(QString p_text);
|
||||||
void show_loading_overlay(){ui_loading_background->show();}
|
void show_loading_overlay() { ui_loading_background->show(); }
|
||||||
void hide_loading_overlay(){ui_loading_background->hide();}
|
void hide_loading_overlay() { ui_loading_background->hide(); }
|
||||||
QString get_chatlog();
|
QString get_chatlog();
|
||||||
int get_selected_server();
|
int get_selected_server();
|
||||||
void enable_connect_button();
|
void enable_connect_button();
|
||||||
|
void check_update();
|
||||||
void set_loading_value(int p_value);
|
void set_loading_value(int p_value);
|
||||||
|
|
||||||
bool public_servers_selected = true;
|
bool public_servers_selected = true;
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef MISC_FUNCTIONS_H
|
#ifndef MISC_FUNCTIONS_H
|
||||||
#define MISC_FUNCTIONS_H
|
#define MISC_FUNCTIONS_H
|
||||||
|
|
||||||
#include <QTime>
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QTime>
|
||||||
|
|
||||||
void delay(int p_milliseconds);
|
void delay(int p_milliseconds);
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef NETWORKMANAGER_H
|
#ifndef NETWORKMANAGER_H
|
||||||
#define NETWORKMANAGER_H
|
#define NETWORKMANAGER_H
|
||||||
|
|
||||||
// Qt for Android has stubbed QDnsLookup. This is not documented in any part of their wiki.
|
// Qt for Android has stubbed QDnsLookup. This is not documented in any part of
|
||||||
// This prevents SRV lookup/failover behavior from functioning.
|
// their wiki. This prevents SRV lookup/failover behavior from functioning.
|
||||||
// https://bugreports.qt.io/browse/QTBUG-56143
|
// https://bugreports.qt.io/browse/QTBUG-56143
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
#define MS_FAILOVER_SUPPORTED
|
#define MS_FAILOVER_SUPPORTED
|
||||||
@ -14,17 +14,16 @@
|
|||||||
#undef MS_FAILOVER_SUPPORTED
|
#undef MS_FAILOVER_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "aopacket.h"
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
#include "aopacket.h"
|
||||||
|
|
||||||
#include <QTcpSocket>
|
|
||||||
#include <QDnsLookup>
|
#include <QDnsLookup>
|
||||||
|
#include <QTcpSocket>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
class NetworkManager : public QObject
|
class NetworkManager : public QObject {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -3,11 +3,11 @@
|
|||||||
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
#include "file_functions.h"
|
#include "file_functions.h"
|
||||||
#include <QTextStream>
|
|
||||||
#include <QStringList>
|
|
||||||
#include <QVector>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <QDebug>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QStringList>
|
||||||
|
#include <QTextStream>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
#endif // TEXT_FILE_FUNCTIONS_H
|
#endif // TEXT_FILE_FUNCTIONS_H
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
|
|||||||
|
|
||||||
cd "${ROOT_DIR}"
|
cd "${ROOT_DIR}"
|
||||||
|
|
||||||
|
|
||||||
#need some openGL stuff
|
#need some openGL stuff
|
||||||
sudo apt install libgl1-mesa-dev
|
sudo apt install libgl1-mesa-dev
|
||||||
#install curl incase of fresh vm
|
#install curl incase of fresh vm
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include "lobby.h"
|
|
||||||
#include "courtroom.h"
|
|
||||||
#include "networkmanager.h"
|
|
||||||
#include "debug_functions.h"
|
|
||||||
|
|
||||||
#include "aooptionsdialog.h"
|
|
||||||
#include "aocaseannouncerdialog.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)
|
AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
|
||||||
{
|
{
|
||||||
// Create the QSettings class that points to the config.ini.
|
// 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);
|
net_manager = new NetworkManager(this);
|
||||||
discord = new AttorneyOnline::Discord();
|
discord = new AttorneyOnline::Discord();
|
||||||
@ -28,8 +28,7 @@ AOApplication::~AOApplication()
|
|||||||
|
|
||||||
void AOApplication::construct_lobby()
|
void AOApplication::construct_lobby()
|
||||||
{
|
{
|
||||||
if (lobby_constructed)
|
if (lobby_constructed) {
|
||||||
{
|
|
||||||
qDebug() << "W: lobby was attempted constructed when it already exists";
|
qDebug() << "W: lobby was attempted constructed when it already exists";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -38,8 +37,8 @@ void AOApplication::construct_lobby()
|
|||||||
lobby_constructed = true;
|
lobby_constructed = true;
|
||||||
|
|
||||||
QRect geometry = QGuiApplication::primaryScreen()->geometry();
|
QRect geometry = QGuiApplication::primaryScreen()->geometry();
|
||||||
int x = (geometry.width()-w_lobby->width()) / 2;
|
int x = (geometry.width() - w_lobby->width()) / 2;
|
||||||
int y = (geometry.height()-w_lobby->height()) / 2;
|
int y = (geometry.height() - w_lobby->height()) / 2;
|
||||||
w_lobby->move(x, y);
|
w_lobby->move(x, y);
|
||||||
|
|
||||||
if (is_discord_enabled())
|
if (is_discord_enabled())
|
||||||
@ -50,8 +49,7 @@ void AOApplication::construct_lobby()
|
|||||||
|
|
||||||
void AOApplication::destruct_lobby()
|
void AOApplication::destruct_lobby()
|
||||||
{
|
{
|
||||||
if(!lobby_constructed)
|
if (!lobby_constructed) {
|
||||||
{
|
|
||||||
qDebug() << "W: lobby was attempted destructed when it did not exist";
|
qDebug() << "W: lobby was attempted destructed when it did not exist";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -63,8 +61,7 @@ void AOApplication::destruct_lobby()
|
|||||||
|
|
||||||
void AOApplication::construct_courtroom()
|
void AOApplication::construct_courtroom()
|
||||||
{
|
{
|
||||||
if (courtroom_constructed)
|
if (courtroom_constructed) {
|
||||||
{
|
|
||||||
qDebug() << "W: courtroom was attempted constructed when it already exists";
|
qDebug() << "W: courtroom was attempted constructed when it already exists";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -73,15 +70,14 @@ void AOApplication::construct_courtroom()
|
|||||||
courtroom_constructed = true;
|
courtroom_constructed = true;
|
||||||
|
|
||||||
QRect geometry = QGuiApplication::primaryScreen()->geometry();
|
QRect geometry = QGuiApplication::primaryScreen()->geometry();
|
||||||
int x = (geometry.width()-w_courtroom->width()) / 2;
|
int x = (geometry.width() - w_courtroom->width()) / 2;
|
||||||
int y = (geometry.height()-w_courtroom->height()) / 2;
|
int y = (geometry.height() - w_courtroom->height()) / 2;
|
||||||
w_courtroom->move(x, y);
|
w_courtroom->move(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOApplication::destruct_courtroom()
|
void AOApplication::destruct_courtroom()
|
||||||
{
|
{
|
||||||
if (!courtroom_constructed)
|
if (!courtroom_constructed) {
|
||||||
{
|
|
||||||
qDebug() << "W: courtroom was attempted destructed when it did not exist";
|
qDebug() << "W: courtroom was attempted destructed when it did not exist";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -93,16 +89,11 @@ void AOApplication::destruct_courtroom()
|
|||||||
|
|
||||||
QString AOApplication::get_version_string()
|
QString AOApplication::get_version_string()
|
||||||
{
|
{
|
||||||
return
|
return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." +
|
||||||
QString::number(RELEASE) + "." +
|
QString::number(MINOR_VERSION);
|
||||||
QString::number(MAJOR_VERSION) + "." +
|
|
||||||
QString::number(MINOR_VERSION);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOApplication::reload_theme()
|
void AOApplication::reload_theme() { current_theme = read_theme(); }
|
||||||
{
|
|
||||||
current_theme = read_theme();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOApplication::set_favorite_list()
|
void AOApplication::set_favorite_list()
|
||||||
{
|
{
|
||||||
@ -133,8 +124,8 @@ void AOApplication::add_favorite_server(int p_server)
|
|||||||
|
|
||||||
void AOApplication::server_disconnected()
|
void AOApplication::server_disconnected()
|
||||||
{
|
{
|
||||||
if (courtroom_constructed)
|
if (courtroom_constructed) {
|
||||||
{
|
beep();
|
||||||
call_notice(tr("Disconnected from server."));
|
call_notice(tr("Disconnected from server."));
|
||||||
construct_lobby();
|
construct_lobby();
|
||||||
destruct_courtroom();
|
destruct_courtroom();
|
||||||
@ -144,43 +135,44 @@ void AOApplication::server_disconnected()
|
|||||||
void AOApplication::loading_cancelled()
|
void AOApplication::loading_cancelled()
|
||||||
{
|
{
|
||||||
destruct_courtroom();
|
destruct_courtroom();
|
||||||
|
|
||||||
w_lobby->hide_loading_overlay();
|
w_lobby->hide_loading_overlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOApplication::ms_connect_finished(bool connected, bool will_retry)
|
void AOApplication::ms_connect_finished(bool connected, bool will_retry)
|
||||||
{
|
{
|
||||||
if (connected)
|
if (connected) {
|
||||||
{
|
|
||||||
AOPacket *f_packet = new AOPacket("ALL#%");
|
AOPacket *f_packet = new AOPacket("ALL#%");
|
||||||
send_ms_packet(f_packet);
|
send_ms_packet(f_packet);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (will_retry) {
|
||||||
if (will_retry)
|
|
||||||
{
|
|
||||||
if (lobby_constructed)
|
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"
|
call_error(tr("There was an error connecting to the master server.\n"
|
||||||
"We deploy multiple master servers to mitigate any possible downtime, "
|
"We deploy multiple master servers to mitigate any "
|
||||||
"but the client appears to have exhausted all possible methods of finding "
|
"possible downtime, "
|
||||||
"and connecting to one.\n"
|
"but the client appears to have exhausted all possible "
|
||||||
"Please check your Internet connection and firewall, and please try again."));
|
"methods of finding "
|
||||||
|
"and connecting to one.\n"
|
||||||
|
"Please check your Internet connection and firewall, and "
|
||||||
|
"please try again."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOApplication::call_settings_menu()
|
void AOApplication::call_settings_menu()
|
||||||
{
|
{
|
||||||
AOOptionsDialog settings(nullptr, this);
|
AOOptionsDialog settings(nullptr, this);
|
||||||
settings.exec();
|
settings.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOApplication::call_announce_menu(Courtroom *court)
|
void AOApplication::call_announce_menu(Courtroom *court)
|
||||||
{
|
{
|
||||||
AOCaseAnnouncerDialog announcer(nullptr, this, court);
|
AOCaseAnnouncerDialog announcer(nullptr, this, court);
|
||||||
announcer.exec();
|
announcer.exec();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "aoblipplayer.h"
|
#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)
|
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
@ -11,11 +11,11 @@ void AOBlipPlayer::set_blips(QString p_sfx)
|
|||||||
{
|
{
|
||||||
QString f_path = ao_app->get_sounds_path(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]);
|
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);
|
set_volume_internal(m_volume);
|
||||||
@ -44,12 +44,11 @@ void AOBlipPlayer::set_volume_internal(qreal p_value)
|
|||||||
{
|
{
|
||||||
float volume = 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);
|
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)
|
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
@ -60,8 +59,7 @@ void AOBlipPlayer::set_blips(QString p_sfx)
|
|||||||
{
|
{
|
||||||
QString f_path = ao_app->get_sounds_path(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));
|
m_blips.setSource(QUrl::fromLocalFile(f_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,30 +86,18 @@ void AOBlipPlayer::set_volume_internal(qreal p_value)
|
|||||||
{
|
{
|
||||||
m_blips.setVolume(m_volume);
|
m_blips.setVolume(m_volume);
|
||||||
}
|
}
|
||||||
#else //No audio
|
#else // No audio
|
||||||
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
|
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
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_internal(qreal p_value) {}
|
||||||
|
|
||||||
void AOBlipPlayer::set_volume(qreal p_value)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOBlipPlayer::set_volume_internal(qreal p_value)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,15 +3,13 @@
|
|||||||
#include "debug_functions.h"
|
#include "debug_functions.h"
|
||||||
#include "file_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;
|
ao_app = p_ao_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
AOButton::~AOButton()
|
AOButton::~AOButton() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOButton::set_image(QString p_image)
|
void AOButton::set_image(QString p_image)
|
||||||
{
|
{
|
||||||
@ -23,4 +21,3 @@ void AOButton::set_image(QString p_image)
|
|||||||
else
|
else
|
||||||
this->setStyleSheet("border-image:url(\"" + default_image_path + "\")");
|
this->setStyleSheet("border-image:url(\"" + default_image_path + "\")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#include "aocaseannouncerdialog.h"
|
#include "aocaseannouncerdialog.h"
|
||||||
|
|
||||||
AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_ao_app, Courtroom *p_court)
|
AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent,
|
||||||
: QDialog(parent)
|
AOApplication *p_ao_app,
|
||||||
|
Courtroom *p_court)
|
||||||
|
: QDialog(parent)
|
||||||
{
|
{
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
court = p_court;
|
court = p_court;
|
||||||
@ -14,21 +16,27 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
|
|||||||
QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||||
sizepolicy.setHorizontalStretch(0);
|
sizepolicy.setHorizontalStretch(0);
|
||||||
sizepolicy.setVerticalStretch(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->setSizePolicy(sizepolicy);
|
||||||
ui_announcer_buttons->setOrientation(Qt::Horizontal);
|
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(accepted()), this,
|
||||||
QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this, SLOT(cancel_pressed()));
|
SLOT(ok_pressed()));
|
||||||
|
QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this,
|
||||||
|
SLOT(cancel_pressed()));
|
||||||
|
|
||||||
setUpdatesEnabled(false);
|
setUpdatesEnabled(false);
|
||||||
|
|
||||||
ui_vbox_layout = new QVBoxLayout(this);
|
ui_vbox_layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
ui_form_layout = new QFormLayout(this);
|
ui_form_layout = new QFormLayout(this);
|
||||||
ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
||||||
ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop);
|
Qt::AlignVCenter);
|
||||||
|
ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
||||||
|
Qt::AlignTop);
|
||||||
ui_form_layout->setContentsMargins(6, 6, 6, 6);
|
ui_form_layout->setContentsMargins(6, 6, 6, 6);
|
||||||
|
|
||||||
ui_vbox_layout->addItem(ui_form_layout);
|
ui_vbox_layout->addItem(ui_form_layout);
|
||||||
@ -69,18 +77,13 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
|
|||||||
|
|
||||||
void AOCaseAnnouncerDialog::ok_pressed()
|
void AOCaseAnnouncerDialog::ok_pressed()
|
||||||
{
|
{
|
||||||
court->announce_case(ui_case_title_textbox->text(),
|
court->announce_case(
|
||||||
ui_defense_needed->isChecked(),
|
ui_case_title_textbox->text(), ui_defense_needed->isChecked(),
|
||||||
ui_prosecutor_needed->isChecked(),
|
ui_prosecutor_needed->isChecked(), ui_judge_needed->isChecked(),
|
||||||
ui_judge_needed->isChecked(),
|
ui_juror_needed->isChecked(), ui_steno_needed->isChecked(),
|
||||||
ui_juror_needed->isChecked(),
|
ui_witness_needed->isChecked());
|
||||||
ui_steno_needed->isChecked(),
|
|
||||||
ui_witness_needed->isChecked());
|
|
||||||
|
|
||||||
done(0);
|
done(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCaseAnnouncerDialog::cancel_pressed()
|
void AOCaseAnnouncerDialog::cancel_pressed() { done(0); }
|
||||||
{
|
|
||||||
done(0);
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
#include "file_functions.h"
|
#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;
|
m_parent = parent;
|
||||||
|
|
||||||
@ -40,45 +42,35 @@ void AOCharButton::reset()
|
|||||||
ui_selector->hide();
|
ui_selector->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharButton::set_taken(bool is_taken)
|
void AOCharButton::set_taken(bool is_taken) { taken = is_taken; }
|
||||||
{
|
|
||||||
taken = is_taken;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOCharButton::apply_taken_image()
|
void AOCharButton::apply_taken_image()
|
||||||
{
|
{
|
||||||
if (taken)
|
if (taken) {
|
||||||
{
|
ui_taken->move(0, 0);
|
||||||
ui_taken->move(0,0);
|
|
||||||
ui_taken->show();
|
ui_taken->show();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ui_taken->hide();
|
ui_taken->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharButton::set_passworded()
|
void AOCharButton::set_passworded() { ui_passworded->show(); }
|
||||||
{
|
|
||||||
ui_passworded->show();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOCharButton::set_image(QString p_character)
|
void AOCharButton::set_image(QString p_character)
|
||||||
{
|
{
|
||||||
QString image_path = ao_app->get_character_path(p_character, "char_icon.png");
|
QString image_path = ao_app->get_character_path(p_character, "char_icon.png");
|
||||||
|
|
||||||
this->setText("");
|
this->setText("");
|
||||||
|
|
||||||
if (file_exists(image_path))
|
if (file_exists(image_path))
|
||||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
this->setStyleSheet("border-image:url()");
|
this->setStyleSheet("border-image:url()");
|
||||||
this->setText(p_character);
|
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->move(this->x() - 1, this->y() - 1);
|
||||||
ui_selector->raise();
|
ui_selector->raise();
|
||||||
@ -88,10 +80,8 @@ void AOCharButton::enterEvent(QEvent * e)
|
|||||||
QPushButton::enterEvent(e);
|
QPushButton::enterEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharButton::leaveEvent(QEvent * e)
|
void AOCharButton::leaveEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
ui_selector->hide();
|
ui_selector->hide();
|
||||||
QPushButton::leaveEvent(e);
|
QPushButton::leaveEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#include "aocharmovie.h"
|
#include "aocharmovie.h"
|
||||||
|
|
||||||
#include "misc_functions.h"
|
|
||||||
#include "file_functions.h"
|
|
||||||
#include "aoapplication.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;
|
ao_app = p_ao_app;
|
||||||
m_movie = new QMovie(this);
|
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)
|
void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
|
||||||
{
|
{
|
||||||
apng = false;
|
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 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_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;
|
QString gif_path;
|
||||||
current_emote = emote_prefix + p_emote;
|
current_emote = emote_prefix + p_emote;
|
||||||
current_char = p_char;
|
current_char = p_char;
|
||||||
if (file_exists(apng_path))
|
if (file_exists(apng_path)) {
|
||||||
{
|
|
||||||
gif_path = apng_path;
|
gif_path = apng_path;
|
||||||
apng = true;
|
apng = true;
|
||||||
}
|
}
|
||||||
@ -53,7 +59,8 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
|
|||||||
this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
|
this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
|
||||||
this->show();
|
this->show();
|
||||||
this->play_frame_sfx();
|
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) {
|
if (m_movie->frameCount() != 0) {
|
||||||
ticker->start(m_movie->nextFrameDelay());
|
ticker->start(m_movie->nextFrameDelay());
|
||||||
}
|
}
|
||||||
@ -62,151 +69,147 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
|
|||||||
void AOCharMovie::play_frame_sfx()
|
void AOCharMovie::play_frame_sfx()
|
||||||
{
|
{
|
||||||
int current_frame = m_movie->currentFrameNumber();
|
int current_frame = m_movie->currentFrameNumber();
|
||||||
QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, current_emote, current_frame);
|
QString sfx_to_play =
|
||||||
QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, current_emote, current_frame);
|
ao_app->get_frame_sfx_name(current_char, current_emote, current_frame);
|
||||||
QString realization_to_play = ao_app->get_realization_frame(current_char, current_emote, current_frame);
|
QString screenshake_to_play =
|
||||||
if(sfx_to_play != "" && !use_networked_framehell)
|
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));
|
frame_specific_sfx_player->play(ao_app->get_sfx_suffix(sfx_to_play));
|
||||||
}
|
}
|
||||||
else if(use_networked_framehell)
|
else if (use_networked_framehell) {
|
||||||
{
|
this->sfx_two_network_boogaloo();
|
||||||
this->sfx_two_network_boogaloo();
|
|
||||||
}
|
}
|
||||||
if(screenshake_to_play != "" && !use_networked_framehell)
|
if (screenshake_to_play != "" && !use_networked_framehell) {
|
||||||
{
|
|
||||||
mycourtroom->doScreenShake();
|
mycourtroom->doScreenShake();
|
||||||
}
|
}
|
||||||
else if(use_networked_framehell)
|
else if (use_networked_framehell) {
|
||||||
{
|
this->screenshake_two_network_boogaloo();
|
||||||
this->screenshake_two_network_boogaloo();
|
|
||||||
}
|
}
|
||||||
if(realization_to_play != "" && !use_networked_framehell)
|
if (realization_to_play != "" && !use_networked_framehell) {
|
||||||
{
|
|
||||||
mycourtroom->doRealization();
|
mycourtroom->doRealization();
|
||||||
}
|
}
|
||||||
else if(use_networked_framehell)
|
else if (use_networked_framehell) {
|
||||||
{
|
this->realization_two_network_boogaloo();
|
||||||
this->realization_two_network_boogaloo();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::realization_two_network_boogaloo()
|
void AOCharMovie::realization_two_network_boogaloo()
|
||||||
{
|
{
|
||||||
int current_frame = m_movie->currentFrameNumber();
|
int current_frame = m_movie->currentFrameNumber();
|
||||||
QStringList realizationList = this->frame_realization_hellstring.split("^");
|
QStringList realizationList = this->frame_realization_hellstring.split("^");
|
||||||
for (int i = 0; i < realizationList.length(); i++) {
|
for (int i = 0; i < realizationList.length(); i++) {
|
||||||
QString screenshakeList = realizationList.at(i);
|
QString screenshakeList = realizationList.at(i);
|
||||||
QStringList extra_garbage = screenshakeList.split("|");
|
QStringList extra_garbage = screenshakeList.split("|");
|
||||||
if(extra_garbage.at(0) != current_emote){
|
if (extra_garbage.at(0) != current_emote) {
|
||||||
continue;
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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()
|
void AOCharMovie::screenshake_two_network_boogaloo()
|
||||||
{
|
{
|
||||||
int current_frame = m_movie->currentFrameNumber();
|
int current_frame = m_movie->currentFrameNumber();
|
||||||
QStringList realizationList = this->frame_screenshake_hellstring.split("^");
|
QStringList realizationList = this->frame_screenshake_hellstring.split("^");
|
||||||
for (int i = 0; i < realizationList.length(); i++) {
|
for (int i = 0; i < realizationList.length(); i++) {
|
||||||
QString screenshakeList = realizationList.at(i);
|
QString screenshakeList = realizationList.at(i);
|
||||||
QStringList extra_garbage = screenshakeList.split("|");
|
QStringList extra_garbage = screenshakeList.split("|");
|
||||||
if(extra_garbage.at(0) != current_emote){
|
if (extra_garbage.at(0) != current_emote) {
|
||||||
continue;
|
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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()
|
void AOCharMovie::sfx_two_network_boogaloo()
|
||||||
{
|
{
|
||||||
int current_frame = m_movie->currentFrameNumber();
|
int current_frame = m_movie->currentFrameNumber();
|
||||||
QStringList realizationList = this->frame_sfx_hellstring.split("^");
|
QStringList realizationList = this->frame_sfx_hellstring.split("^");
|
||||||
for (int i = 0; i < realizationList.length(); i++) {
|
for (int i = 0; i < realizationList.length(); i++) {
|
||||||
QString screenshakeList = realizationList.at(i);
|
QString screenshakeList = realizationList.at(i);
|
||||||
QStringList extra_garbage = screenshakeList.split("|");
|
QStringList extra_garbage = screenshakeList.split("|");
|
||||||
if(extra_garbage.at(0) != current_emote){
|
if (extra_garbage.at(0) != current_emote) {
|
||||||
continue;
|
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)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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()
|
void AOCharMovie::movie_ticker()
|
||||||
{
|
{
|
||||||
if(apng){
|
if (m_movie->currentFrameNumber() == m_movie->frameCount() - 1) {
|
||||||
ticker->start(m_movie->nextFrameDelay());
|
|
||||||
}
|
|
||||||
if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1)
|
|
||||||
{
|
|
||||||
delete m_movie;
|
delete m_movie;
|
||||||
m_movie = new QMovie(this);
|
m_movie = new QMovie(this);
|
||||||
m_movie->stop();
|
m_movie->stop();
|
||||||
this->clear();
|
this->clear();
|
||||||
m_movie->setFileName(last_path);
|
m_movie->setFileName(last_path);
|
||||||
m_movie->jumpToFrame(0);
|
m_movie->jumpToFrame(0);
|
||||||
if(play_once)
|
if (play_once) {
|
||||||
{
|
timer_done();
|
||||||
timer_done();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
m_movie->jumpToNextFrame();
|
m_movie->jumpToNextFrame();
|
||||||
}
|
}
|
||||||
this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
|
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();
|
this->play_frame_sfx();
|
||||||
|
|
||||||
if (m_movie->frameCount() == 0)
|
if (m_movie->frameCount() == 0) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!apng)
|
else if (!apng) {
|
||||||
{
|
|
||||||
ticker->start(m_movie->nextFrameDelay());
|
ticker->start(m_movie->nextFrameDelay());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image)
|
void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image)
|
||||||
{
|
{
|
||||||
QPixmap f_pixmap;
|
QPixmap f_pixmap;
|
||||||
if(m_flipped)
|
if (m_flipped)
|
||||||
f_pixmap = QPixmap::fromImage(image.mirrored(true, false));
|
f_pixmap = QPixmap::fromImage(image.mirrored(true, false));
|
||||||
else
|
else
|
||||||
f_pixmap = QPixmap::fromImage(image);
|
f_pixmap = QPixmap::fromImage(image);
|
||||||
auto aspect_ratio = Qt::KeepAspectRatio;
|
auto aspect_ratio = Qt::KeepAspectRatio;
|
||||||
|
|
||||||
if (f_pixmap.size().width() > f_pixmap.size().height())
|
if (f_pixmap.size().width() > f_pixmap.size().height())
|
||||||
aspect_ratio = Qt::KeepAspectRatioByExpanding;
|
aspect_ratio = Qt::KeepAspectRatioByExpanding;
|
||||||
|
|
||||||
if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height())
|
if (f_pixmap.size().width() > this->size().width() ||
|
||||||
this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::SmoothTransformation));
|
f_pixmap.size().height() > this->size().height())
|
||||||
else
|
this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio,
|
||||||
this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation));
|
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)
|
void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
|
||||||
@ -234,7 +237,8 @@ void AOCharMovie::play_idle(QString p_char, QString p_emote)
|
|||||||
|
|
||||||
void AOCharMovie::stop()
|
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();
|
m_movie->stop();
|
||||||
frame_specific_sfx_player->stop();
|
frame_specific_sfx_player->stop();
|
||||||
this->hide();
|
this->hide();
|
||||||
@ -253,7 +257,4 @@ void AOCharMovie::move(int ax, int ay)
|
|||||||
QLabel::move(x, y);
|
QLabel::move(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOCharMovie::timer_done()
|
void AOCharMovie::timer_done() { done(); }
|
||||||
{
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
#include "file_functions.h"
|
#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;
|
parent = p_parent;
|
||||||
ao_app = p_ao_app;
|
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)
|
void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix)
|
||||||
{
|
{
|
||||||
QString emotion_number = QString::number(p_emote + 1);
|
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->setText("");
|
||||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
this->setText(ao_app->get_emote_comment(p_char, p_emote));
|
this->setText(ao_app->get_emote_comment(p_char, p_emote));
|
||||||
this->setStyleSheet("border-image:url(\"\")");
|
this->setStyleSheet("border-image:url(\"\")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOEmoteButton::on_clicked()
|
void AOEmoteButton::on_clicked() { emote_clicked(m_id); }
|
||||||
{
|
|
||||||
emote_clicked(m_id);
|
|
||||||
}
|
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
#include "file_functions.h"
|
#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;
|
ao_app = p_ao_app;
|
||||||
m_parent = p_parent;
|
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);
|
QString image_path = ao_app->get_evidence_path(p_image);
|
||||||
|
|
||||||
if (file_exists(image_path))
|
if (file_exists(image_path)) {
|
||||||
{
|
|
||||||
this->setText("");
|
this->setText("");
|
||||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
this->setText(p_image);
|
this->setText(p_image);
|
||||||
this->setStyleSheet("");
|
this->setStyleSheet("");
|
||||||
}
|
}
|
||||||
@ -75,10 +75,7 @@ void AOEvidenceButton::set_selected(bool p_selected)
|
|||||||
ui_selected->hide();
|
ui_selected->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOEvidenceButton::on_clicked()
|
void AOEvidenceButton::on_clicked() { evidence_clicked(m_id); }
|
||||||
{
|
|
||||||
evidence_clicked(m_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
|
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();
|
ui_selector->show();
|
||||||
|
|
||||||
@ -108,7 +105,7 @@ void AOEvidenceButton::enterEvent(QEvent * e)
|
|||||||
QPushButton::enterEvent(e);
|
QPushButton::enterEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOEvidenceButton::leaveEvent(QEvent * e)
|
void AOEvidenceButton::leaveEvent(QEvent *e)
|
||||||
{
|
{
|
||||||
ui_selector->hide();
|
ui_selector->hide();
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
#include "aoevidencedisplay.h"
|
#include "aoevidencedisplay.h"
|
||||||
|
|
||||||
#include "file_functions.h"
|
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
|
#include "file_functions.h"
|
||||||
#include "misc_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;
|
ao_app = p_ao_app;
|
||||||
|
|
||||||
@ -12,10 +13,12 @@ AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app)
|
|||||||
evidence_icon = new QLabel(this);
|
evidence_icon = new QLabel(this);
|
||||||
sfx_player = new AOSfxPlayer(this, ao_app);
|
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();
|
this->reset();
|
||||||
|
|
||||||
@ -29,23 +32,23 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid
|
|||||||
QString gif_name;
|
QString gif_name;
|
||||||
QString icon_identifier;
|
QString icon_identifier;
|
||||||
|
|
||||||
if (is_left_side)
|
if (is_left_side) {
|
||||||
{
|
|
||||||
icon_identifier = "left_evidence_icon";
|
icon_identifier = "left_evidence_icon";
|
||||||
gif_name = "evidence_appear_left.gif";
|
gif_name = "evidence_appear_left.gif";
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
icon_identifier = "right_evidence_icon";
|
icon_identifier = "right_evidence_icon";
|
||||||
gif_name = "evidence_appear_right.gif";
|
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->move(icon_dimensions.x, icon_dimensions.y);
|
||||||
evidence_icon->resize(icon_dimensions.width, icon_dimensions.height);
|
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_default_gif_path = ao_app->get_default_theme_path(gif_name);
|
||||||
QString f_gif_path = ao_app->get_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);
|
evidence_movie->setFileName(final_gif_path);
|
||||||
|
|
||||||
if(evidence_movie->frameCount() < 1)
|
if (evidence_movie->frameCount() < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this->setMovie(evidence_movie);
|
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)
|
void AOEvidenceDisplay::frame_change(int p_frame)
|
||||||
{
|
{
|
||||||
if (p_frame == (evidence_movie->frameCount() - 1))
|
if (p_frame == (evidence_movie->frameCount() - 1)) {
|
||||||
{
|
// we need this or else the last frame wont show
|
||||||
//we need this or else the last frame wont show
|
|
||||||
delay(evidence_movie->nextFrameDelay());
|
delay(evidence_movie->nextFrameDelay());
|
||||||
|
|
||||||
evidence_movie->stop();
|
evidence_movie->stop();
|
||||||
@ -88,9 +90,4 @@ void AOEvidenceDisplay::reset()
|
|||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
QLabel* AOEvidenceDisplay::get_evidence_icon()
|
QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; }
|
||||||
{
|
|
||||||
return evidence_icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,10 +8,7 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
|
|||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
AOImage::~AOImage()
|
AOImage::~AOImage() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOImage::set_image(QString p_image)
|
void AOImage::set_image(QString p_image)
|
||||||
{
|
{
|
||||||
@ -27,7 +24,8 @@ void AOImage::set_image(QString p_image)
|
|||||||
|
|
||||||
QPixmap f_pixmap(final_image_path);
|
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)
|
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);
|
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);
|
this->setReadOnly(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOLineEdit::on_enter_pressed()
|
void AOLineEdit::on_enter_pressed() { this->setReadOnly(true); }
|
||||||
{
|
|
||||||
this->setReadOnly(true);
|
|
||||||
}
|
|
||||||
|
110
src/aomovie.cpp
110
src/aomovie.cpp
@ -1,7 +1,7 @@
|
|||||||
#include "aomovie.h"
|
#include "aomovie.h"
|
||||||
|
|
||||||
#include "file_functions.h"
|
|
||||||
#include "courtroom.h"
|
#include "courtroom.h"
|
||||||
|
#include "file_functions.h"
|
||||||
#include "misc_functions.h"
|
#include "misc_functions.h"
|
||||||
|
|
||||||
AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
|
AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
|
||||||
@ -11,55 +11,77 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
|
|||||||
m_movie = new QMovie();
|
m_movie = new QMovie();
|
||||||
|
|
||||||
this->setMovie(m_movie);
|
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(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)
|
void AOMovie::set_play_once(bool p_play_once) { play_once = p_play_once; }
|
||||||
{
|
void AOMovie::start_timer(int delay) { timer->start(delay); }
|
||||||
play_once = p_play_once;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme)
|
void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme,
|
||||||
|
int duration)
|
||||||
{
|
{
|
||||||
|
|
||||||
m_movie->stop();
|
m_movie->stop();
|
||||||
|
// this->timer_done();
|
||||||
|
QString shout_path = p_gif;
|
||||||
|
QList<QString> pathlist;
|
||||||
|
|
||||||
QString gif_path;
|
if (ao_app->get_character_path(p_char, p_gif)
|
||||||
|
.contains(
|
||||||
QString custom_path;
|
"custom_objections")) // checks if the file is located within the
|
||||||
if (p_gif == "custom")
|
// folder of custom objections
|
||||||
custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif));
|
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
|
else
|
||||||
custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble"));
|
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 misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" +
|
||||||
QString custom_theme_path = ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif");
|
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 theme_path = ao_app->get_theme_path(p_gif + ".gif");
|
||||||
QString default_theme_path = ao_app->get_default_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 placeholder_path = ao_app->get_theme_path("placeholder.gif");
|
||||||
QString default_placeholder_path = ao_app->get_default_theme_path("placeholder.gif");
|
QString default_placeholder_path =
|
||||||
|
ao_app->get_default_theme_path("placeholder.gif");
|
||||||
|
|
||||||
if (file_exists(custom_path))
|
pathlist << ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" +
|
||||||
gif_path = custom_path;
|
p_custom_theme + "/" + p_gif + "_bubble")
|
||||||
else if (file_exists(misc_path))
|
<< // Misc path
|
||||||
gif_path = misc_path;
|
ao_app->get_image_suffix(
|
||||||
else if (file_exists(custom_theme_path))
|
ao_app->get_custom_theme_path(p_custom_theme, p_gif))
|
||||||
gif_path = custom_theme_path;
|
<< // Custom theme path
|
||||||
else if (file_exists(theme_path))
|
ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)) << // Theme path
|
||||||
gif_path = theme_path;
|
ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif))
|
||||||
else if (file_exists(default_theme_path))
|
<< // Default theme path
|
||||||
gif_path = default_theme_path;
|
ao_app->get_image_suffix(ao_app->get_theme_path("placeholder"))
|
||||||
else if (file_exists(placeholder_path))
|
<< // Placeholder path
|
||||||
gif_path = placeholder_path;
|
ao_app->get_image_suffix(ao_app->get_default_theme_path(
|
||||||
else if (file_exists(default_placeholder_path))
|
"placeholder")); // Default placeholder path
|
||||||
gif_path = default_placeholder_path;
|
|
||||||
else
|
|
||||||
gif_path = "";
|
|
||||||
|
|
||||||
m_movie->setFileName(gif_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();
|
this->show();
|
||||||
m_movie->start();
|
m_movie->start();
|
||||||
|
if (m_movie->frameCount() == 0 && duration > 0)
|
||||||
|
timer->start(duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOMovie::stop()
|
void AOMovie::stop()
|
||||||
@ -70,16 +92,20 @@ void AOMovie::stop()
|
|||||||
|
|
||||||
void AOMovie::frame_change(int n_frame)
|
void AOMovie::frame_change(int n_frame)
|
||||||
{
|
{
|
||||||
if (n_frame == (m_movie->frameCount() - 1) && play_once)
|
// 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
|
||||||
//we need this or else the last frame wont show
|
// reach the last frame or the movie is continuous, don't stop the movie.
|
||||||
delay(m_movie->nextFrameDelay());
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
this->stop();
|
void AOMovie::timer_done()
|
||||||
|
{
|
||||||
//signal connected to courtroom object, let it figure out what to do
|
this->stop();
|
||||||
done();
|
done();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOMovie::combo_resize(int w, int h)
|
void AOMovie::combo_resize(int w, int h)
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
#include "aomusicplayer.h"
|
#include "aomusicplayer.h"
|
||||||
|
|
||||||
#if defined(BASSAUDIO)
|
#if defined(BASSAUDIO)
|
||||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
|
: QObject()
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
AOMusicPlayer::~AOMusicPlayer()
|
AOMusicPlayer::~AOMusicPlayer() { kill_loop(); }
|
||||||
{
|
|
||||||
kill_loop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOMusicPlayer::play(QString p_song)
|
void AOMusicPlayer::play(QString p_song)
|
||||||
{
|
{
|
||||||
@ -19,27 +17,26 @@ void AOMusicPlayer::play(QString p_song)
|
|||||||
f_path = ao_app->get_music_path(p_song);
|
f_path = ao_app->get_music_path(p_song);
|
||||||
|
|
||||||
if (p_song.startsWith("http")) {
|
if (p_song.startsWith("http")) {
|
||||||
m_stream = BASS_StreamCreateURL(f_path.toStdWString().c_str(), 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE, NULL, NULL);
|
m_stream = BASS_StreamCreateURL(f_path.toStdWString().c_str(), 0,
|
||||||
|
BASS_STREAM_AUTOFREE | BASS_UNICODE |
|
||||||
|
BASS_ASYNCFILE, NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
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);
|
this->set_volume(m_volume);
|
||||||
|
|
||||||
if (ao_app->get_audio_output_device() != "default")
|
if (ao_app->get_audio_output_device() != "default")
|
||||||
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
||||||
if(enable_looping)
|
if (enable_looping) {
|
||||||
{
|
|
||||||
BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
|
BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
|
BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
|
||||||
}
|
}
|
||||||
BASS_ChannelPlay(m_stream, false);
|
BASS_ChannelPlay(m_stream, false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOMusicPlayer::set_volume(int p_value)
|
void AOMusicPlayer::set_volume(int p_value)
|
||||||
@ -49,27 +46,19 @@ void AOMusicPlayer::set_volume(int p_value)
|
|||||||
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
|
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOMusicPlayer::get_path()
|
QString AOMusicPlayer::get_path() { return f_path; }
|
||||||
{
|
|
||||||
return f_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOMusicPlayer::kill_loop()
|
void AOMusicPlayer::kill_loop() { BASS_ChannelStop(m_stream); }
|
||||||
{
|
|
||||||
BASS_ChannelStop(m_stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
#elif defined(QTAUDIO)
|
#elif defined(QTAUDIO)
|
||||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
|
: QObject()
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
}
|
}
|
||||||
|
|
||||||
AOMusicPlayer::~AOMusicPlayer()
|
AOMusicPlayer::~AOMusicPlayer() { m_player.stop(); }
|
||||||
{
|
|
||||||
m_player.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOMusicPlayer::play(QString p_song)
|
void AOMusicPlayer::play(QString p_song)
|
||||||
{
|
{
|
||||||
@ -92,47 +81,27 @@ void AOMusicPlayer::set_volume(int p_value)
|
|||||||
QAudio::LogarithmicVolumeScale,
|
QAudio::LogarithmicVolumeScale,
|
||||||
QAudio::LinearVolumeScale);
|
QAudio::LinearVolumeScale);
|
||||||
|
|
||||||
m_player.setVolume(linearVolume*100);
|
m_player.setVolume(linearVolume * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOMusicPlayer::get_path()
|
QString AOMusicPlayer::get_path() { return f_path; }
|
||||||
{
|
|
||||||
return f_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOMusicPlayer::kill_loop()
|
void AOMusicPlayer::kill_loop() { m_player.stop(); }
|
||||||
{
|
|
||||||
m_player.stop();
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||||
|
: QObject()
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
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)
|
void AOMusicPlayer::kill_loop() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AOMusicPlayer::get_path()
|
|
||||||
{
|
|
||||||
return f_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOMusicPlayer::kill_loop()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -8,8 +8,7 @@ AOPacket::AOPacket(QString p_packet_string)
|
|||||||
|
|
||||||
m_header = packet_contents.at(0);
|
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));
|
m_contents.append(packet_contents.at(n_string));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -20,23 +19,18 @@ AOPacket::AOPacket(QString p_header, QStringList &p_contents)
|
|||||||
m_contents = p_contents;
|
m_contents = p_contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
AOPacket::~AOPacket()
|
AOPacket::~AOPacket() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AOPacket::to_string()
|
QString AOPacket::to_string()
|
||||||
{
|
{
|
||||||
QString f_string = m_header;
|
QString f_string = m_header;
|
||||||
|
|
||||||
for (QString i_string : m_contents)
|
for (QString i_string : m_contents) {
|
||||||
{
|
|
||||||
f_string += ("#" + i_string);
|
f_string += ("#" + i_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
f_string += "#%";
|
f_string += "#%";
|
||||||
|
|
||||||
|
|
||||||
if (encrypted)
|
if (encrypted)
|
||||||
return "#" + f_string;
|
return "#" + f_string;
|
||||||
else
|
else
|
||||||
@ -59,10 +53,12 @@ void AOPacket::decrypt_header(unsigned int p_key)
|
|||||||
|
|
||||||
void AOPacket::net_encode()
|
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);
|
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.removeAt(n_element);
|
||||||
m_contents.insert(n_element, f_element);
|
m_contents.insert(n_element, f_element);
|
||||||
@ -71,13 +67,14 @@ void AOPacket::net_encode()
|
|||||||
|
|
||||||
void AOPacket::net_decode()
|
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);
|
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.removeAt(n_element);
|
||||||
m_contents.insert(n_element, f_element);
|
m_contents.insert(n_element, f_element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,16 +7,19 @@ AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
|
|||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
m_movie = new QMovie(this);
|
m_movie = new QMovie(this);
|
||||||
|
last_image = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOScene::set_image(QString p_image)
|
void AOScene::set_image(QString p_image)
|
||||||
{
|
{
|
||||||
QString background_path = ao_app->get_background_path(p_image + ".png");
|
QString background_path =
|
||||||
QString animated_background_path = ao_app->get_background_path(p_image + ".gif");
|
ao_app->get_image_suffix(ao_app->get_background_path(p_image));
|
||||||
QString default_path = ao_app->get_default_background_path(p_image + ".png");
|
if (!file_exists(background_path))
|
||||||
|
background_path = ao_app->get_image_suffix(
|
||||||
|
ao_app->get_default_background_path(p_image)); // Default path
|
||||||
|
|
||||||
QPixmap background(background_path);
|
if (file_exists(background_path) && background_path == last_image)
|
||||||
QPixmap default_bg(default_path);
|
return;
|
||||||
|
|
||||||
int w = this->width();
|
int w = this->width();
|
||||||
int h = this->height();
|
int h = this->height();
|
||||||
@ -25,52 +28,58 @@ void AOScene::set_image(QString p_image)
|
|||||||
this->setMovie(nullptr);
|
this->setMovie(nullptr);
|
||||||
|
|
||||||
m_movie->stop();
|
m_movie->stop();
|
||||||
m_movie->setFileName(animated_background_path);
|
m_movie->setFileName(background_path);
|
||||||
m_movie->setScaledSize(QSize(w, h));
|
m_movie->setScaledSize(QSize(w, h));
|
||||||
|
|
||||||
if (m_movie->isValid())
|
if (m_movie->isValid()) {
|
||||||
{
|
|
||||||
this->setMovie(m_movie);
|
this->setMovie(m_movie);
|
||||||
m_movie->start();
|
m_movie->start();
|
||||||
}
|
}
|
||||||
else if (file_exists(background_path))
|
else {
|
||||||
{
|
QPixmap background(background_path);
|
||||||
this->setPixmap(background.scaled(w, h));
|
this->setPixmap(background.scaled(w, h));
|
||||||
}
|
}
|
||||||
else
|
last_image = background_path;
|
||||||
{
|
|
||||||
this->setPixmap(default_bg.scaled(w, h));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOScene::set_legacy_desk(QString p_image)
|
void AOScene::set_legacy_desk(QString p_image)
|
||||||
{
|
{
|
||||||
//vanilla desks vary in both width and height. in order to make that work with viewport rescaling,
|
|
||||||
//some INTENSE math is needed.
|
|
||||||
|
|
||||||
QString desk_path = ao_app->get_background_path(p_image);
|
QString desk_path =
|
||||||
QString default_path = ao_app->get_default_background_path(p_image);
|
ao_app->get_image_suffix(ao_app->get_background_path(p_image));
|
||||||
|
if (!file_exists(desk_path))
|
||||||
|
desk_path = ao_app->get_image_suffix(
|
||||||
|
ao_app->get_default_background_path(p_image)); // Default path
|
||||||
|
|
||||||
QPixmap f_desk;
|
if (file_exists(desk_path) && desk_path == last_image)
|
||||||
|
return;
|
||||||
|
QPixmap f_desk(desk_path);
|
||||||
|
|
||||||
if (file_exists(desk_path))
|
// vanilla desks vary in both width and height. in order to make that work
|
||||||
f_desk.load(desk_path);
|
// with viewport rescaling, some INTENSE math is needed.
|
||||||
else
|
|
||||||
f_desk.load(default_path);
|
|
||||||
|
|
||||||
int vp_width = m_parent->width();
|
int vp_width = m_parent->width();
|
||||||
int vp_height = m_parent->height();
|
int vp_height = m_parent->height();
|
||||||
|
|
||||||
//double y_modifier = 147 / 192;
|
|
||||||
//double w_modifier = vp_width / 256;
|
|
||||||
double h_modifier = vp_height / 192;
|
double h_modifier = vp_height / 192;
|
||||||
|
|
||||||
//int final_y = y_modifier * vp_height;
|
|
||||||
//int final_w = w_modifier * f_desk.width();
|
|
||||||
int final_h = static_cast<int>(h_modifier * f_desk.height());
|
int final_h = static_cast<int>(h_modifier * f_desk.height());
|
||||||
|
|
||||||
//this->resize(final_w, final_h);
|
this->clear();
|
||||||
//this->setPixmap(f_desk.scaled(final_w, final_h));
|
this->setMovie(nullptr);
|
||||||
this->resize(vp_width, final_h);
|
|
||||||
this->setPixmap(f_desk.scaled(vp_width, final_h));
|
m_movie->stop();
|
||||||
|
m_movie->setFileName(desk_path);
|
||||||
|
|
||||||
|
m_movie->setScaledSize(QSize(vp_width, final_h));
|
||||||
|
|
||||||
|
if (m_movie->isValid()) {
|
||||||
|
this->setMovie(m_movie);
|
||||||
|
m_movie->start();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this->resize(vp_width, final_h);
|
||||||
|
this->setPixmap(f_desk.scaled(vp_width, final_h));
|
||||||
|
}
|
||||||
|
last_image = desk_path;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#include "aosfxplayer.h"
|
#include "aosfxplayer.h"
|
||||||
#include "file_functions.h"
|
#include "file_functions.h"
|
||||||
|
|
||||||
#if defined(BASSAUDIO) //Using bass.dll for sfx
|
#if defined(BASSAUDIO) // Using bass.dll for sfx
|
||||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject()
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
@ -24,38 +24,35 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
|
|||||||
QString f_path;
|
QString f_path;
|
||||||
|
|
||||||
if (file_exists(char_path))
|
if (file_exists(char_path))
|
||||||
f_path = char_path;
|
f_path = char_path;
|
||||||
else if (file_exists(misc_path))
|
else if (file_exists(misc_path))
|
||||||
f_path = misc_path;
|
f_path = misc_path;
|
||||||
else
|
else
|
||||||
f_path = sound_path;
|
f_path = sound_path;
|
||||||
BASS_ChannelStop(m_stream);
|
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);
|
set_volume_internal(m_volume);
|
||||||
|
|
||||||
if (ao_app->get_audio_output_device() != "default")
|
if (ao_app->get_audio_output_device() != "default")
|
||||||
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
||||||
BASS_ChannelPlay(m_stream, false);
|
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);
|
BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
|
BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::setLooping(bool is_looping)
|
void AOSfxPlayer::setLooping(bool is_looping)
|
||||||
{
|
{
|
||||||
this->looping_sfx = is_looping;
|
this->looping_sfx = is_looping;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::stop()
|
void AOSfxPlayer::stop() { BASS_ChannelStop(m_stream); }
|
||||||
{
|
|
||||||
BASS_ChannelStop(m_stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOSfxPlayer::set_volume(qreal p_value)
|
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)
|
void AOSfxPlayer::set_volume_internal(qreal p_value)
|
||||||
{
|
{
|
||||||
float volume = p_value;
|
float volume = p_value;
|
||||||
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
|
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
|
||||||
}
|
}
|
||||||
#elif defined(QTAUDIO) //Using Qt's QSoundEffect class
|
#elif defined(QTAUDIO) // Using Qt's QSoundEffect class
|
||||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject()
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
ao_app = p_ao_app;
|
||||||
@ -91,35 +88,32 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
|
|||||||
QString f_path;
|
QString f_path;
|
||||||
|
|
||||||
if (file_exists(char_path))
|
if (file_exists(char_path))
|
||||||
f_path = char_path;
|
f_path = char_path;
|
||||||
else if (file_exists(misc_path))
|
else if (file_exists(misc_path))
|
||||||
f_path = misc_path;
|
f_path = misc_path;
|
||||||
else
|
else
|
||||||
f_path = sound_path;
|
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)
|
void AOSfxPlayer::setLooping(bool is_looping)
|
||||||
{
|
{
|
||||||
this->looping_sfx = is_looping;
|
this->looping_sfx = is_looping;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOSfxPlayer::stop()
|
void AOSfxPlayer::stop() { m_sfx.stop(); }
|
||||||
{
|
|
||||||
m_sfx.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AOSfxPlayer::set_volume(qreal p_value)
|
void AOSfxPlayer::set_volume(qreal p_value)
|
||||||
{
|
{
|
||||||
m_volume = p_value/100;
|
m_volume = p_value / 100;
|
||||||
set_volume_internal(m_volume);
|
set_volume_internal(m_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,34 +122,22 @@ void AOSfxPlayer::set_volume_internal(qreal p_value)
|
|||||||
m_sfx.setVolume(m_volume);
|
m_sfx.setVolume(m_volume);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject()
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
ao_app = p_ao_app;
|
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)
|
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
|
#endif
|
||||||
|
@ -1,24 +1,30 @@
|
|||||||
#include "aotextarea.h"
|
#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)
|
||||||
void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour)
|
|
||||||
{
|
{
|
||||||
const QTextCursor old_cursor = this->textCursor();
|
const QTextCursor old_cursor = this->textCursor();
|
||||||
const int old_scrollbar_value = this->verticalScrollBar()->value();
|
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->moveCursor(QTextCursor::End);
|
||||||
|
|
||||||
this->append("");
|
this->append("");
|
||||||
this->insertHtml("<b><font color=" + p_colour + ">" + p_name.toHtmlEscaped() + "</font></b>: ");
|
if (song)
|
||||||
|
this->insertHtml("<b><font color=" + p_colour + ">" +
|
||||||
|
p_name.toHtmlEscaped() + "</font></b> ");
|
||||||
|
else
|
||||||
|
this->insertHtml("<b><font color=" + p_colour + ">" +
|
||||||
|
p_name.toHtmlEscaped() + "</font></b>: ");
|
||||||
|
|
||||||
//cheap workarounds ahoy
|
// cheap workarounds ahoy
|
||||||
p_message += " ";
|
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);
|
this->insertHtml(result);
|
||||||
|
|
||||||
@ -29,32 +35,35 @@ void AOTextArea::append_error(QString p_message)
|
|||||||
{
|
{
|
||||||
const QTextCursor old_cursor = this->textCursor();
|
const QTextCursor old_cursor = this->textCursor();
|
||||||
const int old_scrollbar_value = this->verticalScrollBar()->value();
|
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->moveCursor(QTextCursor::End);
|
||||||
|
|
||||||
this->append("");
|
this->append("");
|
||||||
|
|
||||||
p_message += " ";
|
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->insertHtml("<font color='red'>" + result + "</font>");
|
||||||
|
|
||||||
this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down);
|
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)
|
if (old_cursor.hasSelection() || !is_scrolled_down) {
|
||||||
{
|
// The user has selected text or scrolled away from the bottom: maintain
|
||||||
// The user has selected text or scrolled away from the bottom: maintain position.
|
// position.
|
||||||
this->setTextCursor(old_cursor);
|
this->setTextCursor(old_cursor);
|
||||||
this->verticalScrollBar()->setValue(old_scrollbar_value);
|
this->verticalScrollBar()->setValue(old_scrollbar_value);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
// The user hasn't selected any text and the scrollbar is at the bottom:
|
||||||
// The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom.
|
// scroll to the bottom.
|
||||||
this->moveCursor(QTextCursor::End);
|
this->moveCursor(QTextCursor::End);
|
||||||
this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum());
|
this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ AOTextEdit::AOTextEdit(QWidget *parent) : QPlainTextEdit(parent)
|
|||||||
{
|
{
|
||||||
this->setReadOnly(true);
|
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)
|
void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
|
||||||
@ -14,8 +14,4 @@ void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
|
|||||||
this->setReadOnly(false);
|
this->setReadOnly(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOTextEdit::on_enter_pressed()
|
void AOTextEdit::on_enter_pressed() { this->setReadOnly(true); }
|
||||||
{
|
|
||||||
this->setReadOnly(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,62 +1,57 @@
|
|||||||
#include "courtroom.h"
|
#include "courtroom.h"
|
||||||
#include "lobby.h"
|
#include "lobby.h"
|
||||||
|
|
||||||
#include "file_functions.h"
|
|
||||||
#include "debug_functions.h"
|
#include "debug_functions.h"
|
||||||
|
#include "file_functions.h"
|
||||||
#include "hardware_functions.h"
|
#include "hardware_functions.h"
|
||||||
|
|
||||||
class AOCharSelectGenerationThreading : public QRunnable
|
class AOCharSelectGenerationThreading : public QRunnable {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
Courtroom *thisCourtroom;
|
Courtroom *thisCourtroom;
|
||||||
int char_num;
|
int char_num;
|
||||||
AOCharButton *char_button;
|
AOCharButton *char_button;
|
||||||
AOCharSelectGenerationThreading(Courtroom *my_courtroom, int character_number, AOCharButton *charbut){
|
AOCharSelectGenerationThreading(Courtroom *my_courtroom, int character_number)
|
||||||
thisCourtroom = my_courtroom;
|
{
|
||||||
char_num = character_number;
|
thisCourtroom = my_courtroom;
|
||||||
char_button = charbut;
|
char_num = character_number;
|
||||||
}
|
}
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
AOCharButton* thisCharacterButton = char_button;
|
// we take the button we are supposed to mess with, and not whatever comes
|
||||||
thisCharacterButton->reset();
|
// first
|
||||||
thisCharacterButton->hide();
|
AOCharButton *thisCharacterButton =
|
||||||
thisCharacterButton->set_image(thisCourtroom->char_list.at(char_num).name);
|
thisCourtroom->ui_char_button_list.at(char_num);
|
||||||
thisCourtroom->ui_char_button_list.append(thisCharacterButton);
|
thisCharacterButton->reset();
|
||||||
|
thisCharacterButton->hide();
|
||||||
|
thisCharacterButton->set_image(thisCourtroom->char_list.at(char_num).name);
|
||||||
|
|
||||||
thisCourtroom->connect(thisCharacterButton, SIGNAL(clicked()), thisCourtroom->char_button_mapper, SLOT(map()));
|
thisCourtroom->connect(thisCharacterButton, SIGNAL(clicked()),
|
||||||
thisCourtroom->char_button_mapper->setMapping(thisCharacterButton, thisCourtroom->ui_char_button_list.size() - 1);
|
thisCourtroom->char_button_mapper, SLOT(map()));
|
||||||
}
|
thisCourtroom->char_button_mapper->setMapping(thisCharacterButton,
|
||||||
|
char_num);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class AOCharSelectFilterThreading : public QRunnable
|
void AOCharSelectFilter(Courtroom *thisCourtroom, int char_num)
|
||||||
{
|
{
|
||||||
public:
|
AOCharButton *current_char = thisCourtroom->ui_char_button_list.at(char_num);
|
||||||
Courtroom *thisCourtroom;
|
|
||||||
int char_num;
|
|
||||||
AOCharSelectFilterThreading(Courtroom *my_courtroom, int character_number){
|
|
||||||
thisCourtroom = my_courtroom;
|
|
||||||
char_num = character_number;
|
|
||||||
}
|
|
||||||
void run()
|
|
||||||
{
|
|
||||||
AOCharButton* current_char = thisCourtroom->ui_char_button_list.at(char_num);
|
|
||||||
|
|
||||||
if (!thisCourtroom->ui_char_taken->isChecked() && thisCourtroom->char_list.at(char_num).taken)
|
if (!thisCourtroom->ui_char_taken->isChecked() &&
|
||||||
return;
|
thisCourtroom->char_list.at(char_num).taken)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!thisCourtroom->char_list.at(char_num).name.contains(thisCourtroom->ui_char_search->text(), Qt::CaseInsensitive))
|
if (!thisCourtroom->char_list.at(char_num).name.contains(
|
||||||
return;
|
thisCourtroom->ui_char_search->text(), Qt::CaseInsensitive))
|
||||||
|
return;
|
||||||
|
|
||||||
// We only really need to update the fact that a character is taken
|
// We only really need to update the fact that a character is taken
|
||||||
// for the buttons that actually appear.
|
// for the buttons that actually appear.
|
||||||
// You'd also update the passwordedness and etc. here later.
|
// You'd also update the passwordedness and etc. here later.
|
||||||
current_char->reset();
|
current_char->reset();
|
||||||
current_char->set_taken(thisCourtroom->char_list.at(char_num).taken);
|
current_char->set_taken(thisCourtroom->char_list.at(char_num).taken);
|
||||||
|
|
||||||
thisCourtroom->ui_char_button_list_filtered.append(current_char);
|
thisCourtroom->ui_char_button_list_filtered.append(current_char);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
void Courtroom::construct_char_select()
|
void Courtroom::construct_char_select()
|
||||||
{
|
{
|
||||||
@ -97,28 +92,36 @@ void Courtroom::construct_char_select()
|
|||||||
|
|
||||||
set_size_and_pos(ui_char_buttons, "char_buttons");
|
set_size_and_pos(ui_char_buttons, "char_buttons");
|
||||||
|
|
||||||
connect(char_button_mapper, SIGNAL(mapped(int)), this, SLOT(char_clicked(int)));
|
connect(char_button_mapper, SIGNAL(mapped(int)), this,
|
||||||
connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked()));
|
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_left, SIGNAL(clicked()), this,
|
||||||
connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked()));
|
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_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_search, SIGNAL(textEdited(const QString &)), this,
|
||||||
connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, SLOT(on_char_passworded_clicked()));
|
SLOT(on_char_search_changed()));
|
||||||
connect(ui_char_taken, SIGNAL(stateChanged(int)), this, SLOT(on_char_taken_clicked()));
|
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()
|
void Courtroom::set_char_select()
|
||||||
{
|
{
|
||||||
QString filename = "courtroom_design.ini";
|
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)
|
if (f_charselect.width < 0 || f_charselect.height < 0) {
|
||||||
{
|
qDebug()
|
||||||
qDebug() << "W: did not find courtroom width or height in courtroom_design.ini!";
|
<< "W: did not find courtroom width or height in courtroom_design.ini!";
|
||||||
this->resize(714, 668);
|
this->resize(714, 668);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -139,25 +142,22 @@ void Courtroom::set_char_select_page()
|
|||||||
ui_char_select_left->hide();
|
ui_char_select_left->hide();
|
||||||
ui_char_select_right->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->reset();
|
||||||
i_button->hide();
|
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 total_pages = ui_char_button_list_filtered.size() / max_chars_on_page;
|
||||||
int chars_on_page = 0;
|
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;
|
++total_pages;
|
||||||
//i. e. not on the last page
|
// i. e. not on the last page
|
||||||
if (total_pages > current_char_page + 1)
|
if (total_pages > current_char_page + 1)
|
||||||
chars_on_page = max_chars_on_page;
|
chars_on_page = max_chars_on_page;
|
||||||
else
|
else
|
||||||
chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page;
|
chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
chars_on_page = max_chars_on_page;
|
chars_on_page = max_chars_on_page;
|
||||||
@ -173,24 +173,25 @@ void Courtroom::set_char_select_page()
|
|||||||
|
|
||||||
void Courtroom::char_clicked(int n_char)
|
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;
|
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));
|
call_notice(tr("Could not find %1").arg(char_ini_path, 1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_char == m_cid)
|
if (n_char == m_cid) {
|
||||||
{
|
|
||||||
enter_courtroom(m_cid);
|
enter_courtroom(m_cid);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
ao_app->send_server_packet(
|
||||||
ao_app->send_server_packet(new AOPacket("PW#" + ui_char_password->text() + "#%"));
|
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() + "#%"));
|
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);
|
ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name);
|
||||||
@ -198,100 +199,94 @@ void Courtroom::char_clicked(int n_char)
|
|||||||
|
|
||||||
void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
|
void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
|
||||||
{
|
{
|
||||||
if (ui_char_button_list_filtered.size() == 0)
|
if (ui_char_button_list_filtered.size() == 0)
|
||||||
return;
|
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_spacing = f_spacing.x();
|
||||||
int x_mod_count = 0;
|
int x_mod_count = 0;
|
||||||
|
|
||||||
int y_spacing = f_spacing.y();
|
int y_spacing = f_spacing.y();
|
||||||
int y_mod_count = 0;
|
int y_mod_count = 0;
|
||||||
|
|
||||||
char_columns = ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) + 1;
|
char_columns =
|
||||||
char_rows = ((ui_char_buttons->height() - button_height) / (y_spacing + button_height)) + 1;
|
((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;
|
int startout = starting;
|
||||||
for (int n = starting ; n < startout+chars_on_this_page ; ++n)
|
for (int n = starting; n < startout + chars_on_this_page; ++n) {
|
||||||
{
|
int x_pos = (button_width + x_spacing) * x_mod_count;
|
||||||
int x_pos = (button_width + x_spacing) * x_mod_count;
|
int y_pos = (button_height + y_spacing) * y_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)->move(x_pos, y_pos);
|
||||||
ui_char_button_list_filtered.at(n)->show();
|
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)->apply_taken_image();
|
||||||
|
|
||||||
++x_mod_count;
|
++x_mod_count;
|
||||||
|
|
||||||
if (x_mod_count == char_columns)
|
if (x_mod_count == char_columns) {
|
||||||
{
|
++y_mod_count;
|
||||||
++y_mod_count;
|
x_mod_count = 0;
|
||||||
x_mod_count = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::character_loading_finished()
|
void Courtroom::character_loading_finished()
|
||||||
{
|
{
|
||||||
// Zeroeth, we'll clear any leftover characters from previous server visits.
|
// Zeroeth, we'll clear any leftover characters from previous server visits.
|
||||||
ao_app->generated_chars = 0;
|
ao_app->generated_chars = 0;
|
||||||
if (ui_char_button_list.size() > 0)
|
if (ui_char_button_list.size() > 0) {
|
||||||
{
|
foreach (AOCharButton *item, ui_char_button_list) {
|
||||||
foreach (AOCharButton* item, ui_char_button_list) {
|
delete item;
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
ui_char_button_list.clear();
|
|
||||||
}
|
}
|
||||||
|
ui_char_button_list.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// First, we'll make all the character buttons in the very beginning.
|
// First, we'll make all the character buttons in the very beginning.
|
||||||
// We also hide them all, so they can't be accidentally clicked.
|
// Since we can't trust what will happen during the multi threading process,
|
||||||
// Later on, we'll be revealing buttons as we need them.
|
// we assign the buttons their locations in the list according to the
|
||||||
for (int n = 0; n < char_list.size(); n++)
|
// character list.
|
||||||
{
|
for (int n = 0; n < char_list.size(); n++) {
|
||||||
AOCharButton* characterButton = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
|
AOCharButton *characterButton =
|
||||||
AOCharSelectGenerationThreading *char_generate = new AOCharSelectGenerationThreading(this, n, characterButton);
|
new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
|
||||||
QThreadPool::globalInstance()->start(char_generate);
|
ui_char_button_list.append(characterButton);
|
||||||
if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount())
|
}
|
||||||
{
|
|
||||||
QThreadPool::globalInstance()->waitForDone();
|
// We also hide them all, so they can't be accidentally clicked.
|
||||||
}
|
// Later on, we'll be revealing buttons as we need them.
|
||||||
|
for (int n = 0; n < char_list.size(); n++) {
|
||||||
|
AOCharSelectGenerationThreading *char_generate =
|
||||||
|
new AOCharSelectGenerationThreading(this, n);
|
||||||
|
QThreadPool::globalInstance()->start(char_generate);
|
||||||
|
if (QThreadPool::globalInstance()->activeThreadCount() ==
|
||||||
|
QThreadPool::globalInstance()->maxThreadCount()) {
|
||||||
|
QThreadPool::globalInstance()->waitForDone();
|
||||||
}
|
}
|
||||||
QThreadPool::globalInstance()->waitForDone();
|
}
|
||||||
filter_character_list();
|
QThreadPool::globalInstance()->waitForDone();
|
||||||
|
filter_character_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::filter_character_list()
|
void Courtroom::filter_character_list()
|
||||||
{
|
{
|
||||||
ui_char_button_list_filtered.clear();
|
ui_char_button_list_filtered.clear();
|
||||||
for (int i = 0; i < char_list.size(); i++)
|
for (int i = 0; i < char_list.size(); i++) {
|
||||||
{
|
AOCharSelectFilter(this, i);
|
||||||
AOCharSelectFilterThreading *char_filter = new AOCharSelectFilterThreading(this, i);
|
}
|
||||||
QThreadPool::globalInstance()->start(char_filter);
|
|
||||||
if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount())
|
|
||||||
{
|
|
||||||
QThreadPool::globalInstance()->waitForDone();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QThreadPool::globalInstance()->waitForDone();
|
|
||||||
|
|
||||||
current_char_page = 0;
|
current_char_page = 0;
|
||||||
set_char_select_page();
|
set_char_select_page();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::on_char_search_changed()
|
void Courtroom::on_char_search_changed() { filter_character_list(); }
|
||||||
{
|
|
||||||
filter_character_list();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Courtroom::on_char_passworded_clicked()
|
void Courtroom::on_char_passworded_clicked() { filter_character_list(); }
|
||||||
{
|
|
||||||
filter_character_list();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Courtroom::on_char_taken_clicked()
|
void Courtroom::on_char_taken_clicked() { filter_character_list(); }
|
||||||
{
|
|
||||||
filter_character_list();
|
|
||||||
}
|
|
||||||
|
@ -5,58 +5,46 @@ chatlogpiece::chatlogpiece()
|
|||||||
name = "UNKNOWN";
|
name = "UNKNOWN";
|
||||||
showname = "UNKNOWN";
|
showname = "UNKNOWN";
|
||||||
message = "UNKNOWN";
|
message = "UNKNOWN";
|
||||||
|
color = 0;
|
||||||
is_song = false;
|
is_song = false;
|
||||||
datetime = QDateTime::currentDateTime().toUTC();
|
datetime = QDateTime::currentDateTime().toUTC();
|
||||||
}
|
}
|
||||||
|
|
||||||
chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song)
|
chatlogpiece::chatlogpiece(QString p_name, QString p_showname,
|
||||||
|
QString p_message, bool p_song, int p_color)
|
||||||
{
|
{
|
||||||
name = p_name;
|
name = p_name;
|
||||||
showname = p_showname;
|
showname = p_showname;
|
||||||
message = p_message;
|
message = p_message;
|
||||||
is_song = p_song;
|
is_song = p_song;
|
||||||
|
color = p_color;
|
||||||
datetime = QDateTime::currentDateTime().toUTC();
|
datetime = QDateTime::currentDateTime().toUTC();
|
||||||
}
|
}
|
||||||
|
|
||||||
chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime)
|
chatlogpiece::chatlogpiece(QString p_name, QString p_showname,
|
||||||
|
QString p_message, bool p_song, int p_color,
|
||||||
|
QDateTime p_datetime)
|
||||||
{
|
{
|
||||||
name = p_name;
|
name = p_name;
|
||||||
showname = p_showname;
|
showname = p_showname;
|
||||||
message = p_message;
|
message = p_message;
|
||||||
is_song = p_song;
|
is_song = p_song;
|
||||||
|
color = p_color;
|
||||||
datetime = p_datetime.toUTC();
|
datetime = p_datetime.toUTC();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString chatlogpiece::get_name()
|
QString chatlogpiece::get_name() { return name; }
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString chatlogpiece::get_showname()
|
QString chatlogpiece::get_showname() { return showname; }
|
||||||
{
|
|
||||||
return showname;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString chatlogpiece::get_message()
|
QString chatlogpiece::get_message() { return message; }
|
||||||
{
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDateTime chatlogpiece::get_datetime()
|
QDateTime chatlogpiece::get_datetime() { return datetime; }
|
||||||
{
|
|
||||||
return datetime;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool chatlogpiece::get_is_song()
|
bool chatlogpiece::get_is_song() { return is_song; }
|
||||||
{
|
|
||||||
return is_song;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString chatlogpiece::get_datetime_as_string()
|
|
||||||
{
|
|
||||||
return datetime.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); }
|
||||||
|
int chatlogpiece::get_chat_color() { return color; }
|
||||||
|
|
||||||
QString chatlogpiece::get_full()
|
QString chatlogpiece::get_full()
|
||||||
{
|
{
|
||||||
|
3589
src/courtroom.cpp
3589
src/courtroom.cpp
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
#include <QMessageBox>
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "debug_functions.h"
|
#include "debug_functions.h"
|
||||||
|
|
||||||
@ -7,11 +7,12 @@ void call_error(QString p_message)
|
|||||||
{
|
{
|
||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
||||||
msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1").arg(p_message));
|
msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1")
|
||||||
msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Error"));
|
.arg(p_message));
|
||||||
|
msgBox->setWindowTitle(
|
||||||
|
QCoreApplication::translate("debug_functions", "Error"));
|
||||||
|
|
||||||
|
// msgBox->setWindowModality(Qt::NonModal);
|
||||||
//msgBox->setWindowModality(Qt::NonModal);
|
|
||||||
msgBox->exec();
|
msgBox->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,9 +21,10 @@ void call_notice(QString p_message)
|
|||||||
QMessageBox *msgBox = new QMessageBox;
|
QMessageBox *msgBox = new QMessageBox;
|
||||||
|
|
||||||
msgBox->setText(p_message);
|
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();
|
msgBox->exec();
|
||||||
}
|
}
|
||||||
|
@ -8,23 +8,18 @@ Discord::Discord()
|
|||||||
DiscordEventHandlers handlers;
|
DiscordEventHandlers handlers;
|
||||||
std::memset(&handlers, 0, sizeof(handlers));
|
std::memset(&handlers, 0, sizeof(handlers));
|
||||||
handlers = {};
|
handlers = {};
|
||||||
handlers.ready = [] {
|
handlers.ready = [] { qInfo() << "Discord RPC ready"; };
|
||||||
qInfo() << "Discord RPC ready";
|
handlers.disconnected = [](int errorCode, const char *message) {
|
||||||
};
|
|
||||||
handlers.disconnected = [](int errorCode, const char* message) {
|
|
||||||
qInfo() << "Discord RPC disconnected! " << message << errorCode;
|
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;
|
qWarning() << "Discord RPC errored out! " << message << errorCode;
|
||||||
};
|
};
|
||||||
qInfo() << "Initializing Discord RPC";
|
qInfo() << "Initializing Discord RPC";
|
||||||
Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr);
|
Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
Discord::~Discord()
|
Discord::~Discord() { Discord_Shutdown(); }
|
||||||
{
|
|
||||||
Discord_Shutdown();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Discord::state_lobby()
|
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)
|
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();
|
auto name_friendly = QString(name.c_str()).replace('_', ' ').toStdString();
|
||||||
const std::string playing_as = "Playing as " + name_friendly;
|
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;
|
DiscordRichPresence presence;
|
||||||
std::memset(&presence, 0, sizeof(presence));
|
std::memset(&presence, 0, sizeof(presence));
|
||||||
@ -101,20 +98,11 @@ void Discord::state_spectate()
|
|||||||
Discord_UpdatePresence(&presence);
|
Discord_UpdatePresence(&presence);
|
||||||
}
|
}
|
||||||
#else
|
#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)
|
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()
|
void Discord::state_spectate()
|
||||||
{
|
{
|
||||||
qDebug() << "Discord RPC: Setting specator state";
|
qDebug() << "Discord RPC: Setting specator state";
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
} // namespace AttorneyOnline
|
||||||
|
@ -8,7 +8,8 @@ void Courtroom::construct_emotes()
|
|||||||
|
|
||||||
set_size_and_pos(ui_emotes, "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;
|
const int button_width = 40;
|
||||||
int x_spacing = f_spacing.x();
|
int x_spacing = f_spacing.x();
|
||||||
@ -18,13 +19,14 @@ void Courtroom::construct_emotes()
|
|||||||
int y_spacing = f_spacing.y();
|
int y_spacing = f_spacing.y();
|
||||||
int y_mod_count = 0;
|
int y_mod_count = 0;
|
||||||
|
|
||||||
emote_columns = ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1;
|
emote_columns =
|
||||||
emote_rows = ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1;
|
((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;
|
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 x_pos = (button_width + x_spacing) * x_mod_count;
|
||||||
int y_pos = (button_height + y_spacing) * y_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);
|
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;
|
++x_mod_count;
|
||||||
|
|
||||||
if (x_mod_count == emote_columns)
|
if (x_mod_count == emote_columns) {
|
||||||
{
|
|
||||||
++y_mod_count;
|
++y_mod_count;
|
||||||
x_mod_count = 0;
|
x_mod_count = 0;
|
||||||
}
|
}
|
||||||
@ -56,23 +58,20 @@ void Courtroom::set_emote_page()
|
|||||||
ui_emote_left->hide();
|
ui_emote_left->hide();
|
||||||
ui_emote_right->hide();
|
ui_emote_right->hide();
|
||||||
|
|
||||||
for (AOEmoteButton *i_button : ui_emote_list)
|
for (AOEmoteButton *i_button : ui_emote_list) {
|
||||||
{
|
|
||||||
i_button->hide();
|
i_button->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
int total_pages = total_emotes / max_emotes_on_page;
|
int total_pages = total_emotes / max_emotes_on_page;
|
||||||
int emotes_on_page = 0;
|
int emotes_on_page = 0;
|
||||||
|
|
||||||
if (total_emotes % max_emotes_on_page != 0)
|
if (total_emotes % max_emotes_on_page != 0) {
|
||||||
{
|
|
||||||
++total_pages;
|
++total_pages;
|
||||||
//i. e. not on the last page
|
// i. e. not on the last page
|
||||||
if (total_pages > current_emote_page + 1)
|
if (total_pages > current_emote_page + 1)
|
||||||
emotes_on_page = max_emotes_on_page;
|
emotes_on_page = max_emotes_on_page;
|
||||||
else
|
else
|
||||||
emotes_on_page = total_emotes % max_emotes_on_page;
|
emotes_on_page = total_emotes % max_emotes_on_page;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
emotes_on_page = max_emotes_on_page;
|
emotes_on_page = max_emotes_on_page;
|
||||||
@ -83,8 +82,7 @@ void Courtroom::set_emote_page()
|
|||||||
if (current_emote_page > 0)
|
if (current_emote_page > 0)
|
||||||
ui_emote_left->show();
|
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;
|
int n_real_emote = n_emote + current_emote_page * max_emotes_on_page;
|
||||||
AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
|
AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
|
||||||
|
|
||||||
@ -95,7 +93,6 @@ void Courtroom::set_emote_page()
|
|||||||
|
|
||||||
f_emote->show();
|
f_emote->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::set_emote_dropdown()
|
void Courtroom::set_emote_dropdown()
|
||||||
@ -105,8 +102,7 @@ void Courtroom::set_emote_dropdown()
|
|||||||
int total_emotes = ao_app->get_emote_number(current_char);
|
int total_emotes = ao_app->get_emote_number(current_char);
|
||||||
QStringList emote_list;
|
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));
|
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;
|
int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page;
|
||||||
|
|
||||||
if (current_emote >= min && current_emote <= max)
|
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;
|
int old_emote = current_emote;
|
||||||
|
|
||||||
current_emote = p_id;
|
current_emote = p_id;
|
||||||
|
|
||||||
if (current_emote >= min && current_emote <= max)
|
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);
|
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());
|
ui_pre->setChecked(!ui_pre->isChecked());
|
||||||
}
|
}
|
||||||
else if (emote_mod == 1)
|
else if (emote_mod == 1)
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
QString fanta_encrypt(QString temp_input, unsigned int p_key)
|
QString fanta_encrypt(QString temp_input, unsigned int p_key)
|
||||||
{
|
{
|
||||||
//using standard stdlib types is actually easier here because of implicit char<->int conversion
|
// using standard stdlib types is actually easier here because of implicit
|
||||||
//which in turn makes encryption arithmetic easier
|
// char<->int conversion which in turn makes encryption arithmetic easier
|
||||||
|
|
||||||
unsigned int key = p_key;
|
unsigned int key = p_key;
|
||||||
unsigned int C1 = 53761;
|
unsigned int C1 = 53761;
|
||||||
@ -14,8 +14,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key)
|
|||||||
QVector<uint_fast8_t> temp_result;
|
QVector<uint_fast8_t> temp_result;
|
||||||
std::string input = temp_input.toUtf8().constData();
|
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;
|
uint_fast8_t output = input.at(pos) ^ (key >> 8) % 256;
|
||||||
temp_result.append(output);
|
temp_result.append(output);
|
||||||
key = (temp_result.at(pos) + key) * C1 + C2;
|
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 = "";
|
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);
|
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;
|
QVector<unsigned int> unhexed_vector;
|
||||||
|
|
||||||
for(unsigned int i=0; i< input.length(); i+=2)
|
for (unsigned int i = 0; i < input.length(); i += 2) {
|
||||||
{
|
std::string byte = input.substr(i, 2);
|
||||||
std::string byte = input.substr(i,2);
|
|
||||||
unsigned int hex_int = strtoul(byte.c_str(), nullptr, 16);
|
unsigned int hex_int = strtoul(byte.c_str(), nullptr, 16);
|
||||||
unhexed_vector.append(hex_int);
|
unhexed_vector.append(hex_int);
|
||||||
}
|
}
|
||||||
@ -51,13 +48,11 @@ QString fanta_decrypt(QString temp_input, unsigned int key)
|
|||||||
|
|
||||||
std::string result = "";
|
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;
|
unsigned char output = unhexed_vector.at(pos) ^ (key >> 8) % 256;
|
||||||
result += output;
|
result += output;
|
||||||
key = (unhexed_vector.at(pos) + key) * C1 + C2;
|
key = (unhexed_vector.at(pos) + key) * C1 + C2;
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString::fromStdString(result);
|
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 = 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 = new AOLineEdit(ui_evidence);
|
||||||
ui_evidence_name->setAlignment(Qt::AlignCenter);
|
ui_evidence_name->setAlignment(Qt::AlignCenter);
|
||||||
ui_evidence_name->setFont(QFont("Arial", 14, QFont::Bold));
|
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, "evidence_background");
|
||||||
set_size_and_pos(ui_evidence_buttons, "evidence_buttons");
|
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;
|
const int button_width = 70;
|
||||||
int x_spacing = f_spacing.x();
|
int x_spacing = f_spacing.x();
|
||||||
@ -42,43 +43,57 @@ void Courtroom::construct_evidence()
|
|||||||
int y_spacing = f_spacing.y();
|
int y_spacing = f_spacing.y();
|
||||||
int y_mod_count = 0;
|
int y_mod_count = 0;
|
||||||
|
|
||||||
evidence_columns = ((ui_evidence_buttons->width() - button_width) / (x_spacing + button_width)) + 1;
|
evidence_columns = ((ui_evidence_buttons->width() - button_width) /
|
||||||
evidence_rows = ((ui_evidence_buttons->height() - button_height) / (y_spacing + button_height)) + 1;
|
(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;
|
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 x_pos = (button_width + x_spacing) * x_mod_count;
|
||||||
int y_pos = (button_height + y_spacing) * y_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);
|
ui_evidence_list.append(f_evidence);
|
||||||
|
|
||||||
f_evidence->set_id(n);
|
f_evidence->set_id(n);
|
||||||
|
|
||||||
connect(f_evidence, SIGNAL(evidence_clicked(int)), this, SLOT(on_evidence_clicked(int)));
|
connect(f_evidence, SIGNAL(evidence_clicked(int)), this,
|
||||||
connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this, SLOT(on_evidence_double_clicked(int)));
|
SLOT(on_evidence_clicked(int)));
|
||||||
connect(f_evidence, SIGNAL(on_hover(int, bool)), this, SLOT(on_evidence_hover(int, bool)));
|
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;
|
++x_mod_count;
|
||||||
|
|
||||||
if (x_mod_count == evidence_columns)
|
if (x_mod_count == evidence_columns) {
|
||||||
{
|
|
||||||
++y_mod_count;
|
++y_mod_count;
|
||||||
x_mod_count = 0;
|
x_mod_count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited()));
|
connect(ui_evidence_name, SIGNAL(returnPressed()), this,
|
||||||
connect(ui_evidence_left, SIGNAL(clicked()), this, SLOT(on_evidence_left_clicked()));
|
SLOT(on_evidence_name_edited()));
|
||||||
connect(ui_evidence_right, SIGNAL(clicked()), this, SLOT(on_evidence_right_clicked()));
|
connect(ui_evidence_left, SIGNAL(clicked()), this,
|
||||||
connect(ui_evidence_present, SIGNAL(clicked()), this, SLOT(on_evidence_present_clicked()));
|
SLOT(on_evidence_left_clicked()));
|
||||||
connect(ui_evidence_delete, SIGNAL(clicked()), this, SLOT(on_evidence_delete_clicked()));
|
connect(ui_evidence_right, SIGNAL(clicked()), this,
|
||||||
connect(ui_evidence_image_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_image_name_edited()));
|
SLOT(on_evidence_right_clicked()));
|
||||||
connect(ui_evidence_image_button, SIGNAL(clicked()), this, SLOT(on_evidence_image_button_clicked()));
|
connect(ui_evidence_present, SIGNAL(clicked()), this,
|
||||||
connect(ui_evidence_x, SIGNAL(clicked()), this, SLOT(on_evidence_x_clicked()));
|
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();
|
ui_evidence->hide();
|
||||||
}
|
}
|
||||||
@ -98,26 +113,23 @@ void Courtroom::set_evidence_page()
|
|||||||
ui_evidence_left->hide();
|
ui_evidence_left->hide();
|
||||||
ui_evidence_right->hide();
|
ui_evidence_right->hide();
|
||||||
|
|
||||||
for (AOEvidenceButton *i_button : ui_evidence_list)
|
for (AOEvidenceButton *i_button : ui_evidence_list) {
|
||||||
{
|
|
||||||
i_button->reset();
|
i_button->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
//to account for the "add evidence" button
|
// to account for the "add evidence" button
|
||||||
++total_evidence;
|
++total_evidence;
|
||||||
|
|
||||||
int total_pages = total_evidence / max_evidence_on_page;
|
int total_pages = total_evidence / max_evidence_on_page;
|
||||||
int evidence_on_page = 0;
|
int evidence_on_page = 0;
|
||||||
|
|
||||||
if ((total_evidence % max_evidence_on_page) != 0)
|
if ((total_evidence % max_evidence_on_page) != 0) {
|
||||||
{
|
|
||||||
++total_pages;
|
++total_pages;
|
||||||
//i. e. not on the last page
|
// i. e. not on the last page
|
||||||
if (total_pages > current_evidence_page + 1)
|
if (total_pages > current_evidence_page + 1)
|
||||||
evidence_on_page = max_evidence_on_page;
|
evidence_on_page = max_evidence_on_page;
|
||||||
else
|
else
|
||||||
evidence_on_page = total_evidence % max_evidence_on_page;
|
evidence_on_page = total_evidence % max_evidence_on_page;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
evidence_on_page = max_evidence_on_page;
|
evidence_on_page = max_evidence_on_page;
|
||||||
@ -128,17 +140,19 @@ void Courtroom::set_evidence_page()
|
|||||||
if (current_evidence_page > 0)
|
if (current_evidence_page > 0)
|
||||||
ui_evidence_left->show();
|
ui_evidence_left->show();
|
||||||
|
|
||||||
for (int n_evidence_button = 0 ; n_evidence_button < evidence_on_page ; ++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;
|
int n_real_evidence =
|
||||||
AOEvidenceButton *f_evidence_button = ui_evidence_list.at(n_evidence_button);
|
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))
|
if (n_real_evidence == (total_evidence - 1))
|
||||||
f_evidence_button->set_theme_image("addevidence.png");
|
f_evidence_button->set_theme_image("addevidence.png");
|
||||||
else if (n_real_evidence < (total_evidence - 1))
|
else if (n_real_evidence < (total_evidence - 1)) {
|
||||||
{
|
f_evidence_button->set_image(
|
||||||
f_evidence_button->set_image(local_evidence_list.at(n_real_evidence).image);
|
local_evidence_list.at(n_real_evidence).image);
|
||||||
|
|
||||||
if (n_real_evidence == current_evidence)
|
if (n_real_evidence == current_evidence)
|
||||||
f_evidence_button->set_selected(true);
|
f_evidence_button->set_selected(true);
|
||||||
@ -198,7 +212,7 @@ void Courtroom::on_evidence_image_button_clicked()
|
|||||||
QStringList filenames;
|
QStringList filenames;
|
||||||
|
|
||||||
if (dialog.exec())
|
if (dialog.exec())
|
||||||
filenames = dialog.selectedFiles();
|
filenames = dialog.selectedFiles();
|
||||||
|
|
||||||
if (filenames.size() != 1)
|
if (filenames.size() != 1)
|
||||||
return;
|
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;
|
int f_real_id = p_id + max_evidence_on_page * current_evidence_page;
|
||||||
|
|
||||||
if (f_real_id == local_evidence_list.size())
|
if (f_real_id == local_evidence_list.size()) {
|
||||||
{
|
ao_app->send_server_packet(
|
||||||
ao_app->send_server_packet(new AOPacket("PE#<name>#<description>#empty.png#%"));
|
new AOPacket("PE#<name>#<description>#empty.png#%"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (f_real_id > local_evidence_list.size())
|
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;
|
current_evidence = f_real_id;
|
||||||
|
|
||||||
ui_ic_chat_message->setFocus();
|
ui_ic_chat_message->setFocus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Courtroom::on_evidence_double_clicked(int p_id)
|
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);
|
ui_evidence_name->setReadOnly(true);
|
||||||
int final_id = p_id + max_evidence_on_page * current_evidence_page;
|
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())
|
if (final_id == local_evidence_list.size())
|
||||||
ui_evidence_name->setText(tr("Add new evidence..."));
|
ui_evidence_name->setText(tr("Add new evidence..."));
|
||||||
else if (final_id < local_evidence_list.size())
|
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_description->setReadOnly(true);
|
||||||
ui_evidence_overlay->hide();
|
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;
|
current_evidence = 0;
|
||||||
|
|
||||||
@ -338,4 +351,3 @@ void Courtroom::on_evidence_x_clicked()
|
|||||||
|
|
||||||
ui_ic_chat_message->setFocus();
|
ui_ic_chat_message->setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ bool dir_exists(QString dir_path)
|
|||||||
return check_dir.exists();
|
return check_dir.exists();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool exists(QString p_path) {
|
bool exists(QString p_path)
|
||||||
|
{
|
||||||
QFile file(p_path);
|
QFile file(p_path);
|
||||||
|
|
||||||
return file.exists();
|
return file.exists();
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#if (defined (_WIN32) || defined (_WIN64))
|
#if (defined(_WIN32) || defined(_WIN64))
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
static DWORD dwVolSerial;
|
static DWORD dwVolSerial;
|
||||||
@ -10,17 +10,18 @@ static BOOL bIsRetrieved;
|
|||||||
|
|
||||||
QString get_hdid()
|
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)
|
if (bIsRetrieved)
|
||||||
return QString::number(dwVolSerial, 16);
|
return QString::number(dwVolSerial, 16);
|
||||||
else
|
else
|
||||||
//a totally random string
|
// a totally random string
|
||||||
//what could possibly go wrong
|
// what could possibly go wrong
|
||||||
return "gxsps32sa9fnwic92mfbs0";
|
return "gxsps32sa9fnwic92mfbs0";
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif (defined (LINUX) || defined (__linux__))
|
#elif (defined(LINUX) || defined(__linux__))
|
||||||
|
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
@ -33,12 +34,10 @@ QString get_hdid()
|
|||||||
|
|
||||||
QTextStream in(&fstab_file);
|
QTextStream in(&fstab_file);
|
||||||
|
|
||||||
while(!in.atEnd())
|
while (!in.atEnd()) {
|
||||||
{
|
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
|
|
||||||
if (line.startsWith("UUID"))
|
if (line.startsWith("UUID")) {
|
||||||
{
|
|
||||||
QStringList line_elements = line.split("=");
|
QStringList line_elements = line.split("=");
|
||||||
|
|
||||||
if (line_elements.size() > 1)
|
if (line_elements.size() > 1)
|
||||||
@ -55,26 +54,25 @@ QString get_hdid()
|
|||||||
|
|
||||||
QString get_hdid()
|
QString get_hdid()
|
||||||
{
|
{
|
||||||
CFStringRef serial;
|
CFStringRef serial;
|
||||||
char buffer[64] = {0};
|
char buffer[64] = {0};
|
||||||
QString hdid;
|
QString hdid;
|
||||||
io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
|
io_service_t platformExpert = IOServiceGetMatchingService(
|
||||||
IOServiceMatching("IOPlatformExpertDevice"));
|
kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
|
||||||
if (platformExpert)
|
if (platformExpert) {
|
||||||
{
|
CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(
|
||||||
CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert,
|
platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault,
|
||||||
CFSTR(kIOPlatformSerialNumberKey),
|
0);
|
||||||
kCFAllocatorDefault, 0);
|
if (serialNumberAsCFString) {
|
||||||
if (serialNumberAsCFString) {
|
serial = (CFStringRef)serialNumberAsCFString;
|
||||||
serial = (CFStringRef)serialNumberAsCFString;
|
}
|
||||||
}
|
if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) {
|
||||||
if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) {
|
hdid = buffer;
|
||||||
hdid = buffer;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
IOObjectRelease(platformExpert);
|
IOObjectRelease(platformExpert);
|
||||||
}
|
}
|
||||||
return hdid;
|
return hdid;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
#include "hex_functions.h"
|
#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;
|
std::stringstream stream;
|
||||||
stream << std::setfill('0') << std::setw(sizeof(char)*2)
|
stream << std::setfill('0') << std::setw(sizeof(char) * 2) << std::hex
|
||||||
<< std::hex << input;
|
<< input;
|
||||||
std::string result(stream.str());
|
std::string result(stream.str());
|
||||||
std::transform(result.begin(), result.end(), result.begin(), ::toupper);
|
std::transform(result.begin(), result.end(), result.begin(), ::toupper);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace omni
|
||||||
|
190
src/lobby.cpp
190
src/lobby.cpp
@ -1,9 +1,9 @@
|
|||||||
#include "lobby.h"
|
#include "lobby.h"
|
||||||
|
|
||||||
#include "debug_functions.h"
|
|
||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
#include "networkmanager.h"
|
|
||||||
#include "aosfxplayer.h"
|
#include "aosfxplayer.h"
|
||||||
|
#include "debug_functions.h"
|
||||||
|
#include "networkmanager.h"
|
||||||
|
|
||||||
Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
|
Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
|
||||||
{
|
{
|
||||||
@ -37,18 +37,24 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
|
|||||||
ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }");
|
ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }");
|
||||||
ui_cancel = new AOButton(ui_loading_background, ao_app);
|
ui_cancel = new AOButton(ui_loading_background, ao_app);
|
||||||
|
|
||||||
connect(ui_public_servers, SIGNAL(clicked()), this, SLOT(on_public_servers_clicked()));
|
connect(ui_public_servers, SIGNAL(clicked()), this,
|
||||||
|
SLOT(on_public_servers_clicked()));
|
||||||
connect(ui_favorites, SIGNAL(clicked()), this, SLOT(on_favorites_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(pressed()), this, SLOT(on_refresh_pressed()));
|
||||||
connect(ui_refresh, SIGNAL(released()), this, SLOT(on_refresh_released()));
|
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(pressed()), this,
|
||||||
connect(ui_add_to_fav, SIGNAL(released()), this, SLOT(on_add_to_fav_released()));
|
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(pressed()), this, SLOT(on_connect_pressed()));
|
||||||
connect(ui_connect, SIGNAL(released()), this, SLOT(on_connect_released()));
|
connect(ui_connect, SIGNAL(released()), this, SLOT(on_connect_released()));
|
||||||
connect(ui_about, SIGNAL(clicked()), this, SLOT(on_about_clicked()));
|
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(clicked(QModelIndex)), this,
|
||||||
connect(ui_server_list, SIGNAL(activated(QModelIndex)), this, SLOT(on_server_list_doubleclicked(QModelIndex)));
|
SLOT(on_server_list_clicked(QModelIndex)));
|
||||||
connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed()));
|
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()));
|
connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
|
||||||
|
|
||||||
ui_connect->setEnabled(false);
|
ui_connect->setEnabled(false);
|
||||||
@ -58,7 +64,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
|
|||||||
set_widgets();
|
set_widgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
//sets images, position and size
|
// sets images, position and size
|
||||||
void Lobby::set_widgets()
|
void Lobby::set_widgets()
|
||||||
{
|
{
|
||||||
ao_app->reload_theme();
|
ao_app->reload_theme();
|
||||||
@ -67,19 +73,19 @@ void Lobby::set_widgets()
|
|||||||
|
|
||||||
pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename);
|
pos_size_type f_lobby = ao_app->get_element_dimensions("lobby", filename);
|
||||||
|
|
||||||
if (f_lobby.width < 0 || f_lobby.height < 0)
|
if (f_lobby.width < 0 || f_lobby.height < 0) {
|
||||||
{
|
qDebug() << "W: did not find lobby width or height in "
|
||||||
qDebug() << "W: did not find lobby width or height in " << ao_app->get_theme_path(filename);
|
<< ao_app->get_theme_path(filename);
|
||||||
|
|
||||||
// Most common symptom of bad config files and missing assets.
|
// 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"
|
call_notice(
|
||||||
"Did you download all resources correctly from tiny.cc/getao, "
|
tr("It doesn't look like your client is set up correctly.\n"
|
||||||
"including the large 'base' folder?"));
|
"Did you download all resources correctly from tiny.cc/getao, "
|
||||||
|
"including the large 'base' folder?"));
|
||||||
|
|
||||||
this->resize(517, 666);
|
this->resize(517, 666);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
this->resize(f_lobby.width, f_lobby.height);
|
this->resize(f_lobby.width, f_lobby.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +115,7 @@ void Lobby::set_widgets()
|
|||||||
|
|
||||||
set_size_and_pos(ui_server_list, "server_list");
|
set_size_and_pos(ui_server_list, "server_list");
|
||||||
ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
"font: bold;");
|
"font: bold;");
|
||||||
|
|
||||||
set_size_and_pos(ui_player_count, "player_count");
|
set_size_and_pos(ui_player_count, "player_count");
|
||||||
ui_player_count->setText(tr("Offline"));
|
ui_player_count->setText(tr("Offline"));
|
||||||
@ -124,20 +130,21 @@ void Lobby::set_widgets()
|
|||||||
|
|
||||||
set_size_and_pos(ui_chatbox, "chatbox");
|
set_size_and_pos(ui_chatbox, "chatbox");
|
||||||
ui_chatbox->setReadOnly(true);
|
ui_chatbox->setReadOnly(true);
|
||||||
ui_chatbox->setStyleSheet("QTextBrowser{background-color: rgba(0, 0, 0, 0);}");
|
ui_chatbox->setStyleSheet(
|
||||||
|
"QTextBrowser{background-color: rgba(0, 0, 0, 0);}");
|
||||||
|
|
||||||
set_size_and_pos(ui_chatname, "chatname");
|
set_size_and_pos(ui_chatname, "chatname");
|
||||||
ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
||||||
"selection-background-color: rgba(0, 0, 0, 0);");
|
"selection-background-color: rgba(0, 0, 0, 0);");
|
||||||
|
|
||||||
set_size_and_pos(ui_chatmessage, "chatmessage");
|
set_size_and_pos(ui_chatmessage, "chatmessage");
|
||||||
ui_chatmessage->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
|
ui_chatmessage->setStyleSheet(
|
||||||
"selection-background-color: rgba(0, 0, 0, 0);");
|
"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->resize(this->width(), this->height());
|
||||||
ui_loading_background->set_image("loadingbackground.png");
|
ui_loading_background->set_image("loadingbackground.png");
|
||||||
|
|
||||||
|
|
||||||
set_size_and_pos(ui_loading_text, "loading_label");
|
set_size_and_pos(ui_loading_text, "loading_label");
|
||||||
ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold));
|
ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold));
|
||||||
ui_loading_text->setReadOnly(true);
|
ui_loading_text->setReadOnly(true);
|
||||||
@ -152,31 +159,30 @@ void Lobby::set_widgets()
|
|||||||
ui_cancel->setText(tr("Cancel"));
|
ui_cancel->setText(tr("Cancel"));
|
||||||
|
|
||||||
ui_loading_background->hide();
|
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)
|
void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
|
||||||
{
|
{
|
||||||
QString filename = "lobby_design.ini";
|
QString filename = "lobby_design.ini";
|
||||||
|
|
||||||
pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename);
|
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)
|
if (design_ini_result.width < 0 || design_ini_result.height < 0) {
|
||||||
{
|
|
||||||
qDebug() << "W: could not find " << p_identifier << " in " << filename;
|
qDebug() << "W: could not find " << p_identifier << " in " << filename;
|
||||||
p_widget->hide();
|
p_widget->hide();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
p_widget->move(design_ini_result.x, design_ini_result.y);
|
p_widget->move(design_ini_result.x, design_ini_result.y);
|
||||||
p_widget->resize(design_ini_result.width, design_ini_result.height);
|
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)
|
void Lobby::set_loading_text(QString p_text)
|
||||||
{
|
{
|
||||||
ui_loading_text->clear();
|
ui_loading_text->clear();
|
||||||
@ -191,10 +197,7 @@ QString Lobby::get_chatlog()
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Lobby::get_selected_server()
|
int Lobby::get_selected_server() { return ui_server_list->currentRow(); }
|
||||||
{
|
|
||||||
return ui_server_list->currentRow();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Lobby::set_loading_value(int p_value)
|
void Lobby::set_loading_value(int p_value)
|
||||||
{
|
{
|
||||||
@ -217,7 +220,7 @@ void Lobby::on_favorites_clicked()
|
|||||||
ui_public_servers->set_image("publicservers.png");
|
ui_public_servers->set_image("publicservers.png");
|
||||||
|
|
||||||
ao_app->set_favorite_list();
|
ao_app->set_favorite_list();
|
||||||
//ao_app->favorite_list = read_serverlist_txt();
|
// ao_app->favorite_list = read_serverlist_txt();
|
||||||
|
|
||||||
list_favorites();
|
list_favorites();
|
||||||
|
|
||||||
@ -247,7 +250,7 @@ void Lobby::on_add_to_fav_released()
|
|||||||
{
|
{
|
||||||
ui_add_to_fav->set_image("addtofav.png");
|
ui_add_to_fav->set_image("addtofav.png");
|
||||||
|
|
||||||
//you cant add favorites from favorites m8
|
// you cant add favorites from favorites m8
|
||||||
if (!public_servers_selected)
|
if (!public_servers_selected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -272,78 +275,76 @@ void Lobby::on_connect_released()
|
|||||||
|
|
||||||
void Lobby::on_about_clicked()
|
void Lobby::on_about_clicked()
|
||||||
{
|
{
|
||||||
QString msg = tr("<h2>Attorney Online %1</h2>"
|
QString msg =
|
||||||
"The courtroom drama simulator"
|
tr("<h2>Attorney Online %1</h2>"
|
||||||
"<p><b>Source code:</b> "
|
"The courtroom drama simulator"
|
||||||
"<a href='https://github.com/AttorneyOnline/AO2-Client'>"
|
"<p><b>Source code:</b> "
|
||||||
"https://github.com/AttorneyOnline/AO2-Client</a>"
|
"<a href='https://github.com/AttorneyOnline/AO2-Client'>"
|
||||||
"<p><b>Major development:</b><br>"
|
"https://github.com/AttorneyOnline/AO2-Client</a>"
|
||||||
"OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter"
|
"<p><b>Major development:</b><br>"
|
||||||
"<p><b>Special thanks:</b><br>"
|
"OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, "
|
||||||
"Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), "
|
"Cents02"
|
||||||
"Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, "
|
"<p><b>Special thanks:</b><br>"
|
||||||
"Noevain, Cronnicossy")
|
"Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), "
|
||||||
|
"Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, "
|
||||||
|
"Noevain, Cronnicossy, Raidensnake")
|
||||||
.arg(ao_app->get_version_string());
|
.arg(ao_app->get_version_string());
|
||||||
QMessageBox::about(this, "About", msg);
|
QMessageBox::about(this, "About", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
//clicked on an item in the serverlist
|
// clicked on an item in the serverlist
|
||||||
void Lobby::on_server_list_clicked(QModelIndex p_model)
|
void Lobby::on_server_list_clicked(QModelIndex p_model)
|
||||||
{
|
{
|
||||||
if (p_model != last_model)
|
if (p_model != last_model) {
|
||||||
{
|
server_type f_server;
|
||||||
server_type f_server;
|
last_model = p_model;
|
||||||
last_model = p_model;
|
int n_server = p_model.row();
|
||||||
int n_server = p_model.row();
|
|
||||||
|
|
||||||
if (n_server < 0)
|
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;
|
return;
|
||||||
|
|
||||||
f_server = f_server_list.at(p_model.row());
|
if (public_servers_selected) {
|
||||||
}
|
QVector<server_type> f_server_list = ao_app->get_server_list();
|
||||||
else
|
|
||||||
{
|
|
||||||
if (n_server >= ao_app->get_favorite_list().size())
|
|
||||||
return;
|
|
||||||
|
|
||||||
f_server = ao_app->get_favorite_list().at(p_model.row());
|
if (n_server >= f_server_list.size())
|
||||||
}
|
return;
|
||||||
|
|
||||||
ui_description->clear();
|
f_server = f_server_list.at(p_model.row());
|
||||||
ui_description->append(f_server.desc);
|
}
|
||||||
|
else {
|
||||||
|
if (n_server >= ao_app->get_favorite_list().size())
|
||||||
|
return;
|
||||||
|
|
||||||
ui_description->moveCursor(QTextCursor::Start);
|
f_server = ao_app->get_favorite_list().at(p_model.row());
|
||||||
ui_description->ensureCursorVisible();
|
}
|
||||||
|
|
||||||
ui_player_count->setText(tr("Offline"));
|
ui_description->clear();
|
||||||
|
ui_description->append(f_server.desc);
|
||||||
|
|
||||||
ui_connect->setEnabled(false);
|
ui_description->moveCursor(QTextCursor::Start);
|
||||||
|
ui_description->ensureCursorVisible();
|
||||||
|
|
||||||
ao_app->net_manager->connect_to_server(f_server);
|
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
|
// doubleclicked on an item in the serverlist so we'll connect right away
|
||||||
void Lobby::on_server_list_doubleclicked(QModelIndex p_model)
|
void Lobby::on_server_list_doubleclicked(QModelIndex p_model)
|
||||||
{
|
{
|
||||||
on_server_list_clicked(p_model);
|
on_server_list_clicked(p_model);
|
||||||
on_connect_released();
|
on_connect_released();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::on_chatfield_return_pressed()
|
void Lobby::on_chatfield_return_pressed()
|
||||||
{
|
{
|
||||||
//no you can't send empty messages
|
// no you can't send empty messages
|
||||||
if (ui_chatname->text() == "" || ui_chatmessage->text() == "")
|
if (ui_chatname->text() == "" || ui_chatmessage->text() == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
QString f_header = "CT";
|
QString f_header = "CT";
|
||||||
QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()};
|
QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()};
|
||||||
|
|
||||||
@ -362,8 +363,7 @@ void Lobby::list_servers()
|
|||||||
|
|
||||||
ui_server_list->clear();
|
ui_server_list->clear();
|
||||||
|
|
||||||
for (server_type i_server : ao_app->get_server_list())
|
for (server_type i_server : ao_app->get_server_list()) {
|
||||||
{
|
|
||||||
ui_server_list->addItem(i_server.name);
|
ui_server_list->addItem(i_server.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -372,15 +372,17 @@ void Lobby::list_favorites()
|
|||||||
{
|
{
|
||||||
ui_server_list->clear();
|
ui_server_list->clear();
|
||||||
|
|
||||||
for (server_type i_server : ao_app->get_favorite_list())
|
for (server_type i_server : ao_app->get_favorite_list()) {
|
||||||
{
|
|
||||||
ui_server_list->addItem(i_server.name);
|
ui_server_list->addItem(i_server.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::append_chatmessage(QString f_name, QString f_message)
|
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());
|
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)
|
void Lobby::append_error(QString f_message)
|
||||||
@ -390,16 +392,12 @@ void Lobby::append_error(QString f_message)
|
|||||||
|
|
||||||
void Lobby::set_player_count(int players_online, int max_players)
|
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));
|
QString f_string = tr("Online: %1/%2")
|
||||||
|
.arg(QString::number(players_online))
|
||||||
|
.arg(QString::number(max_players));
|
||||||
ui_player_count->setText(f_string);
|
ui_player_count->setText(f_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Lobby::enable_connect_button()
|
void Lobby::enable_connect_button() { ui_connect->setEnabled(true); }
|
||||||
{
|
|
||||||
ui_connect->setEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Lobby::~Lobby()
|
Lobby::~Lobby() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
53
src/main.cpp
53
src/main.cpp
@ -1,43 +1,44 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include "datatypes.h"
|
|
||||||
#include "networkmanager.h"
|
|
||||||
#include "lobby.h"
|
|
||||||
#include "courtroom.h"
|
#include "courtroom.h"
|
||||||
#include <QPluginLoader>
|
#include "datatypes.h"
|
||||||
|
#include "lobby.h"
|
||||||
|
#include "networkmanager.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTranslator>
|
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
|
#include <QPluginLoader>
|
||||||
|
#include <QTranslator>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
|
#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
|
||||||
// High-DPI support is for Qt version >=5.6.
|
// High-DPI support is for Qt version >=5.6.
|
||||||
// However, many Linux distros still haven't brought their stable/LTS
|
// However, many Linux distros still haven't brought their stable/LTS
|
||||||
// packages up to Qt 5.6, so this is conditional.
|
// packages up to Qt 5.6, so this is conditional.
|
||||||
AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
#endif
|
#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();
|
QString p_language =
|
||||||
if (p_language == " " || p_language == "")
|
configini->value("language", QLocale::system().name()).toString();
|
||||||
p_language = QLocale::system().name();
|
if (p_language == " " || p_language == "")
|
||||||
|
p_language = QLocale::system().name();
|
||||||
|
|
||||||
QTranslator qtTranslator;
|
QTranslator qtTranslator;
|
||||||
qtTranslator.load("qt_" + p_language,
|
qtTranslator.load("qt_" + p_language,
|
||||||
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||||
main_app.installTranslator(&qtTranslator);
|
main_app.installTranslator(&qtTranslator);
|
||||||
|
|
||||||
QTranslator appTranslator;
|
QTranslator appTranslator;
|
||||||
qDebug() << ":/resource/translations/ao_" + p_language;
|
qDebug() << ":/resource/translations/ao_" + p_language;
|
||||||
appTranslator.load("ao_" + p_language, ":/resource/translations/");
|
appTranslator.load("ao_" + p_language, ":/resource/translations/");
|
||||||
main_app.installTranslator(&appTranslator);
|
main_app.installTranslator(&appTranslator);
|
||||||
|
|
||||||
main_app.construct_lobby();
|
main_app.construct_lobby();
|
||||||
main_app.w_lobby->show();
|
main_app.w_lobby->show();
|
||||||
main_app.net_manager->connect_to_master();
|
main_app.net_manager->connect_to_master();
|
||||||
return main_app.exec();
|
return main_app.exec();
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,6 @@ void delay(int p_milliseconds)
|
|||||||
{
|
{
|
||||||
QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds);
|
QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds);
|
||||||
|
|
||||||
while(QTime::currentTime() < dieTime)
|
while (QTime::currentTime() < dieTime)
|
||||||
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
|
||||||
}
|
}
|
||||||
|
@ -13,21 +13,23 @@ NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent)
|
|||||||
|
|
||||||
ms_reconnect_timer = new QTimer(this);
|
ms_reconnect_timer = new QTimer(this);
|
||||||
ms_reconnect_timer->setSingleShot(true);
|
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(ms_socket, SIGNAL(readyRead()), this,
|
||||||
QObject::connect(server_socket, SIGNAL(readyRead()), this, SLOT(handle_server_packet()));
|
SLOT(handle_ms_packet()));
|
||||||
QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, SLOT(server_disconnected()));
|
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 != "")
|
if (master_config != "")
|
||||||
ms_nosrv_hostname = master_config;
|
ms_nosrv_hostname = master_config;
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkManager::~NetworkManager()
|
NetworkManager::~NetworkManager() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void NetworkManager::connect_to_master()
|
void NetworkManager::connect_to_master()
|
||||||
{
|
{
|
||||||
@ -43,11 +45,11 @@ void NetworkManager::connect_to_master()
|
|||||||
|
|
||||||
void NetworkManager::connect_to_master_nosrv()
|
void NetworkManager::connect_to_master_nosrv()
|
||||||
{
|
{
|
||||||
QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
|
||||||
this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
|
SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
|
||||||
|
|
||||||
QObject::connect(ms_socket, SIGNAL(connected()),
|
QObject::connect(ms_socket, SIGNAL(connected()), this,
|
||||||
this, SLOT(on_ms_nosrv_connect_success()));
|
SLOT(on_ms_nosrv_connect_success()));
|
||||||
ms_socket->connectToHost(ms_nosrv_hostname, ms_port);
|
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)
|
void NetworkManager::ship_ms_packet(QString p_packet)
|
||||||
{
|
{
|
||||||
if (!ms_socket->isOpen())
|
if (!ms_socket->isOpen()) {
|
||||||
{
|
|
||||||
retry_ms_connect();
|
retry_ms_connect();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ms_socket->write(p_packet.toUtf8());
|
ms_socket->write(p_packet.toUtf8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -81,93 +81,86 @@ void NetworkManager::handle_ms_packet()
|
|||||||
QByteArray buffer = ms_socket->readAll();
|
QByteArray buffer = ms_socket->readAll();
|
||||||
QString in_data = QString::fromUtf8(buffer, buffer.size());
|
QString in_data = QString::fromUtf8(buffer, buffer.size());
|
||||||
|
|
||||||
if (!in_data.endsWith("%"))
|
if (!in_data.endsWith("%")) {
|
||||||
{
|
|
||||||
ms_partial_packet = true;
|
ms_partial_packet = true;
|
||||||
ms_temp_packet += in_data;
|
ms_temp_packet += in_data;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else {
|
||||||
{
|
if (ms_partial_packet) {
|
||||||
if (ms_partial_packet)
|
|
||||||
{
|
|
||||||
in_data = ms_temp_packet + in_data;
|
in_data = ms_temp_packet + in_data;
|
||||||
ms_temp_packet = "";
|
ms_temp_packet = "";
|
||||||
ms_partial_packet = false;
|
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);
|
AOPacket *f_packet = new AOPacket(packet);
|
||||||
|
|
||||||
ao_app->ms_packet_received(f_packet);
|
ao_app->ms_packet_received(f_packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NetworkManager::perform_srv_lookup()
|
void NetworkManager::perform_srv_lookup()
|
||||||
{
|
{
|
||||||
#ifdef MS_FAILOVER_SUPPORTED
|
#ifdef MS_FAILOVER_SUPPORTED
|
||||||
ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this);
|
ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this);
|
||||||
|
|
||||||
connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup()));
|
connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup()));
|
||||||
ms_dns->lookup();
|
ms_dns->lookup();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkManager::on_srv_lookup()
|
void NetworkManager::on_srv_lookup()
|
||||||
{
|
{
|
||||||
#ifdef MS_FAILOVER_SUPPORTED
|
#ifdef MS_FAILOVER_SUPPORTED
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
if (ms_dns->error() != QDnsLookup::NoError)
|
if (ms_dns->error() != QDnsLookup::NoError) {
|
||||||
{
|
|
||||||
qWarning("SRV lookup of the master server DNS failed.");
|
qWarning("SRV lookup of the master server DNS failed.");
|
||||||
ms_dns->deleteLater();
|
ms_dns->deleteLater();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
const auto srv_records = ms_dns->serviceRecords();
|
const auto srv_records = ms_dns->serviceRecords();
|
||||||
|
|
||||||
for (const QDnsServiceRecord &record : srv_records)
|
for (const QDnsServiceRecord &record : srv_records) {
|
||||||
{
|
#ifdef DEBUG_NETWORK
|
||||||
#ifdef DEBUG_NETWORK
|
|
||||||
qDebug() << "Connecting to " << record.target() << ":" << record.port();
|
qDebug() << "Connecting to " << record.target() << ":" << record.port();
|
||||||
#endif
|
#endif
|
||||||
ms_socket->connectToHost(record.target(), record.port());
|
ms_socket->connectToHost(record.target(), record.port());
|
||||||
QTime timer;
|
QTime timer;
|
||||||
timer.start();
|
timer.start();
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
ao_app->processEvents();
|
ao_app->processEvents();
|
||||||
if (ms_socket->state() == QAbstractSocket::ConnectedState)
|
if (ms_socket->state() == QAbstractSocket::ConnectedState) {
|
||||||
{
|
|
||||||
connected = true;
|
connected = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (ms_socket->state() != QAbstractSocket::ConnectingState
|
else if (ms_socket->state() != QAbstractSocket::ConnectingState &&
|
||||||
&& ms_socket->state() != QAbstractSocket::HostLookupState
|
ms_socket->state() != QAbstractSocket::HostLookupState &&
|
||||||
&& ms_socket->error() != -1)
|
ms_socket->error() != -1) {
|
||||||
{
|
|
||||||
qDebug() << ms_socket->error();
|
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->abort();
|
||||||
ms_socket->close();
|
ms_socket->close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (timer.elapsed() < timeout_milliseconds); // Very expensive spin-wait loop - it will bring CPU to 100%!
|
} while (timer.elapsed() <
|
||||||
if (connected)
|
timeout_milliseconds); // Very expensive spin-wait loop - it will
|
||||||
{
|
// bring CPU to 100%!
|
||||||
// Connect a one-shot signal in case the master server disconnects randomly
|
if (connected) {
|
||||||
QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
// Connect a one-shot signal in case the master server disconnects
|
||||||
this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
|
// randomly
|
||||||
|
QObject::connect(
|
||||||
|
ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
|
||||||
|
SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
ms_socket->abort();
|
ms_socket->abort();
|
||||||
ms_socket->close();
|
ms_socket->close();
|
||||||
}
|
}
|
||||||
@ -179,29 +172,30 @@ void NetworkManager::on_srv_lookup()
|
|||||||
connect_to_master_nosrv();
|
connect_to_master_nosrv();
|
||||||
else
|
else
|
||||||
emit ms_connect_finished(connected, false);
|
emit ms_connect_finished(connected, false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkManager::on_ms_nosrv_connect_success()
|
void NetworkManager::on_ms_nosrv_connect_success()
|
||||||
{
|
{
|
||||||
emit ms_connect_finished(true, false);
|
emit ms_connect_finished(true, false);
|
||||||
|
|
||||||
QObject::disconnect(ms_socket, SIGNAL(connected()),
|
QObject::disconnect(ms_socket, SIGNAL(connected()), this,
|
||||||
this, SLOT(on_ms_nosrv_connect_success()));
|
SLOT(on_ms_nosrv_connect_success()));
|
||||||
|
|
||||||
QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
|
||||||
this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
|
SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error)
|
void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error)
|
||||||
{
|
{
|
||||||
qWarning() << "Master server socket error:" << ms_socket->errorString()
|
qWarning() << "Master server socket error:" << ms_socket->errorString() << "("
|
||||||
<< "(" << error << ")";
|
<< error << ")";
|
||||||
|
|
||||||
// Disconnect the one-shot signal - this way, failover connect attempts
|
// Disconnect the one-shot signal - this way, failover connect attempts
|
||||||
// don't trigger a full retry
|
// don't trigger a full retry
|
||||||
QObject::disconnect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
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);
|
emit ms_connect_finished(false, true);
|
||||||
|
|
||||||
@ -210,7 +204,8 @@ void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error)
|
|||||||
|
|
||||||
void NetworkManager::retry_ms_connect()
|
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();
|
connect_to_master();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -219,27 +214,24 @@ void NetworkManager::handle_server_packet()
|
|||||||
QByteArray buffer = server_socket->readAll();
|
QByteArray buffer = server_socket->readAll();
|
||||||
QString in_data = QString::fromUtf8(buffer, buffer.size());
|
QString in_data = QString::fromUtf8(buffer, buffer.size());
|
||||||
|
|
||||||
if (!in_data.endsWith("%"))
|
if (!in_data.endsWith("%")) {
|
||||||
{
|
|
||||||
partial_packet = true;
|
partial_packet = true;
|
||||||
temp_packet += in_data;
|
temp_packet += in_data;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else {
|
||||||
{
|
if (partial_packet) {
|
||||||
if (partial_packet)
|
|
||||||
{
|
|
||||||
in_data = temp_packet + in_data;
|
in_data = temp_packet + in_data;
|
||||||
temp_packet = "";
|
temp_packet = "";
|
||||||
partial_packet = false;
|
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);
|
AOPacket *f_packet = new AOPacket(packet);
|
||||||
|
|
||||||
ao_app->server_packet_received(f_packet);
|
ao_app->server_packet_received(f_packet);
|
||||||
|
@ -1,40 +1,25 @@
|
|||||||
#include "aoapplication.h"
|
#include "aoapplication.h"
|
||||||
|
|
||||||
#include "lobby.h"
|
|
||||||
#include "courtroom.h"
|
#include "courtroom.h"
|
||||||
#include "networkmanager.h"
|
#include "debug_functions.h"
|
||||||
#include "encryption_functions.h"
|
#include "encryption_functions.h"
|
||||||
#include "hardware_functions.h"
|
#include "hardware_functions.h"
|
||||||
#include "debug_functions.h"
|
#include "lobby.h"
|
||||||
|
#include "networkmanager.h"
|
||||||
|
|
||||||
class AOPacketLoadMusicThreading : public QRunnable
|
void AOPacketLoadMusic(AOApplication *my_app, QString file_name, bool is_music)
|
||||||
{
|
{
|
||||||
public:
|
if (is_music) {
|
||||||
AOApplication *myapp;
|
my_app->w_courtroom->append_music(file_name);
|
||||||
QString filename;
|
}
|
||||||
bool ismusic;
|
else {
|
||||||
AOPacketLoadMusicThreading(AOApplication *my_app, QString file_name, bool is_music){
|
my_app->w_courtroom->append_area(file_name);
|
||||||
myapp = my_app;
|
my_app->area_count++;
|
||||||
filename = file_name;
|
}
|
||||||
ismusic = is_music;
|
for (int area_n = 0; area_n < my_app->area_count; area_n++) {
|
||||||
}
|
my_app->w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
|
||||||
void run()
|
}
|
||||||
{
|
}
|
||||||
if(ismusic)
|
|
||||||
{
|
|
||||||
myapp->w_courtroom->append_music(filename);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
myapp->w_courtroom->append_area(filename);
|
|
||||||
myapp->area_count++;
|
|
||||||
}
|
|
||||||
for (int area_n = 0; area_n < myapp->area_count; area_n++)
|
|
||||||
{
|
|
||||||
myapp->w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void AOApplication::ms_packet_received(AOPacket *p_packet)
|
void AOApplication::ms_packet_received(AOPacket *p_packet)
|
||||||
{
|
{
|
||||||
@ -48,17 +33,14 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
|
|||||||
qDebug() << "R(ms):" << p_packet->to_string();
|
qDebug() << "R(ms):" << p_packet->to_string();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (header == "ALL")
|
if (header == "ALL") {
|
||||||
{
|
|
||||||
server_list.clear();
|
server_list.clear();
|
||||||
|
|
||||||
for (QString i_string : p_packet->get_contents())
|
for (QString i_string : p_packet->get_contents()) {
|
||||||
{
|
|
||||||
server_type f_server;
|
server_type f_server;
|
||||||
QStringList sub_contents = i_string.split("&");
|
QStringList sub_contents = i_string.split("&");
|
||||||
|
|
||||||
if (sub_contents.size() < 4)
|
if (sub_contents.size() < 4) {
|
||||||
{
|
|
||||||
qDebug() << "W: malformed packet";
|
qDebug() << "W: malformed packet";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -71,39 +53,32 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
|
|||||||
server_list.append(f_server);
|
server_list.append(f_server);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lobby_constructed)
|
if (lobby_constructed) {
|
||||||
{
|
|
||||||
w_lobby->list_servers();
|
w_lobby->list_servers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (header == "CT")
|
else if (header == "CT") {
|
||||||
{
|
|
||||||
QString f_name, f_message;
|
QString f_name, f_message;
|
||||||
|
|
||||||
if (f_contents.size() == 1)
|
if (f_contents.size() == 1) {
|
||||||
{
|
|
||||||
f_name = "";
|
f_name = "";
|
||||||
f_message = f_contents.at(0);
|
f_message = f_contents.at(0);
|
||||||
}
|
}
|
||||||
else if (f_contents.size() >= 2)
|
else if (f_contents.size() >= 2) {
|
||||||
{
|
|
||||||
f_name = f_contents.at(0);
|
f_name = f_contents.at(0);
|
||||||
f_message = f_contents.at(1);
|
f_message = f_contents.at(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (lobby_constructed)
|
if (lobby_constructed) {
|
||||||
{
|
|
||||||
w_lobby->append_chatmessage(f_name, f_message);
|
w_lobby->append_chatmessage(f_name, f_message);
|
||||||
}
|
}
|
||||||
if (courtroom_constructed && courtroom_loaded)
|
if (courtroom_constructed && courtroom_loaded) {
|
||||||
{
|
|
||||||
w_courtroom->append_ms_chatmessage(f_name, f_message);
|
w_courtroom->append_ms_chatmessage(f_name, f_message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (header == "AO2CHECK")
|
else if (header == "AO2CHECK") {
|
||||||
{
|
|
||||||
send_ms_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
|
send_ms_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
|
||||||
send_ms_packet(new AOPacket("HI#" + get_hdid() + "#%"));
|
send_ms_packet(new AOPacket("HI#" + get_hdid() + "#%"));
|
||||||
|
|
||||||
@ -121,12 +96,10 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
|
|||||||
|
|
||||||
if (get_release() > f_release)
|
if (get_release() > f_release)
|
||||||
goto end;
|
goto end;
|
||||||
else if (get_release() == f_release)
|
else if (get_release() == f_release) {
|
||||||
{
|
|
||||||
if (get_major_version() > f_major)
|
if (get_major_version() > f_major)
|
||||||
goto end;
|
goto end;
|
||||||
else if (get_major_version() == f_major)
|
else if (get_major_version() == f_major) {
|
||||||
{
|
|
||||||
if (get_minor_version() >= f_minor)
|
if (get_minor_version() >= f_minor)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -134,31 +107,27 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
|
|||||||
|
|
||||||
call_notice(tr("Outdated version! Your version: %1\n"
|
call_notice(tr("Outdated version! Your version: %1\n"
|
||||||
"Please go to aceattorneyonline.com to update.")
|
"Please go to aceattorneyonline.com to update.")
|
||||||
.arg(get_version_string()));
|
.arg(get_version_string()));
|
||||||
destruct_courtroom();
|
destruct_courtroom();
|
||||||
destruct_lobby();
|
destruct_lobby();
|
||||||
}
|
}
|
||||||
else if (header == "DOOM")
|
else if (header == "DOOM") {
|
||||||
{
|
|
||||||
call_notice(tr("You have been exiled from AO.\n"
|
call_notice(tr("You have been exiled from AO.\n"
|
||||||
"Have a nice day."));
|
"Have a nice day."));
|
||||||
destruct_courtroom();
|
destruct_courtroom();
|
||||||
destruct_lobby();
|
destruct_lobby();
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
delete p_packet;
|
delete p_packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::is_music_track(QString trackname)
|
bool AOApplication::is_music_track(QString trackname)
|
||||||
{
|
{
|
||||||
return (trackname.startsWith("==") ||
|
return (trackname.startsWith("==") || trackname.endsWith(".wav") ||
|
||||||
trackname.endsWith(".wav") ||
|
trackname.endsWith(".mp3") || trackname.endsWith(".mp4") ||
|
||||||
trackname.endsWith(".mp3") ||
|
trackname.endsWith(".ogg") || trackname.endsWith(".opus"));
|
||||||
trackname.endsWith(".mp4") ||
|
|
||||||
trackname.endsWith(".ogg") ||
|
|
||||||
trackname.endsWith(".opus"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AOApplication::server_packet_received(AOPacket *p_packet)
|
void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||||
@ -174,15 +143,14 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
qDebug() << "R:" << f_packet;
|
qDebug() << "R:" << f_packet;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (header == "decryptor")
|
if (header == "decryptor") {
|
||||||
{
|
|
||||||
if (f_contents.size() == 0)
|
if (f_contents.size() == 0)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
//you may ask where 322 comes from. that would be a good question.
|
// you may ask where 322 comes from. that would be a good question.
|
||||||
s_decryptor = fanta_decrypt(f_contents.at(0), 322).toUInt();
|
s_decryptor = fanta_decrypt(f_contents.at(0), 322).toUInt();
|
||||||
|
|
||||||
//default(legacy) values
|
// default(legacy) values
|
||||||
encryption_needed = true;
|
encryption_needed = true;
|
||||||
yellow_text_enabled = false;
|
yellow_text_enabled = false;
|
||||||
prezoom_enabled = false;
|
prezoom_enabled = false;
|
||||||
@ -197,7 +165,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
modcall_reason_enabled = false;
|
modcall_reason_enabled = false;
|
||||||
looping_sfx_support_enabled = false;
|
looping_sfx_support_enabled = false;
|
||||||
|
|
||||||
//workaround for tsuserver4
|
// workaround for tsuserver4
|
||||||
if (f_contents.at(0) == "NOENCRYPT")
|
if (f_contents.at(0) == "NOENCRYPT")
|
||||||
encryption_needed = false;
|
encryption_needed = false;
|
||||||
|
|
||||||
@ -207,8 +175,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%");
|
AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%");
|
||||||
send_server_packet(hi_packet);
|
send_server_packet(hi_packet);
|
||||||
}
|
}
|
||||||
else if (header == "ID")
|
else if (header == "ID") {
|
||||||
{
|
|
||||||
if (f_contents.size() < 2)
|
if (f_contents.size() < 2)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
@ -219,57 +186,55 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
|
|
||||||
send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
|
send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
|
||||||
}
|
}
|
||||||
else if (header == "CT")
|
else if (header == "CT") {
|
||||||
{
|
|
||||||
if (f_contents.size() < 2)
|
if (f_contents.size() < 2)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (courtroom_constructed)
|
if (courtroom_constructed) {
|
||||||
{
|
|
||||||
if (f_contents.size() == 3)
|
if (f_contents.size() == 3)
|
||||||
w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1), f_contents.at(2));
|
w_courtroom->append_server_chatmessage(
|
||||||
|
f_contents.at(0), f_contents.at(1), f_contents.at(2));
|
||||||
else
|
else
|
||||||
w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1), "0");
|
w_courtroom->append_server_chatmessage(f_contents.at(0),
|
||||||
|
f_contents.at(1), "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (header == "FL")
|
else if (header == "FL") {
|
||||||
{
|
if (f_packet.contains("yellowtext", Qt::CaseInsensitive))
|
||||||
if (f_packet.contains("yellowtext",Qt::CaseInsensitive))
|
|
||||||
yellow_text_enabled = true;
|
yellow_text_enabled = true;
|
||||||
if (f_packet.contains("flipping",Qt::CaseInsensitive))
|
if (f_packet.contains("flipping", Qt::CaseInsensitive))
|
||||||
flipping_enabled = true;
|
flipping_enabled = true;
|
||||||
if (f_packet.contains("customobjections",Qt::CaseInsensitive))
|
if (f_packet.contains("customobjections", Qt::CaseInsensitive))
|
||||||
custom_objection_enabled = true;
|
custom_objection_enabled = true;
|
||||||
if (f_packet.contains("fastloading",Qt::CaseInsensitive))
|
if (f_packet.contains("fastloading", Qt::CaseInsensitive))
|
||||||
improved_loading_enabled = true;
|
improved_loading_enabled = true;
|
||||||
if (f_packet.contains("noencryption",Qt::CaseInsensitive))
|
if (f_packet.contains("noencryption", Qt::CaseInsensitive))
|
||||||
encryption_needed = false;
|
encryption_needed = false;
|
||||||
if (f_packet.contains("deskmod",Qt::CaseInsensitive))
|
if (f_packet.contains("deskmod", Qt::CaseInsensitive))
|
||||||
desk_mod_enabled = true;
|
desk_mod_enabled = true;
|
||||||
if (f_packet.contains("evidence",Qt::CaseInsensitive))
|
if (f_packet.contains("evidence", Qt::CaseInsensitive))
|
||||||
evidence_enabled = true;
|
evidence_enabled = true;
|
||||||
if (f_packet.contains("cccc_ic_support",Qt::CaseInsensitive))
|
if (f_packet.contains("cccc_ic_support", Qt::CaseInsensitive))
|
||||||
cccc_ic_support_enabled = true;
|
cccc_ic_support_enabled = true;
|
||||||
if (f_packet.contains("arup",Qt::CaseInsensitive))
|
if (f_packet.contains("arup", Qt::CaseInsensitive))
|
||||||
arup_enabled = true;
|
arup_enabled = true;
|
||||||
if (f_packet.contains("casing_alerts",Qt::CaseInsensitive))
|
if (f_packet.contains("casing_alerts", Qt::CaseInsensitive))
|
||||||
casing_alerts_enabled = true;
|
casing_alerts_enabled = true;
|
||||||
if (f_packet.contains("modcall_reason",Qt::CaseInsensitive))
|
if (f_packet.contains("modcall_reason", Qt::CaseInsensitive))
|
||||||
modcall_reason_enabled = true;
|
modcall_reason_enabled = true;
|
||||||
if (f_packet.contains("looping_sfx",Qt::CaseInsensitive))
|
if (f_packet.contains("looping_sfx", Qt::CaseInsensitive))
|
||||||
looping_sfx_support_enabled = true;
|
looping_sfx_support_enabled = true;
|
||||||
|
|
||||||
w_lobby->enable_connect_button();
|
w_lobby->enable_connect_button();
|
||||||
}
|
}
|
||||||
else if (header == "PN")
|
else if (header == "PN") {
|
||||||
{
|
|
||||||
if (f_contents.size() < 2)
|
if (f_contents.size() < 2)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
w_lobby->set_player_count(f_contents.at(0).toInt(), f_contents.at(1).toInt());
|
w_lobby->set_player_count(f_contents.at(0).toInt(),
|
||||||
|
f_contents.at(1).toInt());
|
||||||
}
|
}
|
||||||
else if (header == "SI")
|
else if (header == "SI") {
|
||||||
{
|
|
||||||
if (f_contents.size() != 3)
|
if (f_contents.size() != 3)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
@ -294,8 +259,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
int selected_server = w_lobby->get_selected_server();
|
int selected_server = w_lobby->get_selected_server();
|
||||||
|
|
||||||
QString server_address = "", server_name = "";
|
QString server_address = "", server_name = "";
|
||||||
if (w_lobby->public_servers_selected)
|
if (w_lobby->public_servers_selected) {
|
||||||
{
|
|
||||||
if (selected_server >= 0 && selected_server < server_list.size()) {
|
if (selected_server >= 0 && selected_server < server_list.size()) {
|
||||||
auto info = server_list.at(selected_server);
|
auto info = server_list.at(selected_server);
|
||||||
server_name = info.name;
|
server_name = info.name;
|
||||||
@ -303,8 +267,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
window_title += ": " + server_name;
|
window_title += ": " + server_name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
if (selected_server >= 0 && selected_server < favorite_list.size()) {
|
if (selected_server >= 0 && selected_server < favorite_list.size()) {
|
||||||
auto info = favorite_list.at(selected_server);
|
auto info = favorite_list.at(selected_server);
|
||||||
server_name = info.name;
|
server_name = info.name;
|
||||||
@ -321,7 +284,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
|
|
||||||
AOPacket *f_packet;
|
AOPacket *f_packet;
|
||||||
|
|
||||||
if(improved_loading_enabled)
|
if (improved_loading_enabled)
|
||||||
f_packet = new AOPacket("RC#%");
|
f_packet = new AOPacket("RC#%");
|
||||||
else
|
else
|
||||||
f_packet = new AOPacket("askchar2#%");
|
f_packet = new AOPacket("askchar2#%");
|
||||||
@ -331,19 +294,19 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256);
|
QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256);
|
||||||
hash.addData(server_address.toUtf8());
|
hash.addData(server_address.toUtf8());
|
||||||
if (is_discord_enabled())
|
if (is_discord_enabled())
|
||||||
discord->state_server(server_name.toStdString(), hash.result().toBase64().toStdString());
|
discord->state_server(server_name.toStdString(),
|
||||||
|
hash.result().toBase64().toStdString());
|
||||||
}
|
}
|
||||||
else if (header == "CI")
|
else if (header == "CI") {
|
||||||
{
|
|
||||||
if (!courtroom_constructed)
|
if (!courtroom_constructed)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
for (int n_element = 0 ; n_element < f_contents.size() ; n_element += 2)
|
for (int n_element = 0; n_element < f_contents.size(); n_element += 2) {
|
||||||
{
|
|
||||||
if (f_contents.at(n_element).toInt() != loaded_chars)
|
if (f_contents.at(n_element).toInt() != loaded_chars)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//this means we are on the last element and checking n + 1 element will be game over so
|
// this means we are on the last element and checking n + 1 element will
|
||||||
|
// be game over so
|
||||||
if (n_element == f_contents.size() - 1)
|
if (n_element == f_contents.size() - 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -355,37 +318,40 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
f_char.name = sub_elements.at(0);
|
f_char.name = sub_elements.at(0);
|
||||||
f_char.description = sub_elements.at(1);
|
f_char.description = sub_elements.at(1);
|
||||||
f_char.evidence_string = sub_elements.at(3);
|
f_char.evidence_string = sub_elements.at(3);
|
||||||
//temporary. the CharsCheck packet sets this properly
|
// temporary. the CharsCheck packet sets this properly
|
||||||
f_char.taken = false;
|
f_char.taken = false;
|
||||||
|
|
||||||
++loaded_chars;
|
++loaded_chars;
|
||||||
|
|
||||||
w_lobby->set_loading_text(tr("Loading chars:\n%1/%2").arg(QString::number(loaded_chars)).arg(QString::number(char_list_size)));
|
w_lobby->set_loading_text(tr("Loading chars:\n%1/%2")
|
||||||
|
.arg(QString::number(loaded_chars))
|
||||||
|
.arg(QString::number(char_list_size)));
|
||||||
|
|
||||||
w_courtroom->append_char(f_char);
|
w_courtroom->append_char(f_char);
|
||||||
|
|
||||||
int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
|
int total_loading_size =
|
||||||
int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
|
char_list_size * 2 + evidence_list_size + music_list_size;
|
||||||
|
int loading_value = int(
|
||||||
|
((loaded_chars + generated_chars + loaded_music + loaded_evidence) /
|
||||||
|
static_cast<double>(total_loading_size)) *
|
||||||
|
100);
|
||||||
w_lobby->set_loading_value(loading_value);
|
w_lobby->set_loading_value(loading_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (improved_loading_enabled)
|
if (improved_loading_enabled)
|
||||||
send_server_packet(new AOPacket("RE#%"));
|
send_server_packet(new AOPacket("RE#%"));
|
||||||
else
|
else {
|
||||||
{
|
QString next_packet_number =
|
||||||
QString next_packet_number = QString::number(((loaded_chars - 1) / 10) + 1);
|
QString::number(((loaded_chars - 1) / 10) + 1);
|
||||||
send_server_packet(new AOPacket("AN#" + next_packet_number + "#%"));
|
send_server_packet(new AOPacket("AN#" + next_packet_number + "#%"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (header == "EI")
|
else if (header == "EI") {
|
||||||
{
|
|
||||||
if (!courtroom_constructed)
|
if (!courtroom_constructed)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// +1 because evidence starts at 1 rather than 0 for whatever reason
|
// +1 because evidence starts at 1 rather than 0 for whatever reason
|
||||||
//enjoy fanta
|
// enjoy fanta
|
||||||
if (f_contents.at(0).toInt() != loaded_evidence + 1)
|
if (f_contents.at(0).toInt() != loaded_evidence + 1)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
@ -399,33 +365,36 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
evi_type f_evi;
|
evi_type f_evi;
|
||||||
f_evi.name = sub_elements.at(0);
|
f_evi.name = sub_elements.at(0);
|
||||||
f_evi.description = sub_elements.at(1);
|
f_evi.description = sub_elements.at(1);
|
||||||
//no idea what the number at position 2 is. probably an identifier?
|
// no idea what the number at position 2 is. probably an identifier?
|
||||||
f_evi.image = sub_elements.at(3);
|
f_evi.image = sub_elements.at(3);
|
||||||
|
|
||||||
++loaded_evidence;
|
++loaded_evidence;
|
||||||
|
|
||||||
w_lobby->set_loading_text(tr("Loading evidence:\n%1/%2").arg(QString::number(loaded_evidence)).arg(QString::number(evidence_list_size)));
|
w_lobby->set_loading_text(tr("Loading evidence:\n%1/%2")
|
||||||
|
.arg(QString::number(loaded_evidence))
|
||||||
|
.arg(QString::number(evidence_list_size)));
|
||||||
|
|
||||||
w_courtroom->append_evidence(f_evi);
|
w_courtroom->append_evidence(f_evi);
|
||||||
|
|
||||||
int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
|
int total_loading_size =
|
||||||
int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
|
char_list_size * 2 + evidence_list_size + music_list_size;
|
||||||
|
int loading_value =
|
||||||
|
int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) /
|
||||||
|
static_cast<double>(total_loading_size)) *
|
||||||
|
100);
|
||||||
w_lobby->set_loading_value(loading_value);
|
w_lobby->set_loading_value(loading_value);
|
||||||
|
|
||||||
QString next_packet_number = QString::number(loaded_evidence);
|
QString next_packet_number = QString::number(loaded_evidence);
|
||||||
send_server_packet(new AOPacket("AE#" + next_packet_number + "#%"));
|
send_server_packet(new AOPacket("AE#" + next_packet_number + "#%"));
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (header == "EM")
|
else if (header == "EM") {
|
||||||
{
|
|
||||||
if (!courtroom_constructed)
|
if (!courtroom_constructed)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
bool musiclist_start = false;
|
bool musiclist_start = false;
|
||||||
int areas = 0;
|
int areas = 0;
|
||||||
|
|
||||||
for (int n_element = 0 ; n_element < f_contents.size() ; n_element += 2)
|
for (int n_element = 0; n_element < f_contents.size(); n_element += 2) {
|
||||||
{
|
|
||||||
if (f_contents.at(n_element).toInt() != loaded_music)
|
if (f_contents.at(n_element).toInt() != loaded_music)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -436,48 +405,31 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
|
|
||||||
++loaded_music;
|
++loaded_music;
|
||||||
|
|
||||||
w_lobby->set_loading_text(tr("Loading music:\n%1/%2").arg(QString::number(loaded_music)).arg(QString::number(music_list_size)));
|
w_lobby->set_loading_text(tr("Loading music:\n%1/%2")
|
||||||
|
.arg(QString::number(loaded_music))
|
||||||
|
.arg(QString::number(music_list_size)));
|
||||||
|
|
||||||
if (musiclist_start)
|
for (int area_n = 0; area_n < areas; area_n++) {
|
||||||
{
|
w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
|
||||||
w_courtroom->append_music(f_music);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (is_music_track(f_music))
|
|
||||||
{
|
|
||||||
musiclist_start = true;
|
|
||||||
areas--;
|
|
||||||
//w_courtroom->fix_last_area();
|
|
||||||
w_courtroom->append_music(f_music);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
w_courtroom->append_area(f_music);
|
|
||||||
areas++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int area_n = 0; area_n < areas; area_n++)
|
int total_loading_size =
|
||||||
{
|
char_list_size * 2 + evidence_list_size + music_list_size;
|
||||||
w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
|
int loading_value = int(
|
||||||
}
|
((loaded_chars + generated_chars + loaded_music + loaded_evidence) /
|
||||||
|
static_cast<double>(total_loading_size)) *
|
||||||
int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
|
100);
|
||||||
int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
|
|
||||||
w_lobby->set_loading_value(loading_value);
|
w_lobby->set_loading_value(loading_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString next_packet_number = QString::number(((loaded_music - 1) / 10) + 1);
|
QString next_packet_number = QString::number(((loaded_music - 1) / 10) + 1);
|
||||||
send_server_packet(new AOPacket("AM#" + next_packet_number + "#%"));
|
send_server_packet(new AOPacket("AM#" + next_packet_number + "#%"));
|
||||||
}
|
}
|
||||||
else if (header == "CharsCheck")
|
else if (header == "CharsCheck") {
|
||||||
{
|
|
||||||
if (!courtroom_constructed)
|
if (!courtroom_constructed)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
for (int n_char = 0 ; n_char < f_contents.size() ; ++n_char)
|
for (int n_char = 0; n_char < f_contents.size(); ++n_char) {
|
||||||
{
|
|
||||||
if (f_contents.at(n_char) == "-1")
|
if (f_contents.at(n_char) == "-1")
|
||||||
w_courtroom->set_taken(n_char, true);
|
w_courtroom->set_taken(n_char, true);
|
||||||
else
|
else
|
||||||
@ -485,13 +437,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (header == "SC")
|
else if (header == "SC") {
|
||||||
{
|
|
||||||
if (!courtroom_constructed)
|
if (!courtroom_constructed)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
|
for (int n_element = 0; n_element < f_contents.size(); ++n_element) {
|
||||||
{
|
|
||||||
QStringList sub_elements = f_contents.at(n_element).split("&");
|
QStringList sub_elements = f_contents.at(n_element).split("&");
|
||||||
|
|
||||||
char_type f_char;
|
char_type f_char;
|
||||||
@ -499,58 +449,69 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
if (sub_elements.size() >= 2)
|
if (sub_elements.size() >= 2)
|
||||||
f_char.description = sub_elements.at(1);
|
f_char.description = sub_elements.at(1);
|
||||||
|
|
||||||
//temporary. the CharsCheck packet sets this properly
|
// temporary. the CharsCheck packet sets this properly
|
||||||
f_char.taken = false;
|
f_char.taken = false;
|
||||||
|
|
||||||
++loaded_chars;
|
++loaded_chars;
|
||||||
|
|
||||||
w_lobby->set_loading_text(tr("Loading chars:\n%1/%2").arg(QString::number(loaded_chars)).arg(QString::number(char_list_size)));
|
w_lobby->set_loading_text(tr("Loading chars:\n%1/%2")
|
||||||
|
.arg(QString::number(loaded_chars))
|
||||||
|
.arg(QString::number(char_list_size)));
|
||||||
|
|
||||||
w_courtroom->append_char(f_char);
|
w_courtroom->append_char(f_char);
|
||||||
|
|
||||||
int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
|
int total_loading_size =
|
||||||
int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
|
char_list_size * 2 + evidence_list_size + music_list_size;
|
||||||
|
int loading_value = int(
|
||||||
|
((loaded_chars + generated_chars + loaded_music + loaded_evidence) /
|
||||||
|
static_cast<double>(total_loading_size)) *
|
||||||
|
100);
|
||||||
w_lobby->set_loading_value(loading_value);
|
w_lobby->set_loading_value(loading_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_server_packet(new AOPacket("RM#%"));
|
send_server_packet(new AOPacket("RM#%"));
|
||||||
}
|
}
|
||||||
else if (header == "SM" || header == "FM")
|
|
||||||
{
|
|
||||||
if (!courtroom_constructed)
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
w_courtroom->clear_music();
|
else if (header == "SM") {
|
||||||
w_courtroom->clear_areas();
|
if (!courtroom_constructed)
|
||||||
|
goto end;
|
||||||
|
|
||||||
bool musiclist_start = false;
|
bool musics_time = false;
|
||||||
area_count = 0;
|
area_count = 0;
|
||||||
|
|
||||||
for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
|
for (int n_element = 0; n_element < f_contents.size(); ++n_element) {
|
||||||
{
|
int element2check = n_element + 1;
|
||||||
if (!musiclist_start && is_music_track(f_contents.at(n_element)))
|
if (element2check > f_contents.size()) {
|
||||||
{
|
element2check = n_element; // I know this is very lazy code but cba
|
||||||
musiclist_start = true;
|
}
|
||||||
continue;
|
if (!musics_time && (f_contents.at(n_element).startsWith("==") ||
|
||||||
}
|
f_contents.at(element2check).endsWith(".wav") ||
|
||||||
AOPacketLoadMusicThreading *music_load = new AOPacketLoadMusicThreading(this, f_contents.at(n_element), musiclist_start);
|
f_contents.at(element2check).endsWith(".mp3") ||
|
||||||
QThreadPool::globalInstance()->start(music_load);
|
f_contents.at(element2check).endsWith(".mp4") ||
|
||||||
++loaded_music;
|
f_contents.at(element2check).endsWith(".ogg") ||
|
||||||
int total_loading_size = char_list_size * 2 + evidence_list_size + music_list_size;
|
f_contents.at(element2check).endsWith(".opus"))) {
|
||||||
int loading_value = int(((loaded_chars + generated_chars + loaded_music + loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
|
musics_time = true;
|
||||||
w_lobby->set_loading_value(loading_value);
|
}
|
||||||
w_lobby->set_loading_text(tr("Loading music:\n%1/%2").arg(QString::number(loaded_music)).arg(QString::number(music_list_size)));
|
|
||||||
if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount())
|
// Not everything needs to have a thread.
|
||||||
{
|
AOPacketLoadMusic(this, f_contents.at(n_element), musics_time);
|
||||||
QThreadPool::globalInstance()->waitForDone(); //out of order music is bad
|
++loaded_music;
|
||||||
}
|
int total_loading_size =
|
||||||
}
|
char_list_size * 2 + evidence_list_size + music_list_size;
|
||||||
QThreadPool::globalInstance()->waitForDone();
|
int loading_value = int(
|
||||||
if (header == "SM")
|
((loaded_chars + generated_chars + loaded_music + loaded_evidence) /
|
||||||
send_server_packet(new AOPacket("RD#%"));
|
static_cast<double>(total_loading_size)) *
|
||||||
|
100);
|
||||||
|
w_lobby->set_loading_value(loading_value);
|
||||||
|
w_lobby->set_loading_text(tr("Loading music:\n%1/%2")
|
||||||
|
.arg(QString::number(loaded_music))
|
||||||
|
.arg(QString::number(music_list_size)));
|
||||||
|
}
|
||||||
|
|
||||||
|
send_server_packet(new AOPacket("RD#%"));
|
||||||
}
|
}
|
||||||
else if (header == "DONE")
|
else if (header == "DONE") {
|
||||||
{
|
|
||||||
if (!courtroom_constructed)
|
if (!courtroom_constructed)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
@ -564,84 +525,70 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
|
|
||||||
destruct_lobby();
|
destruct_lobby();
|
||||||
}
|
}
|
||||||
else if (header == "REFMUSIC")
|
else if (header == "REFMUSIC") {
|
||||||
{
|
if (courtroom_constructed)
|
||||||
if (courtroom_constructed)
|
w_courtroom->reset_music_list();
|
||||||
w_courtroom->reset_music_list();
|
for (int n_element = 0; n_element < f_contents.size(); ++n_element) {
|
||||||
for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
|
w_courtroom->append_music(f_contents.at(n_element));
|
||||||
{
|
}
|
||||||
w_courtroom->append_music(f_contents.at(n_element));
|
w_courtroom->list_music();
|
||||||
}
|
|
||||||
w_courtroom->list_music();
|
|
||||||
}
|
}
|
||||||
else if (header == "BN")
|
else if (header == "BN") {
|
||||||
{
|
|
||||||
if (f_contents.size() < 1)
|
if (f_contents.size() < 1)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (courtroom_constructed)
|
if (courtroom_constructed)
|
||||||
w_courtroom->set_background(f_contents.at(0));
|
w_courtroom->set_background(f_contents.at(0));
|
||||||
}
|
}
|
||||||
//server accepting char request(CC) packet
|
// server accepting char request(CC) packet
|
||||||
else if (header == "PV")
|
else if (header == "PV") {
|
||||||
{
|
|
||||||
if (f_contents.size() < 3)
|
if (f_contents.size() < 3)
|
||||||
goto end;
|
goto end;
|
||||||
if(f_contents.size() < 4){
|
if (f_contents.size() < 4) {
|
||||||
if (courtroom_constructed)
|
if (courtroom_constructed)
|
||||||
|
w_courtroom->enter_courtroom(f_contents.at(2).toInt());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (courtroom_constructed) {
|
||||||
|
if (f_contents.at(3) == "True") {
|
||||||
|
w_courtroom->set_character(f_contents.at(2).toInt());
|
||||||
|
}
|
||||||
|
else {
|
||||||
w_courtroom->enter_courtroom(f_contents.at(2).toInt());
|
w_courtroom->enter_courtroom(f_contents.at(2).toInt());
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (courtroom_constructed)
|
|
||||||
{
|
|
||||||
if(f_contents.at(3) == "True")
|
|
||||||
{
|
|
||||||
w_courtroom->set_character(f_contents.at(2).toInt());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
w_courtroom->enter_courtroom(f_contents.at(2).toInt());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (header == "MS")
|
|
||||||
{
|
|
||||||
if (courtroom_constructed && courtroom_loaded)
|
|
||||||
w_courtroom->handle_chatmessage(&p_packet->get_contents());
|
|
||||||
}
|
|
||||||
else if (header == "MC")
|
|
||||||
{
|
|
||||||
if (courtroom_constructed && courtroom_loaded)
|
|
||||||
w_courtroom->handle_song(&p_packet->get_contents());
|
|
||||||
}
|
|
||||||
else if (header == "RT")
|
|
||||||
{
|
|
||||||
if (f_contents.size() < 1)
|
|
||||||
goto end;
|
|
||||||
if (courtroom_constructed)
|
|
||||||
{
|
|
||||||
if (f_contents.size() == 1)
|
|
||||||
w_courtroom->handle_wtce(f_contents.at(0), 0);
|
|
||||||
else if (f_contents.size() == 2) {
|
|
||||||
w_courtroom->handle_wtce(f_contents.at(0), f_contents.at(1).toInt());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (header == "HP")
|
else if (header == "MS") {
|
||||||
{
|
if (courtroom_constructed && courtroom_loaded)
|
||||||
if (courtroom_constructed && f_contents.size() > 1)
|
w_courtroom->handle_chatmessage(&p_packet->get_contents());
|
||||||
w_courtroom->set_hp_bar(f_contents.at(0).toInt(), f_contents.at(1).toInt());
|
|
||||||
}
|
}
|
||||||
else if (header == "LE")
|
else if (header == "MC") {
|
||||||
{
|
if (courtroom_constructed && courtroom_loaded)
|
||||||
if (courtroom_constructed)
|
w_courtroom->handle_song(&p_packet->get_contents());
|
||||||
{
|
}
|
||||||
|
else if (header == "RT") {
|
||||||
|
if (f_contents.size() < 1)
|
||||||
|
goto end;
|
||||||
|
if (courtroom_constructed) {
|
||||||
|
if (f_contents.size() == 1)
|
||||||
|
w_courtroom->handle_wtce(f_contents.at(0), 0);
|
||||||
|
else if (f_contents.size() == 2) {
|
||||||
|
w_courtroom->handle_wtce(f_contents.at(0), f_contents.at(1).toInt());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (header == "HP") {
|
||||||
|
if (courtroom_constructed && f_contents.size() > 1)
|
||||||
|
w_courtroom->set_hp_bar(f_contents.at(0).toInt(),
|
||||||
|
f_contents.at(1).toInt());
|
||||||
|
}
|
||||||
|
else if (header == "LE") {
|
||||||
|
if (courtroom_constructed) {
|
||||||
QVector<evi_type> f_evi_list;
|
QVector<evi_type> f_evi_list;
|
||||||
|
|
||||||
for (QString f_string : f_contents)
|
for (QString f_string : f_contents) {
|
||||||
{
|
|
||||||
QStringList sub_contents = f_string.split("&");
|
QStringList sub_contents = f_string.split("&");
|
||||||
|
|
||||||
if (sub_contents.size() < 3)
|
if (sub_contents.size() < 3)
|
||||||
@ -658,72 +605,64 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
|||||||
w_courtroom->set_evidence_list(f_evi_list);
|
w_courtroom->set_evidence_list(f_evi_list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (header == "ARUP")
|
else if (header == "ARUP") {
|
||||||
{
|
if (courtroom_constructed) {
|
||||||
if (courtroom_constructed)
|
int arup_type = f_contents.at(0).toInt();
|
||||||
{
|
for (int n_element = 1; n_element < f_contents.size(); n_element++) {
|
||||||
int arup_type = f_contents.at(0).toInt();
|
w_courtroom->arup_modify(arup_type, n_element - 1,
|
||||||
for (int n_element = 1 ; n_element < f_contents.size() ; n_element++)
|
f_contents.at(n_element));
|
||||||
{
|
|
||||||
w_courtroom->arup_modify(arup_type, n_element - 1, f_contents.at(n_element));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (header == "FAILEDLOGIN")
|
else if (header == "FAILEDLOGIN") {
|
||||||
{
|
|
||||||
if (courtroom_constructed)
|
if (courtroom_constructed)
|
||||||
w_courtroom->handle_failed_login();
|
w_courtroom->handle_failed_login();
|
||||||
}
|
}
|
||||||
else if (header == "IL")
|
else if (header == "IL") {
|
||||||
{
|
|
||||||
if (courtroom_constructed && f_contents.size() > 0)
|
if (courtroom_constructed && f_contents.size() > 0)
|
||||||
w_courtroom->set_ip_list(f_contents.at(0));
|
w_courtroom->set_ip_list(f_contents.at(0));
|
||||||
}
|
}
|
||||||
else if (header == "MU")
|
else if (header == "MU") {
|
||||||
{
|
|
||||||
if (courtroom_constructed && f_contents.size() > 0)
|
if (courtroom_constructed && f_contents.size() > 0)
|
||||||
w_courtroom->set_mute(true, f_contents.at(0).toInt());
|
w_courtroom->set_mute(true, f_contents.at(0).toInt());
|
||||||
}
|
}
|
||||||
else if (header == "UM")
|
else if (header == "UM") {
|
||||||
{
|
|
||||||
if (courtroom_constructed && f_contents.size() > 0)
|
if (courtroom_constructed && f_contents.size() > 0)
|
||||||
w_courtroom->set_mute(false, f_contents.at(0).toInt());
|
w_courtroom->set_mute(false, f_contents.at(0).toInt());
|
||||||
}
|
}
|
||||||
else if (header == "KK")
|
else if (header == "KK") {
|
||||||
{
|
if (courtroom_constructed && f_contents.size() >= 1) {
|
||||||
if (courtroom_constructed && f_contents.size() >= 1)
|
call_notice(tr("You have been kicked from the server.\nReason: %1")
|
||||||
{
|
.arg(f_contents.at(0)));
|
||||||
call_notice(tr("You have been kicked from the server.\nReason: %1").arg(f_contents.at(0)));
|
|
||||||
construct_lobby();
|
construct_lobby();
|
||||||
destruct_courtroom();
|
destruct_courtroom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (header == "KB")
|
else if (header == "KB") {
|
||||||
{
|
if (courtroom_constructed && f_contents.size() >= 1) {
|
||||||
if (courtroom_constructed && f_contents.size() >= 1)
|
call_notice(tr("You have been banned from the server.\nReason: %1")
|
||||||
{
|
.arg(f_contents.at(0)));
|
||||||
call_notice(tr("You have been banned from the server.\nReason: %1").arg(f_contents.at(0)));
|
|
||||||
construct_lobby();
|
construct_lobby();
|
||||||
destruct_courtroom();
|
destruct_courtroom();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (header == "BD")
|
else if (header == "BD") {
|
||||||
{
|
call_notice(
|
||||||
call_notice(tr("You are banned on this server.\nReason: %1").arg(f_contents.at(0)));
|
tr("You are banned on this server.\nReason: %1").arg(f_contents.at(0)));
|
||||||
}
|
}
|
||||||
else if (header == "ZZ")
|
else if (header == "ZZ") {
|
||||||
{
|
|
||||||
if (courtroom_constructed && f_contents.size() > 0)
|
if (courtroom_constructed && f_contents.size() > 0)
|
||||||
w_courtroom->mod_called(f_contents.at(0));
|
w_courtroom->mod_called(f_contents.at(0));
|
||||||
}
|
}
|
||||||
else if (header == "CASEA")
|
else if (header == "CASEA") {
|
||||||
{
|
|
||||||
if (courtroom_constructed && f_contents.size() > 7)
|
if (courtroom_constructed && f_contents.size() > 7)
|
||||||
w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1", f_contents.at(6) == "1");
|
w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1",
|
||||||
|
f_contents.at(2) == "1", f_contents.at(3) == "1",
|
||||||
|
f_contents.at(4) == "1", f_contents.at(5) == "1",
|
||||||
|
f_contents.at(6) == "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
|
|
||||||
delete p_packet;
|
delete p_packet;
|
||||||
}
|
}
|
||||||
@ -750,8 +689,7 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded)
|
|||||||
|
|
||||||
QString f_packet = p_packet->to_string();
|
QString f_packet = p_packet->to_string();
|
||||||
|
|
||||||
if (encryption_needed)
|
if (encryption_needed) {
|
||||||
{
|
|
||||||
#ifdef DEBUG_NETWORK
|
#ifdef DEBUG_NETWORK
|
||||||
qDebug() << "S(e):" << f_packet;
|
qDebug() << "S(e):" << f_packet;
|
||||||
#endif
|
#endif
|
||||||
@ -759,8 +697,8 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded)
|
|||||||
p_packet->encrypt_header(s_decryptor);
|
p_packet->encrypt_header(s_decryptor);
|
||||||
f_packet = p_packet->to_string();
|
f_packet = p_packet->to_string();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
qDebug() << "S:" << f_packet;
|
||||||
#ifdef DEBUG_NETWORK
|
#ifdef DEBUG_NETWORK
|
||||||
qDebug() << "S:" << f_packet;
|
qDebug() << "S:" << f_packet;
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,18 +3,18 @@
|
|||||||
#include "file_functions.h"
|
#include "file_functions.h"
|
||||||
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QStandardPaths>
|
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#ifdef BASE_OVERRIDE
|
#ifdef BASE_OVERRIDE
|
||||||
#include "base_override.h"
|
#include "base_override.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//this is a quite broad generalization
|
// this is a quite broad generalization
|
||||||
//the most common OSes(mac and windows) are _usually_ case insensitive
|
// the most common OSes(mac and windows) are _usually_ case insensitive
|
||||||
//however, there do exist mac installations with case sensitive filesystems
|
// however, there do exist mac installations with case sensitive filesystems
|
||||||
//in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac
|
// in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac
|
||||||
#if (defined (LINUX) || defined (__linux__))
|
#if (defined(LINUX) || defined(__linux__))
|
||||||
#define CASE_SENSITIVE_FILESYSTEM
|
#define CASE_SENSITIVE_FILESYSTEM
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ QString AOApplication::get_base_path()
|
|||||||
QString base_path = "";
|
QString base_path = "";
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
QString sdcard_storage = getenv("SECONDARY_STORAGE");
|
QString sdcard_storage = getenv("SECONDARY_STORAGE");
|
||||||
if (dir_exists(sdcard_storage + "/AO2/")){
|
if (dir_exists(sdcard_storage + "/AO2/")) {
|
||||||
base_path = sdcard_storage + "/AO2/";
|
base_path = sdcard_storage + "/AO2/";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -39,10 +39,7 @@ QString AOApplication::get_base_path()
|
|||||||
return base_path;
|
return base_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_data_path()
|
QString AOApplication::get_data_path() { return get_base_path() + "data/"; }
|
||||||
{
|
|
||||||
return get_base_path() + "data/";
|
|
||||||
}
|
|
||||||
|
|
||||||
QString AOApplication::get_default_theme_path(QString p_file)
|
QString AOApplication::get_default_theme_path(QString p_file)
|
||||||
{
|
{
|
||||||
@ -104,39 +101,39 @@ QString AOApplication::get_music_path(QString p_song)
|
|||||||
return p_song;
|
return p_song;
|
||||||
}
|
}
|
||||||
else if (file_exists(opus_check))
|
else if (file_exists(opus_check))
|
||||||
{
|
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
return opus_check;
|
||||||
return opus_check;
|
#else
|
||||||
#else
|
return get_case_sensitive_path(opus_check);
|
||||||
return get_case_sensitive_path(opus_check);
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (file_exists(mp3_check))
|
else if (file_exists(mp3_check)) {
|
||||||
{
|
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
return mp3_check;
|
||||||
return mp3_check;
|
#else
|
||||||
#else
|
return get_case_sensitive_path(mp3_check);
|
||||||
return get_case_sensitive_path(mp3_check);
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (file_exists(withending_check))
|
else if (file_exists(withending_check)) {
|
||||||
{
|
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
return withending_check;
|
||||||
return withending_check;
|
#else
|
||||||
#else
|
return get_case_sensitive_path(withending_check);
|
||||||
return get_case_sensitive_path(withending_check);
|
#endif
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||||
return get_base_path() + "sounds/music/" + p_song + ".wav";
|
return get_base_path() + "sounds/music/" + p_song + ".wav";
|
||||||
|
;
|
||||||
#else
|
#else
|
||||||
return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".wav");
|
return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song +
|
||||||
|
".wav");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_background_path(QString p_file)
|
QString AOApplication::get_background_path(QString p_file)
|
||||||
{
|
{
|
||||||
QString path = get_base_path() + "background/" + w_courtroom->get_current_background() + "/" + p_file;
|
QString path = get_base_path() + "background/" +
|
||||||
|
w_courtroom->get_current_background() + "/" + p_file;
|
||||||
if (courtroom_constructed) {
|
if (courtroom_constructed) {
|
||||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||||
return path;
|
return path;
|
||||||
@ -167,21 +164,25 @@ QString AOApplication::get_evidence_path(QString p_file)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_case_sensitive_path(QString p_file) {
|
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;
|
// 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);
|
QFileInfo file(p_file);
|
||||||
|
|
||||||
QString file_basename = file.fileName();
|
QString file_basename = file.fileName();
|
||||||
QString file_parent_dir = get_case_sensitive_path(file.absolutePath());
|
QString file_parent_dir = get_case_sensitive_path(file.absolutePath());
|
||||||
|
|
||||||
//second, does it exist in the new parent dir?
|
// second, does it exist in the new parent dir?
|
||||||
if (exists(file_parent_dir + "/" + file_basename))
|
if (exists(file_parent_dir + "/" + file_basename))
|
||||||
return file_parent_dir + "/" + file_basename;
|
return file_parent_dir + "/" + file_basename;
|
||||||
|
|
||||||
//last resort, dirlist parent dir and find case insensitive match
|
// last resort, dirlist parent dir and find case insensitive match
|
||||||
QRegExp file_rx = QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString);
|
QRegExp file_rx =
|
||||||
|
QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString);
|
||||||
QStringList files = QDir(file_parent_dir).entryList();
|
QStringList files = QDir(file_parent_dir).entryList();
|
||||||
|
|
||||||
int result = files.indexOf(file_rx);
|
int result = files.indexOf(file_rx);
|
||||||
@ -189,6 +190,6 @@ QString AOApplication::get_case_sensitive_path(QString p_file) {
|
|||||||
if (result != -1)
|
if (result != -1)
|
||||||
return file_parent_dir + "/" + files.at(result);
|
return file_parent_dir + "/" + files.at(result);
|
||||||
|
|
||||||
//if nothing is found, let the caller handle the missing file
|
// if nothing is found, let the caller handle the missing file
|
||||||
return file_parent_dir + "/" + file_basename;
|
return file_parent_dir + "/" + file_basename;
|
||||||
}
|
}
|
||||||
|
@ -46,15 +46,31 @@ int AOApplication::get_max_log_size()
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AOApplication::get_slower_blips()
|
||||||
|
{
|
||||||
|
QString result =
|
||||||
|
configini->value("slower_blips", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AOApplication::get_pundelay()
|
||||||
|
{
|
||||||
|
QString result =
|
||||||
|
configini->value("punctuation_delay", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
|
}
|
||||||
|
|
||||||
bool AOApplication::get_log_goes_downwards()
|
bool AOApplication::get_log_goes_downwards()
|
||||||
{
|
{
|
||||||
QString result = configini->value("log_goes_downwards", "false").value<QString>();
|
QString result =
|
||||||
|
configini->value("log_goes_downwards", "false").value<QString>();
|
||||||
return result.startsWith("true");
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_showname_enabled_by_default()
|
bool AOApplication::get_showname_enabled_by_default()
|
||||||
{
|
{
|
||||||
QString result = configini->value("show_custom_shownames", "true").value<QString>();
|
QString result =
|
||||||
|
configini->value("show_custom_shownames", "true").value<QString>();
|
||||||
return result.startsWith("true");
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,14 +78,15 @@ QString AOApplication::get_default_username()
|
|||||||
{
|
{
|
||||||
QString result = configini->value("default_username", "").value<QString>();
|
QString result = configini->value("default_username", "").value<QString>();
|
||||||
if (result.isEmpty())
|
if (result.isEmpty())
|
||||||
return get_ooc_name();
|
return get_ooc_name();
|
||||||
else
|
else
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_audio_output_device()
|
QString AOApplication::get_audio_output_device()
|
||||||
{
|
{
|
||||||
QString result = configini->value("default_audio_device", "default").value<QString>();
|
QString result =
|
||||||
|
configini->value("default_audio_device", "default").value<QString>();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,8 +103,7 @@ QStringList AOApplication::get_call_words()
|
|||||||
|
|
||||||
QTextStream in(&callwords_ini);
|
QTextStream in(&callwords_ini);
|
||||||
|
|
||||||
while (!in.atEnd())
|
while (!in.atEnd()) {
|
||||||
{
|
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
return_value.append(line);
|
return_value.append(line);
|
||||||
}
|
}
|
||||||
@ -102,8 +118,7 @@ void AOApplication::write_to_serverlist_txt(QString p_line)
|
|||||||
|
|
||||||
serverlist_txt.setFileName(serverlist_txt_path);
|
serverlist_txt.setFileName(serverlist_txt_path);
|
||||||
|
|
||||||
if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append))
|
if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,21 +138,19 @@ QVector<server_type> AOApplication::read_serverlist_txt()
|
|||||||
|
|
||||||
serverlist_txt.setFileName(serverlist_txt_path);
|
serverlist_txt.setFileName(serverlist_txt_path);
|
||||||
|
|
||||||
if (!serverlist_txt.open(QIODevice::ReadOnly))
|
if (!serverlist_txt.open(QIODevice::ReadOnly)) {
|
||||||
{
|
|
||||||
return f_server_list;
|
return f_server_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream in(&serverlist_txt);
|
QTextStream in(&serverlist_txt);
|
||||||
|
|
||||||
while(!in.atEnd())
|
while (!in.atEnd()) {
|
||||||
{
|
|
||||||
QString line = in.readLine();
|
QString line = in.readLine();
|
||||||
server_type f_server;
|
server_type f_server;
|
||||||
QStringList line_contents = line.split(":");
|
QStringList line_contents = line.split(":");
|
||||||
|
|
||||||
if (line_contents.size() < 3)
|
if (line_contents.size() < 3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
f_server.ip = line_contents.at(0);
|
f_server.ip = line_contents.at(0);
|
||||||
f_server.port = line_contents.at(1).toInt();
|
f_server.port = line_contents.at(1).toInt();
|
||||||
@ -150,13 +163,35 @@ QVector<server_type> AOApplication::read_serverlist_txt()
|
|||||||
return f_server_list;
|
return f_server_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::read_design_ini(QString p_identifier, QString p_design_path)
|
QString AOApplication::read_design_ini(QString p_identifier,
|
||||||
|
QString p_design_path)
|
||||||
{
|
{
|
||||||
QSettings settings(p_design_path, QSettings::IniFormat);
|
QSettings settings(p_design_path, QSettings::IniFormat);
|
||||||
QVariant value = settings.value(p_identifier);
|
QVariant value = settings.value(p_identifier);
|
||||||
|
if (value.isNull()) // Since the value wasn't found, maybe it uses the proper
|
||||||
|
// config system
|
||||||
|
{
|
||||||
|
int last_underscore_index = p_identifier.lastIndexOf(
|
||||||
|
'_'); // we will use this in order to check wether it is just showname
|
||||||
|
// or showname_something
|
||||||
|
if (last_underscore_index != -1) {
|
||||||
|
p_identifier.replace(
|
||||||
|
last_underscore_index, 1,
|
||||||
|
'/'); // we replace the last dash in order to access the category, e.g
|
||||||
|
// from showname_font -> showname/font
|
||||||
|
value = settings.value(p_identifier);
|
||||||
|
}
|
||||||
|
else if (!settings.value(p_identifier + "/size")
|
||||||
|
.isNull()) // This is to check whether showname/size exists,
|
||||||
|
// because size is defined as widgetname = x
|
||||||
|
{
|
||||||
|
value = settings.value(p_identifier + "/size");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (value.type() == QVariant::StringList) {
|
if (value.type() == QVariant::StringList) {
|
||||||
return value.toStringList().join(",");
|
return value.toStringList().join(",");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,8 +207,7 @@ QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file)
|
|||||||
return_value.setX(0);
|
return_value.setX(0);
|
||||||
return_value.setY(0);
|
return_value.setY(0);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "") {
|
||||||
{
|
|
||||||
f_result = read_design_ini(p_identifier, default_path);
|
f_result = read_design_ini(p_identifier, default_path);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
@ -191,7 +225,8 @@ QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file)
|
|||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QString p_file)
|
pos_size_type AOApplication::get_element_dimensions(QString p_identifier,
|
||||||
|
QString p_file)
|
||||||
{
|
{
|
||||||
QString design_ini_path = get_theme_path(p_file);
|
QString design_ini_path = get_theme_path(p_file);
|
||||||
QString default_path = get_default_theme_path(p_file);
|
QString default_path = get_default_theme_path(p_file);
|
||||||
@ -204,8 +239,7 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QStrin
|
|||||||
return_value.width = -1;
|
return_value.width = -1;
|
||||||
return_value.height = -1;
|
return_value.height = -1;
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "") {
|
||||||
{
|
|
||||||
f_result = read_design_ini(p_identifier, default_path);
|
f_result = read_design_ini(p_identifier, default_path);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
@ -229,8 +263,7 @@ QString AOApplication::get_font_name(QString p_identifier, QString p_file)
|
|||||||
QString design_ini_path = get_theme_path(p_file);
|
QString design_ini_path = get_theme_path(p_file);
|
||||||
QString f_result = read_design_ini(p_identifier, design_ini_path);
|
QString f_result = read_design_ini(p_identifier, design_ini_path);
|
||||||
QString default_path = get_default_theme_path(p_file);
|
QString default_path = get_default_theme_path(p_file);
|
||||||
if (f_result == "")
|
if (f_result == "") {
|
||||||
{
|
|
||||||
f_result = read_design_ini(p_identifier, default_path);
|
f_result = read_design_ini(p_identifier, default_path);
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return "Sans";
|
return "Sans";
|
||||||
@ -243,8 +276,7 @@ int AOApplication::get_font_size(QString p_identifier, QString p_file)
|
|||||||
QString default_path = get_default_theme_path(p_file);
|
QString default_path = get_default_theme_path(p_file);
|
||||||
QString f_result = read_design_ini(p_identifier, design_ini_path);
|
QString f_result = read_design_ini(p_identifier, design_ini_path);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "") {
|
||||||
{
|
|
||||||
f_result = read_design_ini(p_identifier, default_path);
|
f_result = read_design_ini(p_identifier, default_path);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
@ -262,8 +294,7 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file)
|
|||||||
|
|
||||||
QColor return_color(0, 0, 0);
|
QColor return_color(0, 0, 0);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "") {
|
||||||
{
|
|
||||||
f_result = read_design_ini(p_identifier, default_path);
|
f_result = read_design_ini(p_identifier, default_path);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
@ -286,39 +317,37 @@ QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat)
|
|||||||
{
|
{
|
||||||
QColor return_color(255, 255, 255);
|
QColor return_color(255, 255, 255);
|
||||||
|
|
||||||
if (p_identifier == "_inline_grey")
|
if (p_identifier == "_inline_grey") {
|
||||||
{
|
|
||||||
return_color = QColor(187, 187, 187);
|
return_color = QColor(187, 187, 187);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
switch (p_identifier.toInt()) {
|
switch (p_identifier.toInt()) {
|
||||||
case 1:
|
case 1:
|
||||||
return_color = QColor(0, 255, 0);
|
return_color = QColor(0, 255, 0);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
return_color = QColor(255, 0, 0);
|
return_color = QColor(255, 0, 0);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
return_color = QColor(255, 165, 0);
|
return_color = QColor(255, 165, 0);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
return_color = QColor(45, 150, 255);
|
return_color = QColor(45, 150, 255);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
return_color = QColor(255, 255, 0);
|
return_color = QColor(255, 255, 0);
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
return_color = QColor(255, 192, 203);
|
return_color = QColor(255, 192, 203);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
return_color = QColor(0, 255, 255);
|
return_color = QColor(0, 255, 255);
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
case 6: // 6 is rainbow.
|
case 6: // 6 is rainbow.
|
||||||
default:
|
default:
|
||||||
return_color = QColor(255, 255, 255);
|
return_color = QColor(255, 255, 255);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,8 +356,7 @@ QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat)
|
|||||||
QString default_path = get_base_path() + "misc/default/config.ini";
|
QString default_path = get_base_path() + "misc/default/config.ini";
|
||||||
QString f_result = read_design_ini(p_identifier, design_ini_path);
|
QString f_result = read_design_ini(p_identifier, design_ini_path);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "") {
|
||||||
{
|
|
||||||
f_result = read_design_ini(p_identifier, default_path);
|
f_result = read_design_ini(p_identifier, default_path);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
@ -355,8 +383,7 @@ QString AOApplication::get_sfx(QString p_identifier)
|
|||||||
|
|
||||||
QString return_sfx = "";
|
QString return_sfx = "";
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "") {
|
||||||
{
|
|
||||||
f_result = read_design_ini(p_identifier, default_path);
|
f_result = read_design_ini(p_identifier, default_path);
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
@ -368,37 +395,61 @@ QString AOApplication::get_sfx(QString p_identifier)
|
|||||||
return return_sfx;
|
return return_sfx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AOApplication::get_music_prefix(QString song_to_check)
|
||||||
|
{
|
||||||
|
if (!file_exists(get_music_path(song_to_check))) {
|
||||||
|
QString mp3_check = get_music_path(song_to_check + ".mp3");
|
||||||
|
QString opus_check = get_music_path(song_to_check + ".opus");
|
||||||
|
if (file_exists(opus_check)) {
|
||||||
|
return song_to_check + ".opus";
|
||||||
|
}
|
||||||
|
else if (file_exists(mp3_check)) {
|
||||||
|
return song_to_check + ".mp3";
|
||||||
|
}
|
||||||
|
return song_to_check + ".wav";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return song_to_check;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString AOApplication::get_sfx_suffix(QString sound_to_check)
|
QString AOApplication::get_sfx_suffix(QString sound_to_check)
|
||||||
{
|
{
|
||||||
|
if (!file_exists(get_sounds_path(sound_to_check))) {
|
||||||
QString mp3_check = get_sounds_path(sound_to_check + ".mp3");
|
QString mp3_check = get_sounds_path(sound_to_check + ".mp3");
|
||||||
QString opus_check = get_sounds_path(sound_to_check + ".opus");
|
QString opus_check = get_sounds_path(sound_to_check + ".opus");
|
||||||
if (file_exists(opus_check))
|
if (file_exists(opus_check)) {
|
||||||
{
|
return sound_to_check + ".opus";
|
||||||
return sound_to_check + ".opus";
|
|
||||||
}
|
}
|
||||||
else if (file_exists(mp3_check))
|
else if (file_exists(mp3_check)) {
|
||||||
{
|
return sound_to_check + ".mp3";
|
||||||
return sound_to_check + ".mp3";
|
|
||||||
}
|
}
|
||||||
return sound_to_check + ".wav";
|
return sound_to_check + ".wav";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return sound_to_check;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_image_suffix(QString path_to_check)
|
QString AOApplication::get_image_suffix(QString path_to_check)
|
||||||
{
|
{
|
||||||
QString apng_check = path_to_check + ".apng";
|
if (file_exists(path_to_check + ".webp"))
|
||||||
if (file_exists(apng_check))
|
return path_to_check + ".webp";
|
||||||
{
|
if (file_exists(path_to_check + ".apng"))
|
||||||
return apng_check;
|
return path_to_check + ".apng";
|
||||||
}
|
if (file_exists(path_to_check + ".gif"))
|
||||||
return path_to_check + ".gif";
|
return path_to_check + ".gif";
|
||||||
|
return path_to_check + ".png";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns whatever is to the right of "search_line =" within target_tag and
|
||||||
//returns whatever is to the right of "search_line =" within target_tag and terminator_tag, trimmed
|
// terminator_tag, trimmed returns the empty string if the search line couldnt
|
||||||
//returns the empty string if the search line couldnt be found
|
// be found
|
||||||
QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QString target_tag)
|
QString AOApplication::read_char_ini(QString p_char, QString p_search_line,
|
||||||
|
QString target_tag)
|
||||||
{
|
{
|
||||||
QSettings settings(get_character_path(p_char, "char.ini"), QSettings::IniFormat);
|
QSettings settings(get_character_path(p_char, "char.ini"),
|
||||||
|
QSettings::IniFormat);
|
||||||
settings.beginGroup(target_tag);
|
settings.beginGroup(target_tag);
|
||||||
QString value = settings.value(p_search_line).toString();
|
QString value = settings.value(p_search_line).toString();
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
@ -411,7 +462,8 @@ QString AOApplication::get_char_name(QString p_char)
|
|||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return p_char;
|
return p_char;
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_showname(QString p_char)
|
QString AOApplication::get_showname(QString p_char)
|
||||||
@ -423,7 +475,8 @@ QString AOApplication::get_showname(QString p_char)
|
|||||||
return "";
|
return "";
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return p_char;
|
return p_char;
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_char_side(QString p_char)
|
QString AOApplication::get_char_side(QString p_char)
|
||||||
@ -432,7 +485,8 @@ QString AOApplication::get_char_side(QString p_char)
|
|||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return "wit";
|
return "wit";
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_gender(QString p_char)
|
QString AOApplication::get_gender(QString p_char)
|
||||||
@ -441,14 +495,16 @@ QString AOApplication::get_gender(QString p_char)
|
|||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return "male";
|
return "male";
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_chat(QString p_char)
|
QString AOApplication::get_chat(QString p_char)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, "chat", "Options");
|
QString f_result = read_char_ini(p_char, "chat", "Options");
|
||||||
|
|
||||||
//handling the correct order of chat is a bit complicated, we let the caller do it
|
// handling the correct order of chat is a bit complicated, we let the caller
|
||||||
|
// do it
|
||||||
return f_result;
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +513,8 @@ QString AOApplication::get_char_shouts(QString p_char)
|
|||||||
QString f_result = read_char_ini(p_char, "shouts", "Options");
|
QString f_result = read_char_ini(p_char, "shouts", "Options");
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return "default";
|
return "default";
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
|
int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
|
||||||
@ -466,7 +523,8 @@ int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
|
|||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return -1;
|
return -1;
|
||||||
else return f_result.toInt();
|
else
|
||||||
|
return f_result.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote)
|
int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote)
|
||||||
@ -475,7 +533,8 @@ int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote)
|
|||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return -1;
|
return -1;
|
||||||
else return f_result.toInt();
|
else
|
||||||
|
return f_result.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AOApplication::get_emote_number(QString p_char)
|
int AOApplication::get_emote_number(QString p_char)
|
||||||
@ -484,68 +543,75 @@ int AOApplication::get_emote_number(QString p_char)
|
|||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return 0;
|
return 0;
|
||||||
else return f_result.toInt();
|
else
|
||||||
|
return f_result.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_emote_comment(QString p_char, int p_emote)
|
QString AOApplication::get_emote_comment(QString p_char, int p_emote)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
QString f_result =
|
||||||
|
read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
||||||
|
|
||||||
QStringList result_contents = f_result.split("#");
|
QStringList result_contents = f_result.split("#");
|
||||||
|
|
||||||
if (result_contents.size() < 4)
|
if (result_contents.size() < 4) {
|
||||||
{
|
|
||||||
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
|
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
|
||||||
return "normal";
|
return "normal";
|
||||||
}
|
}
|
||||||
else return result_contents.at(0);
|
else
|
||||||
|
return result_contents.at(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_pre_emote(QString p_char, int p_emote)
|
QString AOApplication::get_pre_emote(QString p_char, int p_emote)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
QString f_result =
|
||||||
|
read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
||||||
|
|
||||||
QStringList result_contents = f_result.split("#");
|
QStringList result_contents = f_result.split("#");
|
||||||
|
|
||||||
if (result_contents.size() < 4)
|
if (result_contents.size() < 4) {
|
||||||
{
|
|
||||||
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
|
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
else return result_contents.at(1);
|
else
|
||||||
|
return result_contents.at(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_emote(QString p_char, int p_emote)
|
QString AOApplication::get_emote(QString p_char, int p_emote)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
QString f_result =
|
||||||
|
read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
||||||
|
|
||||||
QStringList result_contents = f_result.split("#");
|
QStringList result_contents = f_result.split("#");
|
||||||
|
|
||||||
if (result_contents.size() < 4)
|
if (result_contents.size() < 4) {
|
||||||
{
|
|
||||||
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
|
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
|
||||||
return "normal";
|
return "normal";
|
||||||
}
|
}
|
||||||
else return result_contents.at(2);
|
else
|
||||||
|
return result_contents.at(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AOApplication::get_emote_mod(QString p_char, int p_emote)
|
int AOApplication::get_emote_mod(QString p_char, int p_emote)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
QString f_result =
|
||||||
|
read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
||||||
|
|
||||||
QStringList result_contents = f_result.split("#");
|
QStringList result_contents = f_result.split("#");
|
||||||
|
|
||||||
if (result_contents.size() < 4)
|
if (result_contents.size() < 4) {
|
||||||
{
|
qDebug() << "W: misformatted char.ini: " << p_char << ", "
|
||||||
qDebug() << "W: misformatted char.ini: " << p_char << ", " << QString::number(p_emote);
|
<< QString::number(p_emote);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else return result_contents.at(3).toInt();
|
else
|
||||||
|
return result_contents.at(3).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AOApplication::get_desk_mod(QString p_char, int p_emote)
|
int AOApplication::get_desk_mod(QString p_char, int p_emote)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
QString f_result =
|
||||||
|
read_char_ini(p_char, QString::number(p_emote + 1), "Emotions");
|
||||||
|
|
||||||
QStringList result_contents = f_result.split("#");
|
QStringList result_contents = f_result.split("#");
|
||||||
|
|
||||||
@ -556,61 +622,74 @@ int AOApplication::get_desk_mod(QString p_char, int p_emote)
|
|||||||
if (string_result == "")
|
if (string_result == "")
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
else return string_result.toInt();
|
else
|
||||||
|
return string_result.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_sfx_name(QString p_char, int p_emote)
|
QString AOApplication::get_sfx_name(QString p_char, int p_emote)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundN");
|
QString f_result =
|
||||||
|
read_char_ini(p_char, QString::number(p_emote + 1), "SoundN");
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return "1";
|
return "1";
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_sfx_looping(QString p_char, int p_emote)
|
QString AOApplication::get_sfx_looping(QString p_char, int p_emote)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundL");
|
QString f_result =
|
||||||
|
read_char_ini(p_char, QString::number(p_emote + 1), "SoundL");
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return "0";
|
return "0";
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_frame_sfx_name(QString p_char, QString p_emote, int n_frame)
|
QString AOApplication::get_frame_sfx_name(QString p_char, QString p_emote,
|
||||||
|
int n_frame)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameSFX"));
|
QString f_result = read_char_ini(p_char, QString::number(n_frame),
|
||||||
|
p_emote.append("_FrameSFX"));
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return "";
|
return "";
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote, int n_frame)
|
QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote,
|
||||||
|
int n_frame)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameScreenshake"));
|
QString f_result = read_char_ini(p_char, QString::number(n_frame),
|
||||||
|
p_emote.append("_FrameScreenshake"));
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return "";
|
return "";
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString AOApplication::get_realization_frame(QString p_char, QString p_emote,
|
||||||
QString AOApplication::get_realization_frame(QString p_char, QString p_emote, int n_frame)
|
int n_frame)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameRealization"));
|
QString f_result = read_char_ini(p_char, QString::number(n_frame),
|
||||||
|
p_emote.append("_FrameRealization"));
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return "";
|
return "";
|
||||||
else return f_result;
|
else
|
||||||
|
return f_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int AOApplication::get_sfx_delay(QString p_char, int p_emote)
|
int AOApplication::get_sfx_delay(QString p_char, int p_emote)
|
||||||
{
|
{
|
||||||
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundT");
|
QString f_result =
|
||||||
|
read_char_ini(p_char, QString::number(p_emote + 1), "SoundT");
|
||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return 1;
|
return 1;
|
||||||
else return f_result.toInt();
|
else
|
||||||
|
return f_result.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
int AOApplication::get_text_delay(QString p_char, QString p_emote)
|
int AOApplication::get_text_delay(QString p_char, QString p_emote)
|
||||||
@ -619,7 +698,8 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote)
|
|||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return -1;
|
return -1;
|
||||||
else return f_result.toInt();
|
else
|
||||||
|
return f_result.toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_custom_realization(QString p_char)
|
QString AOApplication::get_custom_realization(QString p_char)
|
||||||
@ -628,90 +708,126 @@ QString AOApplication::get_custom_realization(QString p_char)
|
|||||||
|
|
||||||
if (f_result == "")
|
if (f_result == "")
|
||||||
return get_sfx("realization");
|
return get_sfx("realization");
|
||||||
else return f_result;
|
else
|
||||||
|
return get_sfx_suffix(f_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_blank_blip()
|
bool AOApplication::get_blank_blip()
|
||||||
{
|
{
|
||||||
QString result = configini->value("blank_blip", "false").value<QString>();
|
QString result = configini->value("blank_blip", "false").value<QString>();
|
||||||
return result.startsWith("true");
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_looping_sfx()
|
bool AOApplication::get_looping_sfx()
|
||||||
{
|
{
|
||||||
QString result = configini->value("looping_sfx", "true").value<QString>();
|
QString result = configini->value("looping_sfx", "true").value<QString>();
|
||||||
return result.startsWith("true");
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_objectmusic()
|
bool AOApplication::get_objectmusic()
|
||||||
{
|
{
|
||||||
QString result = configini->value("kill_music_on_object", "false").value<QString>();
|
QString result =
|
||||||
return result.startsWith("true");
|
configini->value("kill_music_on_object", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::is_discord_enabled()
|
bool AOApplication::is_discord_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("discord", "true").value<QString>();
|
QString result = configini->value("discord", "true").value<QString>();
|
||||||
return result.startsWith("true");
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::is_shakeandflash_enabled()
|
bool AOApplication::is_keepevi_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("shakeandflash", "true").value<QString>();
|
QString result = configini->value("keep_evidence", "false").value<QString>();
|
||||||
return result.startsWith("true");
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool AOApplication::get_casing_enabled()
|
bool AOApplication::get_casing_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("casing_enabled", "false").value<QString>();
|
QString result = configini->value("casing_enabled", "false").value<QString>();
|
||||||
return result.startsWith("true");
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_casing_defence_enabled()
|
bool AOApplication::get_casing_defence_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("casing_defence_enabled", "false").value<QString>();
|
QString result =
|
||||||
return result.startsWith("true");
|
configini->value("casing_defence_enabled", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_casing_prosecution_enabled()
|
bool AOApplication::get_casing_prosecution_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("casing_prosecution_enabled", "false").value<QString>();
|
QString result =
|
||||||
return result.startsWith("true");
|
configini->value("casing_prosecution_enabled", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_casing_judge_enabled()
|
bool AOApplication::get_casing_judge_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("casing_judge_enabled", "false").value<QString>();
|
QString result =
|
||||||
return result.startsWith("true");
|
configini->value("casing_judge_enabled", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_casing_juror_enabled()
|
bool AOApplication::get_casing_juror_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("casing_juror_enabled", "false").value<QString>();
|
QString result =
|
||||||
return result.startsWith("true");
|
configini->value("casing_juror_enabled", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_casing_steno_enabled()
|
bool AOApplication::get_casing_steno_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("casing_steno_enabled", "false").value<QString>();
|
QString result =
|
||||||
|
configini->value("casing_steno_enabled", "false").value<QString>();
|
||||||
return result.startsWith("true");
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_casing_wit_enabled()
|
bool AOApplication::get_casing_wit_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("casing_wit_enabled", "false").value<QString>();
|
QString result =
|
||||||
|
configini->value("casing_wit_enabled", "false").value<QString>();
|
||||||
return result.startsWith("true");
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AOApplication::get_casing_cm_enabled()
|
bool AOApplication::get_casing_cm_enabled()
|
||||||
{
|
{
|
||||||
QString result = configini->value("casing_cm_enabled", "false").value<QString>();
|
QString result =
|
||||||
return result.startsWith("true");
|
configini->value("casing_cm_enabled", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AOApplication::get_casing_can_host_cases()
|
QString AOApplication::get_casing_can_host_cases()
|
||||||
{
|
{
|
||||||
QString result = configini->value("casing_can_host_cases", "Turnabout Check Your Settings").value<QString>();
|
QString result =
|
||||||
|
configini->value("casing_can_host_cases", "Turnabout Check Your Settings")
|
||||||
|
.value<QString>();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool AOApplication::get_colored_iclog_enabled()
|
||||||
|
{
|
||||||
|
QString result =
|
||||||
|
configini->value("color_iclog_enabled", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AOApplication::get_iclmir_enabled()
|
||||||
|
{
|
||||||
|
QString result =
|
||||||
|
configini->value("mirror_iclog_enabled", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
|
}
|
||||||
|
bool AOApplication::colorlog_restricted_enabled()
|
||||||
|
{
|
||||||
|
QString result =
|
||||||
|
configini->value("mirror_iclog_restricted", "false").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AOApplication::is_shakeandflash_enabled()
|
||||||
|
{
|
||||||
|
QString result = configini->value("shakeandflash", "true").value<QString>();
|
||||||
|
return result.startsWith("true");
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user