aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-format2
-rw-r--r--include/aoapplication.h103
-rw-r--r--include/aoblipplayer.h12
-rw-r--r--include/aobutton.h5
-rw-r--r--include/aocaseannouncerdialog.h13
-rw-r--r--include/aocharbutton.h8
-rw-r--r--include/aocharmovie.h14
-rw-r--r--include/aoemotebutton.h13
-rw-r--r--include/aoevidencebutton.h10
-rw-r--r--include/aoevidencedisplay.h7
-rw-r--r--include/aoimage.h7
-rw-r--r--include/aolineedit.h5
-rw-r--r--include/aomovie.h3
-rw-r--r--include/aomusicplayer.h11
-rw-r--r--include/aooptionsdialog.h148
-rw-r--r--include/aopacket.h9
-rw-r--r--include/aoscene.h6
-rw-r--r--include/aosfxplayer.h11
-rw-r--r--include/aotextarea.h12
-rw-r--r--include/aotextedit.h4
-rw-r--r--include/bass.h1732
-rw-r--r--include/chatlogpiece.h11
-rw-r--r--include/courtroom.h245
-rw-r--r--include/datatypes.h40
-rw-r--r--include/debug_functions.h2
-rw-r--r--include/discord-rpc.h64
-rw-r--r--include/discord_register.h26
-rw-r--r--include/discord_rich_presence.h12
-rw-r--r--include/discord_rpc.h66
-rw-r--r--include/encryption_functions.h6
-rw-r--r--include/file_functions.h2
-rw-r--r--include/hex_functions.h13
-rw-r--r--include/lobby.h15
-rw-r--r--include/misc_functions.h2
-rw-r--r--include/networkmanager.h11
-rw-r--r--include/text_file_functions.h8
-rw-r--r--src/aoapplication.cpp77
-rw-r--r--src/aoblipplayer.cpp33
-rw-r--r--src/aobutton.cpp9
-rw-r--r--src/aocaseannouncerdialog.cpp39
-rw-r--r--src/aocharbutton.cpp31
-rw-r--r--src/aocharmovie.cpp60
-rw-r--r--src/aoemotebutton.cpp18
-rw-r--r--src/aoevidencebutton.cpp19
-rw-r--r--src/aoevidencedisplay.cpp37
-rw-r--r--src/aoimage.cpp11
-rw-r--r--src/aolineedit.cpp5
-rw-r--r--src/aomovie.cpp29
-rw-r--r--src/aomusicplayer.cpp29
-rw-r--r--src/aooptionsdialog.cpp801
-rw-r--r--src/aopacket.cpp29
-rw-r--r--src/aoscene.cpp28
-rw-r--r--src/aosfxplayer.cpp47
-rw-r--r--src/aotextarea.cpp49
-rw-r--r--src/aotextedit.cpp8
-rw-r--r--src/charselect.cpp237
-rw-r--r--src/chatlogpiece.cpp37
-rw-r--r--src/courtroom.cpp2157
-rw-r--r--src/debug_functions.cpp6
-rw-r--r--src/discord_rich_presence.cpp37
-rw-r--r--src/emotes.cpp43
-rw-r--r--src/encryption_functions.cpp19
-rw-r--r--src/evidence.cpp100
-rw-r--r--src/file_functions.cpp3
-rw-r--r--src/hardware_functions.cpp19
-rw-r--r--src/hex_functions.cpp23
-rw-r--r--src/lobby.cpp112
-rw-r--r--src/main.cpp24
-rw-r--r--src/misc_functions.cpp2
-rw-r--r--src/networkmanager.cpp138
-rw-r--r--src/packet_distribution.cpp425
-rw-r--r--src/path_functions.cpp40
-rw-r--r--src/text_file_functions.cpp292
73 files changed, 3788 insertions, 3943 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..a0505826
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,2 @@
+BasedOnStyle: LLVM
+BreakBeforeBraces: Stroustrup
diff --git a/include/aoapplication.h b/include/aoapplication.h
index 67f9a0d5..ef1a1686 100644
--- a/include/aoapplication.h
+++ b/include/aoapplication.h
@@ -6,30 +6,29 @@
#include "discord_rich_presence.h"
#include <QApplication>
-#include <QVector>
#include <QFile>
#include <QSettings>
+#include <QVector>
#include <QDebug>
-#include <QRect>
#include <QDesktopWidget>
+#include <QRect>
#include <QCryptographicHash>
#include <QDir>
#include <QStandardPaths>
-#include <QTextStream>
-#include <QStringList>
#include <QColor>
#include <QScreen>
+#include <QStringList>
+#include <QTextStream>
class NetworkManager;
class Lobby;
class Courtroom;
-class AOApplication : public QApplication
-{
+class AOApplication : public QApplication {
Q_OBJECT
public:
@@ -78,7 +77,7 @@ public:
///////////////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;
QString server_software = "";
@@ -103,19 +102,19 @@ public:
///////////////////////////////////////////
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 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();
- //Returns the character the player has currently selected
+ // Returns the character the player has currently selected
QString get_current_char();
- //implementation in path_functions.cpp
+ // implementation in path_functions.cpp
QString get_base_path();
QString get_data_path();
QString get_theme_path(QString p_file);
@@ -135,25 +134,26 @@ public:
// Instead of reinventing the wheel, we'll use a QSettings class.
QSettings *configini;
- //Reads the theme from config.ini and loads it into the current_theme variable
+ // Reads the theme from config.ini and loads it into the current_theme
+ // variable
QString read_theme();
- //Returns the value of ooc_name in config.ini
+ // Returns the value of ooc_name in config.ini
QString get_ooc_name();
- //Returns the blip rate from config.ini
+ // Returns the blip rate from config.ini
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();
- //Returns the value of default_music in config.ini
+ // Returns the value of default_music in config.ini
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();
- //Returns the value of default_blip in config.ini
+ // Returns the value of default_blip in config.ini
int get_default_blip();
// Returns the value of whether Discord should be enabled on startup
@@ -177,101 +177,102 @@ public:
// Returns whether the user would like to have custom shownames on by default.
bool get_showname_enabled_by_default();
- //Returns the list of words in callwords.ini
+ // Returns the list of words in callwords.ini
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);
- //Returns the contents of serverlist.txt
+ // Returns the contents of serverlist.txt
QVector<server_type> read_serverlist_txt();
- //Returns the value of p_identifier in the design.ini file in p_design_path
+ // Returns the value of p_identifier in the design.ini file in p_design_path
QString read_design_ini(QString p_identifier, QString p_design_path);
- //Returns the coordinates of widget with p_identifier from p_file
+ // Returns the coordinates of widget with p_identifier from p_file
QPoint get_button_spacing(QString p_identifier, QString p_file);
- //Returns the dimensions of widget with specified identifier from p_file
+ // Returns the dimensions of widget with specified identifier from p_file
pos_size_type get_element_dimensions(QString p_identifier, QString p_file);
- //Returns the name of the font with p_identifier from p_file
- QString get_font_name(QString p_identifier, QString p_file);
-
+ // Returns the name of the font with p_identifier from p_file
+ QString get_font_name(QString p_identifier, QString p_file);
- //Returns the value of font_size with p_identifier from p_file
+ // Returns the value of font_size with p_identifier from p_file
int get_font_size(QString p_identifier, QString p_file);
- //Returns the color with p_identifier from p_file
+ // Returns the color with p_identifier from p_file
QColor get_color(QString p_identifier, QString p_file);
// Returns the colour from the misc folder.
QColor get_chat_color(QString p_identifier, QString p_chat);
- //Returns the sfx with p_identifier from sounds.ini in the current theme path
+ // Returns the sfx with p_identifier from sounds.ini in the current theme path
QString get_sfx(QString p_identifier);
- //Figure out if we can opus this or if we should fall back to wav
+ // Figure out if we can opus this or if we should fall back to wav
QString get_sfx_suffix(QString sound_to_check);
// Can we use APNG for this? If not, fall back to a gif.
QString get_image_suffix(QString path_to_check);
- //Returns the value of p_search_line within target_tag and terminator_tag
- QString read_char_ini(QString p_char, QString p_search_line, QString target_tag);
+ // Returns the value of p_search_line within target_tag and terminator_tag
+ QString read_char_ini(QString p_char, QString p_search_line,
+ QString target_tag);
- //Returns the side of the p_char character from that characters ini file
+ // Returns the side of the p_char character from that characters ini file
QString get_char_side(QString p_char);
- //Returns the showname from the ini of p_char
+ // Returns the showname from the ini of p_char
QString get_showname(QString p_char);
- //Returns the value of chat from the specific p_char's ini file
+ // Returns the value of chat from the specific p_char's ini file
QString get_chat(QString p_char);
- //Returns the value of shouts from the specified p_char's ini file
+ // Returns the value of shouts from the specified p_char's ini file
QString get_char_shouts(QString p_char);
- //Returns the preanim duration of p_char's p_emote
+ // Returns the preanim duration of p_char's p_emote
int get_preanim_duration(QString p_char, QString p_emote);
- //Same as above, but only returns if it has a % in front(refer to Preanims section in the manual)
+ // Same as above, but only returns if it has a % in front(refer to Preanims
+ // section in the manual)
int get_ao2_preanim_duration(QString p_char, QString p_emote);
- //Not in use
+ // Not in use
int get_text_delay(QString p_char, QString p_emote);
// Returns the custom realisation used by the character.
QString get_custom_realization(QString p_char);
- //Returns the name of p_char
+ // Returns the name of 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);
- //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);
- //Returns the base name of p_char's p_emote
+ // Returns the base name of p_char's p_emote
QString get_emote(QString p_char, int p_emote);
- //Returns the preanimation name of p_char's p_emote
+ // 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
+ // Returns the sfx of p_char's p_emote
QString get_sfx_name(QString p_char, int p_emote);
- //Not in use
+ // Not in use
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);
- //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);
- //Returns p_char's gender
+ // Returns p_char's gender
QString get_gender(QString p_char);
// ======
diff --git a/include/aoblipplayer.h b/include/aoblipplayer.h
index 102a0408..02bd3c66 100644
--- a/include/aoblipplayer.h
+++ b/include/aoblipplayer.h
@@ -9,13 +9,11 @@
#include "aoapplication.h"
+#include <QDebug>
#include <QWidget>
#include <string.h>
-#include <QDebug>
-
-class AOBlipPlayer
-{
+class AOBlipPlayer {
public:
AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app);
@@ -30,11 +28,11 @@ private:
AOApplication *ao_app;
int m_volume;
- #if defined(BASSAUDIO)
+#if defined(BASSAUDIO)
HSTREAM m_stream_list[5];
- #elif defined(QTAUDIO)
+#elif defined(QTAUDIO)
QSoundEffect m_blips;
- #endif
+#endif
};
#endif // AOBLIPPLAYER_H
diff --git a/include/aobutton.h b/include/aobutton.h
index 4b7209ae..f5758856 100644
--- a/include/aobutton.h
+++ b/include/aobutton.h
@@ -3,11 +3,10 @@
#include "aoapplication.h"
-#include <QPushButton>
#include <QDebug>
+#include <QPushButton>
-class AOButton : public QPushButton
-{
+class AOButton : public QPushButton {
Q_OBJECT
public:
diff --git a/include/aocaseannouncerdialog.h b/include/aocaseannouncerdialog.h
index a238c3f2..0ac8f074 100644
--- a/include/aocaseannouncerdialog.h
+++ b/include/aocaseannouncerdialog.h
@@ -4,20 +4,21 @@
#include "aoapplication.h"
#include "courtroom.h"
-#include <QtWidgets/QDialog>
#include <QDialogButtonBox>
-#include <QtWidgets/QVBoxLayout>
-#include <QtWidgets/QFormLayout>
#include <QtWidgets/QCheckBox>
+#include <QtWidgets/QDialog>
+#include <QtWidgets/QFormLayout>
#include <QtWidgets/QLabel>
#include <QtWidgets/QLineEdit>
+#include <QtWidgets/QVBoxLayout>
-class AOCaseAnnouncerDialog : public QDialog
-{
+class AOCaseAnnouncerDialog : public QDialog {
Q_OBJECT
public:
- explicit AOCaseAnnouncerDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr, Courtroom *p_court = nullptr);
+ explicit AOCaseAnnouncerDialog(QWidget *parent = nullptr,
+ AOApplication *p_ao_app = nullptr,
+ Courtroom *p_court = nullptr);
private:
AOApplication *ao_app;
diff --git a/include/aocharbutton.h b/include/aocharbutton.h
index f372cdf8..dd27e62c 100644
--- a/include/aocharbutton.h
+++ b/include/aocharbutton.h
@@ -4,17 +4,17 @@
#include "aoapplication.h"
#include "aoimage.h"
+#include <QFile>
#include <QPushButton>
#include <QString>
#include <QWidget>
-#include <QFile>
-class AOCharButton : public QPushButton
-{
+class AOCharButton : public QPushButton {
Q_OBJECT
public:
- AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken);
+ AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos,
+ bool is_taken);
AOApplication *ao_app;
diff --git a/include/aocharmovie.h b/include/aocharmovie.h
index 7ef7da3f..b4a8be2c 100644
--- a/include/aocharmovie.h
+++ b/include/aocharmovie.h
@@ -1,16 +1,15 @@
#ifndef AOCHARMOVIE_H
#define AOCHARMOVIE_H
-#include <QMovie>
-#include <QLabel>
-#include <QTimer>
#include <QDebug>
#include <QImageReader>
+#include <QLabel>
+#include <QMovie>
+#include <QTimer>
class AOApplication;
-class AOCharMovie : public QLabel
-{
+class AOCharMovie : public QLabel {
Q_OBJECT
public:
@@ -21,7 +20,7 @@ public:
void play_talking(QString p_char, QString p_emote);
void play_idle(QString p_char, QString p_emote);
- void set_flipped(bool p_flipped) {m_flipped = p_flipped;}
+ void set_flipped(bool p_flipped) { m_flipped = p_flipped; }
void stop();
@@ -38,7 +37,8 @@ private:
const int time_mod = 62;
- // These are the X and Y values before they are fixed based on the sprite's width.
+ // These are the X and Y values before they are fixed based on the sprite's
+ // width.
int x = 0;
int y = 0;
diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h
index c99a73b0..acf0b484 100644
--- a/include/aoemotebutton.h
+++ b/include/aoemotebutton.h
@@ -3,22 +3,21 @@
#include "aoapplication.h"
-#include <QPushButton>
#include <QDebug>
+#include <QPushButton>
-class AOEmoteButton : public QPushButton
-{
+class AOEmoteButton : public QPushButton {
Q_OBJECT
public:
AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
- //void set_on(QString p_char, int p_emote);
- //void set_off(QString p_char, int p_emote);
+ // void set_on(QString p_char, int p_emote);
+ // void set_off(QString p_char, int p_emote);
void set_image(QString p_char, int p_emote, QString suffix);
- void set_id(int p_id) {m_id = p_id;}
- int get_id() {return m_id;}
+ void set_id(int p_id) { m_id = p_id; }
+ int get_id() { return m_id; }
private:
QWidget *parent;
diff --git a/include/aoevidencebutton.h b/include/aoevidencebutton.h
index 80b747cd..b56bfb1d 100644
--- a/include/aoevidencebutton.h
+++ b/include/aoevidencebutton.h
@@ -4,21 +4,21 @@
#include "aoapplication.h"
#include "aoimage.h"
+#include <QDebug>
#include <QPushButton>
#include <QString>
-#include <QDebug>
-class AOEvidenceButton : public QPushButton
-{
+class AOEvidenceButton : public QPushButton {
Q_OBJECT
public:
- AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y);
+ AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x,
+ int p_y);
void reset();
void set_image(QString p_image);
void set_theme_image(QString p_image);
- void set_id(int p_id) {m_id = p_id;}
+ void set_id(int p_id) { m_id = p_id; }
void set_selected(bool p_selected);
diff --git a/include/aoevidencedisplay.h b/include/aoevidencedisplay.h
index 13ca00d5..1d6280da 100644
--- a/include/aoevidencedisplay.h
+++ b/include/aoevidencedisplay.h
@@ -4,19 +4,18 @@
#include "aoapplication.h"
#include "aosfxplayer.h"
+#include <QDebug>
#include <QLabel>
#include <QMovie>
-#include <QDebug>
-class AOEvidenceDisplay : public QLabel
-{
+class AOEvidenceDisplay : public QLabel {
Q_OBJECT
public:
AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app);
void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume);
- QLabel* get_evidence_icon();
+ QLabel *get_evidence_icon();
void reset();
private:
diff --git a/include/aoimage.h b/include/aoimage.h
index 4713be0a..c4fdf2ee 100644
--- a/include/aoimage.h
+++ b/include/aoimage.h
@@ -1,15 +1,14 @@
-//This class represents a static theme-dependent image
+// This class represents a static theme-dependent image
#ifndef AOIMAGE_H
#define AOIMAGE_H
#include "aoapplication.h"
-#include <QLabel>
#include <QDebug>
+#include <QLabel>
-class AOImage : public QLabel
-{
+class AOImage : public QLabel {
public:
AOImage(QWidget *parent, AOApplication *p_ao_app);
~AOImage();
diff --git a/include/aolineedit.h b/include/aolineedit.h
index ce17680d..70f1f978 100644
--- a/include/aolineedit.h
+++ b/include/aolineedit.h
@@ -4,8 +4,7 @@
#include <QLineEdit>
#include <QMouseEvent>
-class AOLineEdit : public QLineEdit
-{
+class AOLineEdit : public QLineEdit {
Q_OBJECT
public:
@@ -19,8 +18,6 @@ signals:
private slots:
void on_enter_pressed();
-
-
};
#endif // AOLINEEDIT_H
diff --git a/include/aomovie.h b/include/aomovie.h
index 1f278bf8..d22f725a 100644
--- a/include/aomovie.h
+++ b/include/aomovie.h
@@ -7,8 +7,7 @@
class Courtroom;
class AOApplication;
-class AOMovie : public QLabel
-{
+class AOMovie : public QLabel {
Q_OBJECT
public:
diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h
index b34267c9..fd6b2548 100644
--- a/include/aomusicplayer.h
+++ b/include/aomusicplayer.h
@@ -8,13 +8,12 @@
#endif
#include "aoapplication.h"
+#include <QDebug>
#include <QWidget>
#include <string.h>
-#include <QDebug>
#if defined(BASSAUDIO)
-class AOMusicPlayer
-{
+class AOMusicPlayer {
public:
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
~AOMusicPlayer();
@@ -30,8 +29,7 @@ private:
HSTREAM m_stream;
};
#elif defined(QTAUDIO)
-class AOMusicPlayer
-{
+class AOMusicPlayer {
public:
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
~AOMusicPlayer();
@@ -47,8 +45,7 @@ private:
int m_volume = 0;
};
#else
-class AOMusicPlayer
-{
+class AOMusicPlayer {
public:
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
~AOMusicPlayer();
diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h
index a65e3f59..ec0889ba 100644
--- a/include/aooptionsdialog.h
+++ b/include/aooptionsdialog.h
@@ -23,93 +23,93 @@
#include <QDirIterator>
#include <QTextStream>
-class AOOptionsDialog: public QDialog
-{
- Q_OBJECT
+class AOOptionsDialog : public QDialog {
+ Q_OBJECT
public:
- explicit AOOptionsDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr);
+ explicit AOOptionsDialog(QWidget *parent = nullptr,
+ AOApplication *p_ao_app = nullptr);
private:
- AOApplication *ao_app;
+ AOApplication *ao_app;
- QVBoxLayout *ui_vertical_layout;
- QTabWidget *ui_settings_tabs;
+ QVBoxLayout *ui_vertical_layout;
+ QTabWidget *ui_settings_tabs;
- QWidget *ui_gameplay_tab;
- QWidget *ui_form_layout_widget;
- QFormLayout *ui_gameplay_form;
- QLabel *ui_theme_label;
- QComboBox *ui_theme_combobox;
- QFrame *ui_theme_log_divider;
- QLabel *ui_downwards_lbl;
- QCheckBox *ui_downwards_cb;
- QLabel *ui_length_lbl;
- QSpinBox *ui_length_spinbox;
- QFrame *ui_log_names_divider;
- QLineEdit *ui_username_textbox;
- QLabel *ui_username_lbl;
- QLabel *ui_showname_lbl;
- QCheckBox *ui_showname_cb;
- QFrame *ui_net_divider;
- QLabel *ui_ms_lbl;
- QLineEdit *ui_ms_textbox;
- QLabel *ui_discord_lbl;
- QCheckBox *ui_discord_cb;
+ QWidget *ui_gameplay_tab;
+ QWidget *ui_form_layout_widget;
+ QFormLayout *ui_gameplay_form;
+ QLabel *ui_theme_label;
+ QComboBox *ui_theme_combobox;
+ QFrame *ui_theme_log_divider;
+ QLabel *ui_downwards_lbl;
+ QCheckBox *ui_downwards_cb;
+ QLabel *ui_length_lbl;
+ QSpinBox *ui_length_spinbox;
+ QFrame *ui_log_names_divider;
+ QLineEdit *ui_username_textbox;
+ QLabel *ui_username_lbl;
+ QLabel *ui_showname_lbl;
+ QCheckBox *ui_showname_cb;
+ QFrame *ui_net_divider;
+ QLabel *ui_ms_lbl;
+ QLineEdit *ui_ms_textbox;
+ QLabel *ui_discord_lbl;
+ QCheckBox *ui_discord_cb;
- 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_callwords_tab;
+ QWidget *ui_callwords_widget;
+ QVBoxLayout *ui_callwords_layout;
+ QPlainTextEdit *ui_callwords_textbox;
+ QLabel *ui_callwords_explain_lbl;
+ QCheckBox *ui_callwords_char_textbox;
- QWidget *ui_audio_tab;
- QWidget *ui_audio_widget;
- QFormLayout *ui_audio_layout;
- QLabel *ui_audio_device_lbl;
- QComboBox *ui_audio_device_combobox;
- QFrame *ui_audio_volume_divider;
- QSpinBox *ui_music_volume_spinbox;
- QLabel *ui_music_volume_lbl;
- QSpinBox *ui_sfx_volume_spinbox;
- QSpinBox *ui_blips_volume_spinbox;
- QLabel *ui_sfx_volume_lbl;
- QLabel *ui_blips_volume_lbl;
- QFrame *ui_volume_blip_divider;
- QSpinBox *ui_bliprate_spinbox;
- QLabel *ui_bliprate_lbl;
- QCheckBox *ui_blank_blips_cb;
- QLabel *ui_blank_blips_lbl;
- QDialogButtonBox *ui_settings_buttons;
+ QWidget *ui_audio_tab;
+ QWidget *ui_audio_widget;
+ QFormLayout *ui_audio_layout;
+ QLabel *ui_audio_device_lbl;
+ QComboBox *ui_audio_device_combobox;
+ QFrame *ui_audio_volume_divider;
+ QSpinBox *ui_music_volume_spinbox;
+ QLabel *ui_music_volume_lbl;
+ QSpinBox *ui_sfx_volume_spinbox;
+ QSpinBox *ui_blips_volume_spinbox;
+ QLabel *ui_sfx_volume_lbl;
+ QLabel *ui_blips_volume_lbl;
+ QFrame *ui_volume_blip_divider;
+ QSpinBox *ui_bliprate_spinbox;
+ QLabel *ui_bliprate_lbl;
+ QCheckBox *ui_blank_blips_cb;
+ QLabel *ui_blank_blips_lbl;
+ 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_cm_cases_lbl;
- QLineEdit *ui_casing_cm_cases_textbox;
+ 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_cm_cases_lbl;
+ QLineEdit *ui_casing_cm_cases_textbox;
- bool needs_default_audiodev();
+ bool needs_default_audiodev();
signals:
public slots:
- void save_pressed();
- void discard_pressed();
+ void save_pressed();
+ void discard_pressed();
};
#endif // AOOPTIONSDIALOG_H
diff --git a/include/aopacket.h b/include/aopacket.h
index 21f6e0f4..4097be86 100644
--- a/include/aopacket.h
+++ b/include/aopacket.h
@@ -1,19 +1,18 @@
#ifndef AOPACKET_H
#define AOPACKET_H
+#include <QDebug>
#include <QString>
#include <QStringList>
-#include <QDebug>
-class AOPacket
-{
+class AOPacket {
public:
AOPacket(QString p_packet_string);
AOPacket(QString header, QStringList &p_contents);
~AOPacket();
- QString get_header() {return m_header;}
- QStringList &get_contents() {return m_contents;}
+ QString get_header() { return m_header; }
+ QStringList &get_contents() { return m_contents; }
QString to_string();
void encrypt_header(unsigned int p_key);
diff --git a/include/aoscene.h b/include/aoscene.h
index b58c0fd0..1c258f2f 100644
--- a/include/aoscene.h
+++ b/include/aoscene.h
@@ -1,15 +1,14 @@
#ifndef AOSCENE_H
#define AOSCENE_H
-#include <QLabel>
#include <QDebug>
+#include <QLabel>
#include <QMovie>
class Courtroom;
class AOApplication;
-class AOScene : public QLabel
-{
+class AOScene : public QLabel {
Q_OBJECT
public:
explicit AOScene(QWidget *parent, AOApplication *p_ao_app);
@@ -21,7 +20,6 @@ private:
QWidget *m_parent;
QMovie *m_movie;
AOApplication *ao_app;
-
};
#endif // AOSCENE_H
diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h
index 4b976852..b6dce85d 100644
--- a/include/aosfxplayer.h
+++ b/include/aosfxplayer.h
@@ -9,12 +9,11 @@
#include "aoapplication.h"
+#include <QDebug>
#include <QWidget>
#include <string.h>
-#include <QDebug>
-class AOSfxPlayer
-{
+class AOSfxPlayer {
public:
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
@@ -25,11 +24,11 @@ public:
private:
QWidget *m_parent;
AOApplication *ao_app;
- #if defined(BASSAUDIO)
+#if defined(BASSAUDIO)
HSTREAM m_stream;
- #elif defined(QTAUDIO)
+#elif defined(QTAUDIO)
QSoundEffect m_sfx;
- #endif
+#endif
int m_volume = 0;
};
diff --git a/include/aotextarea.h b/include/aotextarea.h
index d44596b2..13532d29 100644
--- a/include/aotextarea.h
+++ b/include/aotextarea.h
@@ -1,14 +1,13 @@
#ifndef AOTEXTAREA_H
#define AOTEXTAREA_H
-#include <QTextBrowser>
+#include <QDebug>
+#include <QRegExp>
#include <QScrollBar>
+#include <QTextBrowser>
#include <QTextCursor>
-#include <QRegExp>
-#include <QDebug>
-class AOTextArea : public QTextBrowser
-{
+class AOTextArea : public QTextBrowser {
public:
AOTextArea(QWidget *p_parent = nullptr);
@@ -18,7 +17,8 @@ public:
private:
const QRegExp omnis_dank_url_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
- void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down);
+ void auto_scroll(QTextCursor old_cursor, int scrollbar_value,
+ bool is_scrolled_down);
};
#endif // AOTEXTAREA_H
diff --git a/include/aotextedit.h b/include/aotextedit.h
index 85909c6e..8d876f17 100644
--- a/include/aotextedit.h
+++ b/include/aotextedit.h
@@ -3,8 +3,7 @@
#include <QPlainTextEdit>
-class AOTextEdit : public QPlainTextEdit
-{
+class AOTextEdit : public QPlainTextEdit {
Q_OBJECT
public:
AOTextEdit(QWidget *parent);
@@ -17,7 +16,6 @@ signals:
private slots:
void on_enter_pressed();
-
};
#endif // AOTEXTEDIT_H
diff --git a/include/bass.h b/include/bass.h
index 1c50903c..068b963c 100644
--- a/include/bass.h
+++ b/include/bass.h
@@ -1,8 +1,8 @@
/*
- BASS 2.4 C/C++ header file
- Copyright (c) 1999-2018 Un4seen Developments Ltd.
+ BASS 2.4 C/C++ header file
+ Copyright (c) 1999-2018 Un4seen Developments Ltd.
- See the BASS.CHM file for more detailed documentation
+ See the BASS.CHM file for more detailed documentation
*/
#ifndef BASS_H
@@ -27,19 +27,19 @@ typedef int BOOL;
#define FALSE 0
#endif
#define LOBYTE(a) (BYTE)(a)
-#define HIBYTE(a) (BYTE)((a)>>8)
+#define HIBYTE(a) (BYTE)((a) >> 8)
#define LOWORD(a) (WORD)(a)
-#define HIWORD(a) (WORD)((a)>>16)
-#define MAKEWORD(a,b) (WORD)(((a)&0xff)|((b)<<8))
-#define MAKELONG(a,b) (DWORD)(((a)&0xffff)|((b)<<16))
+#define HIWORD(a) (WORD)((a) >> 16)
+#define MAKEWORD(a, b) (WORD)(((a)&0xff) | ((b) << 8))
+#define MAKELONG(a, b) (DWORD)(((a)&0xffff) | ((b) << 16))
#endif
#ifdef __cplusplus
extern "C" {
#endif
-#define BASSVERSION 0x204 // API version
-#define BASSVERSIONTEXT "2.4"
+#define BASSVERSION 0x204 // API version
+#define BASSVERSIONTEXT "2.4"
#ifndef BASSDEF
#define BASSDEF(f) WINAPI f
@@ -47,524 +47,548 @@ extern "C" {
#define NOBASSOVERLOADS
#endif
-typedef DWORD HMUSIC; // MOD music handle
-typedef DWORD HSAMPLE; // sample handle
-typedef DWORD HCHANNEL; // playing sample's channel handle
-typedef DWORD HSTREAM; // sample stream handle
-typedef DWORD HRECORD; // recording handle
-typedef DWORD HSYNC; // synchronizer handle
-typedef DWORD HDSP; // DSP handle
-typedef DWORD HFX; // DX8 effect handle
-typedef DWORD HPLUGIN; // Plugin handle
+typedef DWORD HMUSIC; // MOD music handle
+typedef DWORD HSAMPLE; // sample handle
+typedef DWORD HCHANNEL; // playing sample's channel handle
+typedef DWORD HSTREAM; // sample stream handle
+typedef DWORD HRECORD; // recording handle
+typedef DWORD HSYNC; // synchronizer handle
+typedef DWORD HDSP; // DSP handle
+typedef DWORD HFX; // DX8 effect handle
+typedef DWORD HPLUGIN; // Plugin handle
// Error codes returned by BASS_ErrorGetCode
-#define BASS_OK 0 // all is OK
-#define BASS_ERROR_MEM 1 // memory error
-#define BASS_ERROR_FILEOPEN 2 // can't open the file
-#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver
-#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost
-#define BASS_ERROR_HANDLE 5 // invalid handle
-#define BASS_ERROR_FORMAT 6 // unsupported sample format
-#define BASS_ERROR_POSITION 7 // invalid position
-#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called
-#define BASS_ERROR_START 9 // BASS_Start has not been successfully called
-#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available
-#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever
-#define BASS_ERROR_NOCHAN 18 // can't get a free channel
-#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified
-#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified
-#define BASS_ERROR_NO3D 21 // no 3D support
-#define BASS_ERROR_NOEAX 22 // no EAX support
-#define BASS_ERROR_DEVICE 23 // illegal device number
-#define BASS_ERROR_NOPLAY 24 // not playing
-#define BASS_ERROR_FREQ 25 // illegal sample rate
-#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream
-#define BASS_ERROR_NOHW 29 // no hardware voices available
-#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data
-#define BASS_ERROR_NONET 32 // no internet connection could be opened
-#define BASS_ERROR_CREATE 33 // couldn't create the file
-#define BASS_ERROR_NOFX 34 // effects are not available
-#define BASS_ERROR_NOTAVAIL 37 // requested data/action is not available
-#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel"
-#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed
-#define BASS_ERROR_TIMEOUT 40 // connection timedout
-#define BASS_ERROR_FILEFORM 41 // unsupported file format
-#define BASS_ERROR_SPEAKER 42 // unavailable speaker
-#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons)
-#define BASS_ERROR_CODEC 44 // codec is not available/supported
-#define BASS_ERROR_ENDED 45 // the channel/file has ended
-#define BASS_ERROR_BUSY 46 // the device is busy
-#define BASS_ERROR_UNKNOWN -1 // some other mystery problem
+#define BASS_OK 0 // all is OK
+#define BASS_ERROR_MEM 1 // memory error
+#define BASS_ERROR_FILEOPEN 2 // can't open the file
+#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver
+#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost
+#define BASS_ERROR_HANDLE 5 // invalid handle
+#define BASS_ERROR_FORMAT 6 // unsupported sample format
+#define BASS_ERROR_POSITION 7 // invalid position
+#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called
+#define BASS_ERROR_START 9 // BASS_Start has not been successfully called
+#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available
+#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever
+#define BASS_ERROR_NOCHAN 18 // can't get a free channel
+#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified
+#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified
+#define BASS_ERROR_NO3D 21 // no 3D support
+#define BASS_ERROR_NOEAX 22 // no EAX support
+#define BASS_ERROR_DEVICE 23 // illegal device number
+#define BASS_ERROR_NOPLAY 24 // not playing
+#define BASS_ERROR_FREQ 25 // illegal sample rate
+#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream
+#define BASS_ERROR_NOHW 29 // no hardware voices available
+#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data
+#define BASS_ERROR_NONET 32 // no internet connection could be opened
+#define BASS_ERROR_CREATE 33 // couldn't create the file
+#define BASS_ERROR_NOFX 34 // effects are not available
+#define BASS_ERROR_NOTAVAIL 37 // requested data/action is not available
+#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel"
+#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed
+#define BASS_ERROR_TIMEOUT 40 // connection timedout
+#define BASS_ERROR_FILEFORM 41 // unsupported file format
+#define BASS_ERROR_SPEAKER 42 // unavailable speaker
+#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons)
+#define BASS_ERROR_CODEC 44 // codec is not available/supported
+#define BASS_ERROR_ENDED 45 // the channel/file has ended
+#define BASS_ERROR_BUSY 46 // the device is busy
+#define BASS_ERROR_UNKNOWN -1 // some other mystery problem
// BASS_SetConfig options
-#define BASS_CONFIG_BUFFER 0
-#define BASS_CONFIG_UPDATEPERIOD 1
-#define BASS_CONFIG_GVOL_SAMPLE 4
-#define BASS_CONFIG_GVOL_STREAM 5
-#define BASS_CONFIG_GVOL_MUSIC 6
-#define BASS_CONFIG_CURVE_VOL 7
-#define BASS_CONFIG_CURVE_PAN 8
-#define BASS_CONFIG_FLOATDSP 9
-#define BASS_CONFIG_3DALGORITHM 10
-#define BASS_CONFIG_NET_TIMEOUT 11
-#define BASS_CONFIG_NET_BUFFER 12
-#define BASS_CONFIG_PAUSE_NOPLAY 13
-#define BASS_CONFIG_NET_PREBUF 15
-#define BASS_CONFIG_NET_PASSIVE 18
-#define BASS_CONFIG_REC_BUFFER 19
-#define BASS_CONFIG_NET_PLAYLIST 21
-#define BASS_CONFIG_MUSIC_VIRTUAL 22
-#define BASS_CONFIG_VERIFY 23
-#define BASS_CONFIG_UPDATETHREADS 24
-#define BASS_CONFIG_DEV_BUFFER 27
-#define BASS_CONFIG_VISTA_TRUEPOS 30
-#define BASS_CONFIG_IOS_MIXAUDIO 34
-#define BASS_CONFIG_DEV_DEFAULT 36
-#define BASS_CONFIG_NET_READTIMEOUT 37
-#define BASS_CONFIG_VISTA_SPEAKERS 38
-#define BASS_CONFIG_IOS_SPEAKER 39
-#define BASS_CONFIG_MF_DISABLE 40
-#define BASS_CONFIG_HANDLES 41
-#define BASS_CONFIG_UNICODE 42
-#define BASS_CONFIG_SRC 43
-#define BASS_CONFIG_SRC_SAMPLE 44
-#define BASS_CONFIG_ASYNCFILE_BUFFER 45
-#define BASS_CONFIG_OGG_PRESCAN 47
-#define BASS_CONFIG_MF_VIDEO 48
-#define BASS_CONFIG_AIRPLAY 49
-#define BASS_CONFIG_DEV_NONSTOP 50
-#define BASS_CONFIG_IOS_NOCATEGORY 51
-#define BASS_CONFIG_VERIFY_NET 52
-#define BASS_CONFIG_DEV_PERIOD 53
-#define BASS_CONFIG_FLOAT 54
-#define BASS_CONFIG_NET_SEEK 56
-#define BASS_CONFIG_AM_DISABLE 58
-#define BASS_CONFIG_NET_PLAYLIST_DEPTH 59
-#define BASS_CONFIG_NET_PREBUF_WAIT 60
+#define BASS_CONFIG_BUFFER 0
+#define BASS_CONFIG_UPDATEPERIOD 1
+#define BASS_CONFIG_GVOL_SAMPLE 4
+#define BASS_CONFIG_GVOL_STREAM 5
+#define BASS_CONFIG_GVOL_MUSIC 6
+#define BASS_CONFIG_CURVE_VOL 7
+#define BASS_CONFIG_CURVE_PAN 8
+#define BASS_CONFIG_FLOATDSP 9
+#define BASS_CONFIG_3DALGORITHM 10
+#define BASS_CONFIG_NET_TIMEOUT 11
+#define BASS_CONFIG_NET_BUFFER 12
+#define BASS_CONFIG_PAUSE_NOPLAY 13
+#define BASS_CONFIG_NET_PREBUF 15
+#define BASS_CONFIG_NET_PASSIVE 18
+#define BASS_CONFIG_REC_BUFFER 19
+#define BASS_CONFIG_NET_PLAYLIST 21
+#define BASS_CONFIG_MUSIC_VIRTUAL 22
+#define BASS_CONFIG_VERIFY 23
+#define BASS_CONFIG_UPDATETHREADS 24
+#define BASS_CONFIG_DEV_BUFFER 27
+#define BASS_CONFIG_VISTA_TRUEPOS 30
+#define BASS_CONFIG_IOS_MIXAUDIO 34
+#define BASS_CONFIG_DEV_DEFAULT 36
+#define BASS_CONFIG_NET_READTIMEOUT 37
+#define BASS_CONFIG_VISTA_SPEAKERS 38
+#define BASS_CONFIG_IOS_SPEAKER 39
+#define BASS_CONFIG_MF_DISABLE 40
+#define BASS_CONFIG_HANDLES 41
+#define BASS_CONFIG_UNICODE 42
+#define BASS_CONFIG_SRC 43
+#define BASS_CONFIG_SRC_SAMPLE 44
+#define BASS_CONFIG_ASYNCFILE_BUFFER 45
+#define BASS_CONFIG_OGG_PRESCAN 47
+#define BASS_CONFIG_MF_VIDEO 48
+#define BASS_CONFIG_AIRPLAY 49
+#define BASS_CONFIG_DEV_NONSTOP 50
+#define BASS_CONFIG_IOS_NOCATEGORY 51
+#define BASS_CONFIG_VERIFY_NET 52
+#define BASS_CONFIG_DEV_PERIOD 53
+#define BASS_CONFIG_FLOAT 54
+#define BASS_CONFIG_NET_SEEK 56
+#define BASS_CONFIG_AM_DISABLE 58
+#define BASS_CONFIG_NET_PLAYLIST_DEPTH 59
+#define BASS_CONFIG_NET_PREBUF_WAIT 60
// BASS_SetConfigPtr options
-#define BASS_CONFIG_NET_AGENT 16
-#define BASS_CONFIG_NET_PROXY 17
-#define BASS_CONFIG_IOS_NOTIFY 46
+#define BASS_CONFIG_NET_AGENT 16
+#define BASS_CONFIG_NET_PROXY 17
+#define BASS_CONFIG_IOS_NOTIFY 46
// BASS_Init flags
-#define BASS_DEVICE_8BITS 1 // 8 bit
-#define BASS_DEVICE_MONO 2 // mono
-#define BASS_DEVICE_3D 4 // enable 3D functionality
-#define BASS_DEVICE_16BITS 8 // limit output to 16 bit
-#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct)
-#define BASS_DEVICE_CPSPEAKERS 0x400 // detect speakers via Windows control panel
-#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment
-#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement
-#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin
-#define BASS_DEVICE_FREQ 0x4000 // set device sample rate
-#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo
-#define BASS_DEVICE_HOG 0x10000 // hog/exclusive mode
-#define BASS_DEVICE_AUDIOTRACK 0x20000 // use AudioTrack output
-#define BASS_DEVICE_DSOUND 0x40000 // use DirectSound output
+#define BASS_DEVICE_8BITS 1 // 8 bit
+#define BASS_DEVICE_MONO 2 // mono
+#define BASS_DEVICE_3D 4 // enable 3D functionality
+#define BASS_DEVICE_16BITS 8 // limit output to 16 bit
+#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct)
+#define BASS_DEVICE_CPSPEAKERS \
+ 0x400 // detect speakers via Windows control panel
+#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment
+#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement
+#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin
+#define BASS_DEVICE_FREQ 0x4000 // set device sample rate
+#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo
+#define BASS_DEVICE_HOG 0x10000 // hog/exclusive mode
+#define BASS_DEVICE_AUDIOTRACK 0x20000 // use AudioTrack output
+#define BASS_DEVICE_DSOUND 0x40000 // use DirectSound output
// DirectSound interfaces (for use with BASS_GetDSoundObject)
-#define BASS_OBJECT_DS 1 // IDirectSound
-#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener
+#define BASS_OBJECT_DS 1 // IDirectSound
+#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener
// Device info structure
typedef struct {
-#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
- const wchar_t *name; // description
- const wchar_t *driver; // driver
+#if defined(_WIN32_WCE) || \
+ (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+ const wchar_t *name; // description
+ const wchar_t *driver; // driver
#else
- const char *name; // description
- const char *driver; // driver
+ const char *name; // description
+ const char *driver; // driver
#endif
- DWORD flags;
+ DWORD flags;
} BASS_DEVICEINFO;
// BASS_DEVICEINFO flags
-#define BASS_DEVICE_ENABLED 1
-#define BASS_DEVICE_DEFAULT 2
-#define BASS_DEVICE_INIT 4
-#define BASS_DEVICE_LOOPBACK 8
-
-#define BASS_DEVICE_TYPE_MASK 0xff000000
-#define BASS_DEVICE_TYPE_NETWORK 0x01000000
-#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000
-#define BASS_DEVICE_TYPE_LINE 0x03000000
-#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000
-#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000
-#define BASS_DEVICE_TYPE_HEADSET 0x06000000
-#define BASS_DEVICE_TYPE_HANDSET 0x07000000
-#define BASS_DEVICE_TYPE_DIGITAL 0x08000000
-#define BASS_DEVICE_TYPE_SPDIF 0x09000000
-#define BASS_DEVICE_TYPE_HDMI 0x0a000000
-#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000
-
-// BASS_GetDeviceInfo flags
-#define BASS_DEVICES_AIRPLAY 0x1000000
-
+#define BASS_DEVICE_ENABLED 1
+#define BASS_DEVICE_DEFAULT 2
+#define BASS_DEVICE_INIT 4
+#define BASS_DEVICE_LOOPBACK 8
+
+#define BASS_DEVICE_TYPE_MASK 0xff000000
+#define BASS_DEVICE_TYPE_NETWORK 0x01000000
+#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000
+#define BASS_DEVICE_TYPE_LINE 0x03000000
+#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000
+#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000
+#define BASS_DEVICE_TYPE_HEADSET 0x06000000
+#define BASS_DEVICE_TYPE_HANDSET 0x07000000
+#define BASS_DEVICE_TYPE_DIGITAL 0x08000000
+#define BASS_DEVICE_TYPE_SPDIF 0x09000000
+#define BASS_DEVICE_TYPE_HDMI 0x0a000000
+#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000
+
+// BASS_GetDeviceInfo flags
+#define BASS_DEVICES_AIRPLAY 0x1000000
+
typedef struct {
- DWORD flags; // device capabilities (DSCAPS_xxx flags)
- DWORD hwsize; // size of total device hardware memory
- DWORD hwfree; // size of free device hardware memory
- DWORD freesam; // number of free sample slots in the hardware
- DWORD free3d; // number of free 3D sample slots in the hardware
- DWORD minrate; // min sample rate supported by the hardware
- DWORD maxrate; // max sample rate supported by the hardware
- BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
- DWORD minbuf; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY)
- DWORD dsver; // DirectSound version
- DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY)
- DWORD initflags; // BASS_Init "flags" parameter
- DWORD speakers; // number of speakers available
- DWORD freq; // current output rate
+ DWORD flags; // device capabilities (DSCAPS_xxx flags)
+ DWORD hwsize; // size of total device hardware memory
+ DWORD hwfree; // size of free device hardware memory
+ DWORD freesam; // number of free sample slots in the hardware
+ DWORD free3d; // number of free 3D sample slots in the hardware
+ DWORD minrate; // min sample rate supported by the hardware
+ DWORD maxrate; // max sample rate supported by the hardware
+ BOOL
+ eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used)
+ DWORD minbuf; // recommended minimum buffer length in ms (requires
+ // BASS_DEVICE_LATENCY)
+ DWORD dsver; // DirectSound version
+ DWORD latency; // delay (in ms) before start of playback (requires
+ // BASS_DEVICE_LATENCY)
+ DWORD initflags; // BASS_Init "flags" parameter
+ DWORD speakers; // number of speakers available
+ DWORD freq; // current output rate
} BASS_INFO;
// BASS_INFO flags (from DSOUND.H)
-#define DSCAPS_CONTINUOUSRATE 0x00000010 // supports all sample rates between min/maxrate
-#define DSCAPS_EMULDRIVER 0x00000020 // device does NOT have hardware DirectSound support
-#define DSCAPS_CERTIFIED 0x00000040 // device driver has been certified by Microsoft
-#define DSCAPS_SECONDARYMONO 0x00000100 // mono
-#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo
-#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit
-#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit
+#define DSCAPS_CONTINUOUSRATE \
+ 0x00000010 // supports all sample rates between min/maxrate
+#define DSCAPS_EMULDRIVER \
+ 0x00000020 // device does NOT have hardware DirectSound support
+#define DSCAPS_CERTIFIED \
+ 0x00000040 // device driver has been certified by Microsoft
+#define DSCAPS_SECONDARYMONO 0x00000100 // mono
+#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo
+#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit
+#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit
// Recording device info structure
typedef struct {
- DWORD flags; // device capabilities (DSCCAPS_xxx flags)
- DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags)
- DWORD inputs; // number of inputs
- BOOL singlein; // TRUE = only 1 input can be set at a time
- DWORD freq; // current input rate
+ DWORD flags; // device capabilities (DSCCAPS_xxx flags)
+ DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags)
+ DWORD inputs; // number of inputs
+ BOOL singlein; // TRUE = only 1 input can be set at a time
+ DWORD freq; // current input rate
} BASS_RECORDINFO;
// BASS_RECORDINFO flags (from DSOUND.H)
-#define DSCCAPS_EMULDRIVER DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording support
-#define DSCCAPS_CERTIFIED DSCAPS_CERTIFIED // device driver has been certified by Microsoft
+#define DSCCAPS_EMULDRIVER \
+ DSCAPS_EMULDRIVER // device does NOT have hardware DirectSound recording
+ // support
+#define DSCCAPS_CERTIFIED \
+ DSCAPS_CERTIFIED // device driver has been certified by Microsoft
// defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H)
#ifndef WAVE_FORMAT_1M08
-#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */
-#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */
-#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */
-#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */
-#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */
-#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */
-#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */
-#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */
-#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */
-#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */
-#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */
-#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */
+#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */
+#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */
+#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */
+#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */
+#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */
+#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */
+#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */
+#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */
+#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */
+#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */
+#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */
+#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */
#endif
// Sample info structure
typedef struct {
- DWORD freq; // default playback rate
- float volume; // default volume (0-1)
- float pan; // default pan (-1=left, 0=middle, 1=right)
- DWORD flags; // BASS_SAMPLE_xxx flags
- DWORD length; // length (in bytes)
- DWORD max; // maximum simultaneous playbacks
- DWORD origres; // original resolution
- DWORD chans; // number of channels
- DWORD mingap; // minimum gap (ms) between creating channels
- DWORD mode3d; // BASS_3DMODE_xxx mode
- float mindist; // minimum distance
- float maxdist; // maximum distance
- DWORD iangle; // angle of inside projection cone
- DWORD oangle; // angle of outside projection cone
- float outvol; // delta-volume outside the projection cone
- DWORD vam; // voice allocation/management flags (BASS_VAM_xxx)
- DWORD priority; // priority (0=lowest, 0xffffffff=highest)
+ DWORD freq; // default playback rate
+ float volume; // default volume (0-1)
+ float pan; // default pan (-1=left, 0=middle, 1=right)
+ DWORD flags; // BASS_SAMPLE_xxx flags
+ DWORD length; // length (in bytes)
+ DWORD max; // maximum simultaneous playbacks
+ DWORD origres; // original resolution
+ DWORD chans; // number of channels
+ DWORD mingap; // minimum gap (ms) between creating channels
+ DWORD mode3d; // BASS_3DMODE_xxx mode
+ float mindist; // minimum distance
+ float maxdist; // maximum distance
+ DWORD iangle; // angle of inside projection cone
+ DWORD oangle; // angle of outside projection cone
+ float outvol; // delta-volume outside the projection cone
+ DWORD vam; // voice allocation/management flags (BASS_VAM_xxx)
+ DWORD priority; // priority (0=lowest, 0xffffffff=highest)
} BASS_SAMPLE;
-#define BASS_SAMPLE_8BITS 1 // 8 bit
-#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point
-#define BASS_SAMPLE_MONO 2 // mono
-#define BASS_SAMPLE_LOOP 4 // looped
-#define BASS_SAMPLE_3D 8 // 3D functionality
-#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing
-#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only)
-#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management
-#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects
-#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume
-#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing
-#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only)
-
-#define BASS_STREAM_PRESCAN 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1)
-#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends
-#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams
-#define BASS_STREAM_BLOCK 0x100000 // download/play internet file stream in small blocks
-#define BASS_STREAM_DECODE 0x200000 // don't play the stream, only decode (BASS_ChannelGetData)
-#define BASS_STREAM_STATUS 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC
-
-#define BASS_MP3_IGNOREDELAY 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info
-#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN
-
-#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT
-#define BASS_MUSIC_MONO BASS_SAMPLE_MONO
-#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP
-#define BASS_MUSIC_3D BASS_SAMPLE_3D
-#define BASS_MUSIC_FX BASS_SAMPLE_FX
-#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE
-#define BASS_MUSIC_DECODE BASS_STREAM_DECODE
-#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length
-#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN
-#define BASS_MUSIC_RAMP 0x200 // normal ramping
-#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping
-#define BASS_MUSIC_SURROUND 0x800 // surround sound
-#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2)
-#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files
-#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does
-#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does
-#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing
-#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing
-#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position
-#define BASS_MUSIC_POSRESETEX 0x400000 // stop all notes and reset bmp/etc when moving position
-#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect
-#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples
+#define BASS_SAMPLE_8BITS 1 // 8 bit
+#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point
+#define BASS_SAMPLE_MONO 2 // mono
+#define BASS_SAMPLE_LOOP 4 // looped
+#define BASS_SAMPLE_3D 8 // 3D functionality
+#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing
+#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only)
+#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management
+#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects
+#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume
+#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing
+#define BASS_SAMPLE_OVER_DIST \
+ 0x30000 // override furthest from listener (3D only)
+
+#define BASS_STREAM_PRESCAN \
+ 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1)
+#define BASS_STREAM_AUTOFREE \
+ 0x40000 // automatically free the stream when it stop/ends
+#define BASS_STREAM_RESTRATE \
+ 0x80000 // restrict the download rate of internet file streams
+#define BASS_STREAM_BLOCK \
+ 0x100000 // download/play internet file stream in small blocks
+#define BASS_STREAM_DECODE \
+ 0x200000 // don't play the stream, only decode (BASS_ChannelGetData)
+#define BASS_STREAM_STATUS \
+ 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC
+
+#define BASS_MP3_IGNOREDELAY \
+ 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info
+#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN
+
+#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT
+#define BASS_MUSIC_MONO BASS_SAMPLE_MONO
+#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP
+#define BASS_MUSIC_3D BASS_SAMPLE_3D
+#define BASS_MUSIC_FX BASS_SAMPLE_FX
+#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE
+#define BASS_MUSIC_DECODE BASS_STREAM_DECODE
+#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length
+#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN
+#define BASS_MUSIC_RAMP 0x200 // normal ramping
+#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping
+#define BASS_MUSIC_SURROUND 0x800 // surround sound
+#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2)
+#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files
+#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does
+#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does
+#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing
+#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing
+#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position
+#define BASS_MUSIC_POSRESETEX \
+ 0x400000 // stop all notes and reset bmp/etc when moving position
+#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect
+#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples
// Speaker assignment flags
-#define BASS_SPEAKER_FRONT 0x1000000 // front speakers
-#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers
-#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1)
-#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1)
-#define BASS_SPEAKER_N(n) ((n)<<24) // n'th pair of speakers (max 15)
-#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left
-#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right
-#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT
-#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT
-#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT
-#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT
-#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT
-#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT
-#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT
-#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT
-
-#define BASS_ASYNCFILE 0x40000000
-#define BASS_UNICODE 0x80000000
-
-#define BASS_RECORD_PAUSE 0x8000 // start recording paused
-#define BASS_RECORD_ECHOCANCEL 0x2000
-#define BASS_RECORD_AGC 0x4000
+#define BASS_SPEAKER_FRONT 0x1000000 // front speakers
+#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers
+#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1)
+#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1)
+#define BASS_SPEAKER_N(n) ((n) << 24) // n'th pair of speakers (max 15)
+#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left
+#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right
+#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT | BASS_SPEAKER_LEFT
+#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT | BASS_SPEAKER_RIGHT
+#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR | BASS_SPEAKER_LEFT
+#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR | BASS_SPEAKER_RIGHT
+#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE | BASS_SPEAKER_LEFT
+#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE | BASS_SPEAKER_RIGHT
+#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2 | BASS_SPEAKER_LEFT
+#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2 | BASS_SPEAKER_RIGHT
+
+#define BASS_ASYNCFILE 0x40000000
+#define BASS_UNICODE 0x80000000
+
+#define BASS_RECORD_PAUSE 0x8000 // start recording paused
+#define BASS_RECORD_ECHOCANCEL 0x2000
+#define BASS_RECORD_AGC 0x4000
// DX7 voice allocation & management flags
-#define BASS_VAM_HARDWARE 1
-#define BASS_VAM_SOFTWARE 2
-#define BASS_VAM_TERM_TIME 4
-#define BASS_VAM_TERM_DIST 8
-#define BASS_VAM_TERM_PRIO 16
+#define BASS_VAM_HARDWARE 1
+#define BASS_VAM_SOFTWARE 2
+#define BASS_VAM_TERM_TIME 4
+#define BASS_VAM_TERM_DIST 8
+#define BASS_VAM_TERM_PRIO 16
// Channel info structure
typedef struct {
- DWORD freq; // default playback rate
- DWORD chans; // channels
- DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
- DWORD ctype; // type of channel
- DWORD origres; // original resolution
- HPLUGIN plugin; // plugin
- HSAMPLE sample; // sample
- const char *filename; // filename
+ DWORD freq; // default playback rate
+ DWORD chans; // channels
+ DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags
+ DWORD ctype; // type of channel
+ DWORD origres; // original resolution
+ HPLUGIN plugin; // plugin
+ HSAMPLE sample; // sample
+ const char *filename; // filename
} BASS_CHANNELINFO;
-#define BASS_ORIGRES_FLOAT 0x10000
+#define BASS_ORIGRES_FLOAT 0x10000
// BASS_CHANNELINFO types
-#define BASS_CTYPE_SAMPLE 1
-#define BASS_CTYPE_RECORD 2
-#define BASS_CTYPE_STREAM 0x10000
-#define BASS_CTYPE_STREAM_OGG 0x10002
-#define BASS_CTYPE_STREAM_MP1 0x10003
-#define BASS_CTYPE_STREAM_MP2 0x10004
-#define BASS_CTYPE_STREAM_MP3 0x10005
-#define BASS_CTYPE_STREAM_AIFF 0x10006
-#define BASS_CTYPE_STREAM_CA 0x10007
-#define BASS_CTYPE_STREAM_MF 0x10008
-#define BASS_CTYPE_STREAM_AM 0x10009
-#define BASS_CTYPE_STREAM_DUMMY 0x18000
-#define BASS_CTYPE_STREAM_DEVICE 0x18001
-#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec
-#define BASS_CTYPE_STREAM_WAV_PCM 0x50001
-#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003
-#define BASS_CTYPE_MUSIC_MOD 0x20000
-#define BASS_CTYPE_MUSIC_MTM 0x20001
-#define BASS_CTYPE_MUSIC_S3M 0x20002
-#define BASS_CTYPE_MUSIC_XM 0x20003
-#define BASS_CTYPE_MUSIC_IT 0x20004
-#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag
+#define BASS_CTYPE_SAMPLE 1
+#define BASS_CTYPE_RECORD 2
+#define BASS_CTYPE_STREAM 0x10000
+#define BASS_CTYPE_STREAM_OGG 0x10002
+#define BASS_CTYPE_STREAM_MP1 0x10003
+#define BASS_CTYPE_STREAM_MP2 0x10004
+#define BASS_CTYPE_STREAM_MP3 0x10005
+#define BASS_CTYPE_STREAM_AIFF 0x10006
+#define BASS_CTYPE_STREAM_CA 0x10007
+#define BASS_CTYPE_STREAM_MF 0x10008
+#define BASS_CTYPE_STREAM_AM 0x10009
+#define BASS_CTYPE_STREAM_DUMMY 0x18000
+#define BASS_CTYPE_STREAM_DEVICE 0x18001
+#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec
+#define BASS_CTYPE_STREAM_WAV_PCM 0x50001
+#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003
+#define BASS_CTYPE_MUSIC_MOD 0x20000
+#define BASS_CTYPE_MUSIC_MTM 0x20001
+#define BASS_CTYPE_MUSIC_S3M 0x20002
+#define BASS_CTYPE_MUSIC_XM 0x20003
+#define BASS_CTYPE_MUSIC_IT 0x20004
+#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag
typedef struct {
- DWORD ctype; // channel type
-#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
- const wchar_t *name; // format description
- const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...)
+ DWORD ctype; // channel type
+#if defined(_WIN32_WCE) || \
+ (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+ const wchar_t *name; // format description
+ const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...)
#else
- const char *name; // format description
- const char *exts; // file extension filter (*.ext1;*.ext2;etc...)
+ const char *name; // format description
+ const char *exts; // file extension filter (*.ext1;*.ext2;etc...)
#endif
} BASS_PLUGINFORM;
typedef struct {
- DWORD version; // version (same form as BASS_GetVersion)
- DWORD formatc; // number of formats
- const BASS_PLUGINFORM *formats; // the array of formats
+ DWORD version; // version (same form as BASS_GetVersion)
+ DWORD formatc; // number of formats
+ const BASS_PLUGINFORM *formats; // the array of formats
} BASS_PLUGININFO;
// 3D vector (for 3D positions/velocities/orientations)
typedef struct BASS_3DVECTOR {
#ifdef __cplusplus
- BASS_3DVECTOR() {};
- BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {};
+ BASS_3DVECTOR(){};
+ BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z){};
#endif
- float x; // +=right, -=left
- float y; // +=up, -=down
- float z; // +=front, -=behind
+ float x; // +=right, -=left
+ float y; // +=up, -=down
+ float z; // +=front, -=behind
} BASS_3DVECTOR;
// 3D channel modes
-#define BASS_3DMODE_NORMAL 0 // normal 3D processing
-#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener
-#define BASS_3DMODE_OFF 2 // no 3D processing
+#define BASS_3DMODE_NORMAL 0 // normal 3D processing
+#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener
+#define BASS_3DMODE_OFF 2 // no 3D processing
// software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM)
-#define BASS_3DALG_DEFAULT 0
-#define BASS_3DALG_OFF 1
-#define BASS_3DALG_FULL 2
-#define BASS_3DALG_LIGHT 3
+#define BASS_3DALG_DEFAULT 0
+#define BASS_3DALG_OFF 1
+#define BASS_3DALG_FULL 2
+#define BASS_3DALG_LIGHT 3
// EAX environments, use with BASS_SetEAXParameters
-enum
-{
- EAX_ENVIRONMENT_GENERIC,
- EAX_ENVIRONMENT_PADDEDCELL,
- EAX_ENVIRONMENT_ROOM,
- EAX_ENVIRONMENT_BATHROOM,
- EAX_ENVIRONMENT_LIVINGROOM,
- EAX_ENVIRONMENT_STONEROOM,
- EAX_ENVIRONMENT_AUDITORIUM,
- EAX_ENVIRONMENT_CONCERTHALL,
- EAX_ENVIRONMENT_CAVE,
- EAX_ENVIRONMENT_ARENA,
- EAX_ENVIRONMENT_HANGAR,
- EAX_ENVIRONMENT_CARPETEDHALLWAY,
- EAX_ENVIRONMENT_HALLWAY,
- EAX_ENVIRONMENT_STONECORRIDOR,
- EAX_ENVIRONMENT_ALLEY,
- EAX_ENVIRONMENT_FOREST,
- EAX_ENVIRONMENT_CITY,
- EAX_ENVIRONMENT_MOUNTAINS,
- EAX_ENVIRONMENT_QUARRY,
- EAX_ENVIRONMENT_PLAIN,
- EAX_ENVIRONMENT_PARKINGLOT,
- EAX_ENVIRONMENT_SEWERPIPE,
- EAX_ENVIRONMENT_UNDERWATER,
- EAX_ENVIRONMENT_DRUGGED,
- EAX_ENVIRONMENT_DIZZY,
- EAX_ENVIRONMENT_PSYCHOTIC,
-
- EAX_ENVIRONMENT_COUNT // total number of environments
+enum {
+ EAX_ENVIRONMENT_GENERIC,
+ EAX_ENVIRONMENT_PADDEDCELL,
+ EAX_ENVIRONMENT_ROOM,
+ EAX_ENVIRONMENT_BATHROOM,
+ EAX_ENVIRONMENT_LIVINGROOM,
+ EAX_ENVIRONMENT_STONEROOM,
+ EAX_ENVIRONMENT_AUDITORIUM,
+ EAX_ENVIRONMENT_CONCERTHALL,
+ EAX_ENVIRONMENT_CAVE,
+ EAX_ENVIRONMENT_ARENA,
+ EAX_ENVIRONMENT_HANGAR,
+ EAX_ENVIRONMENT_CARPETEDHALLWAY,
+ EAX_ENVIRONMENT_HALLWAY,
+ EAX_ENVIRONMENT_STONECORRIDOR,
+ EAX_ENVIRONMENT_ALLEY,
+ EAX_ENVIRONMENT_FOREST,
+ EAX_ENVIRONMENT_CITY,
+ EAX_ENVIRONMENT_MOUNTAINS,
+ EAX_ENVIRONMENT_QUARRY,
+ EAX_ENVIRONMENT_PLAIN,
+ EAX_ENVIRONMENT_PARKINGLOT,
+ EAX_ENVIRONMENT_SEWERPIPE,
+ EAX_ENVIRONMENT_UNDERWATER,
+ EAX_ENVIRONMENT_DRUGGED,
+ EAX_ENVIRONMENT_DIZZY,
+ EAX_ENVIRONMENT_PSYCHOTIC,
+
+ EAX_ENVIRONMENT_COUNT // total number of environments
};
// EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx)
-#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F
-#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F
-#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F
-#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F
-#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F
-#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F
-#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F
-#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F
-#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F
-#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F
-#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F
-#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F
-#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F
-#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F
-#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F
-#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F
-#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F
-#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F
-#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F
-#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F
-#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F
-#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F
-#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F
-#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F
-#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F
-#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F
-
-typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, void *user);
-/* User stream callback function. NOTE: A stream function should obviously be as quick
-as possible, other streams (and MOD musics) can't be mixed until it's finished.
-handle : The stream that needs writing
-buffer : Buffer to write the samples in
-length : Number of bytes to write
-user : The 'user' parameter value given when calling BASS_StreamCreate
-RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end the stream. */
-
-#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag
+#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC, 0.5F, 1.493F, 0.5F
+#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL, 0.25F, 0.1F, 0.0F
+#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM, 0.417F, 0.4F, 0.666F
+#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM, 0.653F, 1.499F, 0.166F
+#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM, 0.208F, 0.478F, 0.0F
+#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM, 0.5F, 2.309F, 0.888F
+#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM, 0.403F, 4.279F, 0.5F
+#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL, 0.5F, 3.961F, 0.5F
+#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE, 0.5F, 2.886F, 1.304F
+#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA, 0.361F, 7.284F, 0.332F
+#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR, 0.5F, 10.0F, 0.3F
+#define EAX_PRESET_CARPETEDHALLWAY \
+ EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153F, 0.259F, 2.0F
+#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY, 0.361F, 1.493F, 0.0F
+#define EAX_PRESET_STONECORRIDOR \
+ EAX_ENVIRONMENT_STONECORRIDOR, 0.444F, 2.697F, 0.638F
+#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY, 0.25F, 1.752F, 0.776F
+#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST, 0.111F, 3.145F, 0.472F
+#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY, 0.111F, 2.767F, 0.224F
+#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS, 0.194F, 7.841F, 0.472F
+#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY, 1.0F, 1.499F, 0.5F
+#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN, 0.097F, 2.767F, 0.224F
+#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT, 0.208F, 1.652F, 1.5F
+#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE, 0.652F, 2.886F, 0.25F
+#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER, 1.0F, 1.499F, 0.0F
+#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED, 0.875F, 8.392F, 1.388F
+#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY, 0.139F, 17.234F, 0.666F
+#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC, 0.486F, 7.563F, 0.806F
+
+typedef DWORD(CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length,
+ void *user);
+/* User stream callback function. NOTE: A stream function should obviously be as
+quick as possible, other streams (and MOD musics) can't be mixed until it's
+finished. handle : The stream that needs writing buffer : Buffer to write the
+samples in length : Number of bytes to write user : The 'user' parameter value
+given when calling BASS_StreamCreate RETURN : Number of bytes written. Set the
+BASS_STREAMPROC_END flag to end the stream. */
+
+#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag
// special STREAMPROCs
-#define STREAMPROC_DUMMY (STREAMPROC*)0 // "dummy" stream
-#define STREAMPROC_PUSH (STREAMPROC*)-1 // push stream
-#define STREAMPROC_DEVICE (STREAMPROC*)-2 // device mix stream
+#define STREAMPROC_DUMMY (STREAMPROC *)0 // "dummy" stream
+#define STREAMPROC_PUSH (STREAMPROC *)-1 // push stream
+#define STREAMPROC_DEVICE (STREAMPROC *)-2 // device mix stream
// BASS_StreamCreateFileUser file systems
-#define STREAMFILE_NOBUFFER 0
-#define STREAMFILE_BUFFER 1
-#define STREAMFILE_BUFFERPUSH 2
+#define STREAMFILE_NOBUFFER 0
+#define STREAMFILE_BUFFER 1
+#define STREAMFILE_BUFFERPUSH 2
// User file stream callback functions
-typedef void (CALLBACK FILECLOSEPROC)(void *user);
-typedef QWORD (CALLBACK FILELENPROC)(void *user);
-typedef DWORD (CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user);
-typedef BOOL (CALLBACK FILESEEKPROC)(QWORD offset, void *user);
+typedef void(CALLBACK FILECLOSEPROC)(void *user);
+typedef QWORD(CALLBACK FILELENPROC)(void *user);
+typedef DWORD(CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user);
+typedef BOOL(CALLBACK FILESEEKPROC)(QWORD offset, void *user);
typedef struct {
- FILECLOSEPROC *close;
- FILELENPROC *length;
- FILEREADPROC *read;
- FILESEEKPROC *seek;
+ FILECLOSEPROC *close;
+ FILELENPROC *length;
+ FILEREADPROC *read;
+ FILESEEKPROC *seek;
} BASS_FILEPROCS;
// BASS_StreamPutFileData options
-#define BASS_FILEDATA_END 0 // end & close the file
+#define BASS_FILEDATA_END 0 // end & close the file
// BASS_StreamGetFilePosition modes
-#define BASS_FILEPOS_CURRENT 0
-#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT
-#define BASS_FILEPOS_DOWNLOAD 1
-#define BASS_FILEPOS_END 2
-#define BASS_FILEPOS_START 3
-#define BASS_FILEPOS_CONNECTED 4
-#define BASS_FILEPOS_BUFFER 5
-#define BASS_FILEPOS_SOCKET 6
-#define BASS_FILEPOS_ASYNCBUF 7
-#define BASS_FILEPOS_SIZE 8
-#define BASS_FILEPOS_BUFFERING 9
-
-typedef void (CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user);
+#define BASS_FILEPOS_CURRENT 0
+#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT
+#define BASS_FILEPOS_DOWNLOAD 1
+#define BASS_FILEPOS_END 2
+#define BASS_FILEPOS_START 3
+#define BASS_FILEPOS_CONNECTED 4
+#define BASS_FILEPOS_BUFFER 5
+#define BASS_FILEPOS_SOCKET 6
+#define BASS_FILEPOS_ASYNCBUF 7
+#define BASS_FILEPOS_SIZE 8
+#define BASS_FILEPOS_BUFFERING 9
+
+typedef void(CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length,
+ void *user);
/* Internet stream download callback function.
buffer : Buffer containing the downloaded data... NULL=end of download
length : Number of bytes in the buffer
user : The 'user' parameter value given when calling BASS_StreamCreateURL */
// BASS_ChannelSetSync types
-#define BASS_SYNC_POS 0
-#define BASS_SYNC_END 2
-#define BASS_SYNC_META 4
-#define BASS_SYNC_SLIDE 5
-#define BASS_SYNC_STALL 6
-#define BASS_SYNC_DOWNLOAD 7
-#define BASS_SYNC_FREE 8
-#define BASS_SYNC_SETPOS 11
-#define BASS_SYNC_MUSICPOS 10
-#define BASS_SYNC_MUSICINST 1
-#define BASS_SYNC_MUSICFX 3
-#define BASS_SYNC_OGG_CHANGE 12
-#define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime
-#define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously
-
-typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, void *user);
+#define BASS_SYNC_POS 0
+#define BASS_SYNC_END 2
+#define BASS_SYNC_META 4
+#define BASS_SYNC_SLIDE 5
+#define BASS_SYNC_STALL 6
+#define BASS_SYNC_DOWNLOAD 7
+#define BASS_SYNC_FREE 8
+#define BASS_SYNC_SETPOS 11
+#define BASS_SYNC_MUSICPOS 10
+#define BASS_SYNC_MUSICINST 1
+#define BASS_SYNC_MUSICFX 3
+#define BASS_SYNC_OGG_CHANGE 12
+#define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime
+#define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously
+
+typedef void(CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data,
+ void *user);
/* Sync callback function. NOTE: a sync callback function should be very
quick as other syncs can't be processed until it has finished. If the sync
is a "mixtime" sync, then other streams and MOD musics can't be mixed until
@@ -574,7 +598,8 @@ channel: Channel that the sync occured in
data : Additional data associated with the sync's occurance
user : The 'user' parameter given when calling BASS_ChannelSetSync */
-typedef void (CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer, DWORD length, void *user);
+typedef void(CALLBACK DSPPROC)(HDSP handle, DWORD channel, void *buffer,
+ DWORD length, void *user);
/* DSP callback function. NOTE: A DSP function should obviously be as quick as
possible... other DSP functions, streams and MOD musics can not be processed
until it's finished.
@@ -584,7 +609,8 @@ buffer : Buffer to apply the DSP to
length : Number of bytes in the buffer
user : The 'user' parameter given when calling BASS_ChannelSetDSP */
-typedef BOOL (CALLBACK RECORDPROC)(HRECORD handle, const void *buffer, DWORD length, void *user);
+typedef BOOL(CALLBACK RECORDPROC)(HRECORD handle, const void *buffer,
+ DWORD length, void *user);
/* Recording callback function.
handle : The recording handle
buffer : Buffer containing the recorded sample data
@@ -593,394 +619,398 @@ user : The 'user' parameter value given when calling BASS_RecordStart
RETURN : TRUE = continue recording, FALSE = stop */
// BASS_ChannelIsActive return values
-#define BASS_ACTIVE_STOPPED 0
-#define BASS_ACTIVE_PLAYING 1
-#define BASS_ACTIVE_STALLED 2
-#define BASS_ACTIVE_PAUSED 3
+#define BASS_ACTIVE_STOPPED 0
+#define BASS_ACTIVE_PLAYING 1
+#define BASS_ACTIVE_STALLED 2
+#define BASS_ACTIVE_PAUSED 3
// Channel attributes
-#define BASS_ATTRIB_FREQ 1
-#define BASS_ATTRIB_VOL 2
-#define BASS_ATTRIB_PAN 3
-#define BASS_ATTRIB_EAXMIX 4
-#define BASS_ATTRIB_NOBUFFER 5
-#define BASS_ATTRIB_VBR 6
-#define BASS_ATTRIB_CPU 7
-#define BASS_ATTRIB_SRC 8
-#define BASS_ATTRIB_NET_RESUME 9
-#define BASS_ATTRIB_SCANINFO 10
-#define BASS_ATTRIB_NORAMP 11
-#define BASS_ATTRIB_BITRATE 12
-#define BASS_ATTRIB_BUFFER 13
-#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100
-#define BASS_ATTRIB_MUSIC_PANSEP 0x101
-#define BASS_ATTRIB_MUSIC_PSCALER 0x102
-#define BASS_ATTRIB_MUSIC_BPM 0x103
-#define BASS_ATTRIB_MUSIC_SPEED 0x104
+#define BASS_ATTRIB_FREQ 1
+#define BASS_ATTRIB_VOL 2
+#define BASS_ATTRIB_PAN 3
+#define BASS_ATTRIB_EAXMIX 4
+#define BASS_ATTRIB_NOBUFFER 5
+#define BASS_ATTRIB_VBR 6
+#define BASS_ATTRIB_CPU 7
+#define BASS_ATTRIB_SRC 8
+#define BASS_ATTRIB_NET_RESUME 9
+#define BASS_ATTRIB_SCANINFO 10
+#define BASS_ATTRIB_NORAMP 11
+#define BASS_ATTRIB_BITRATE 12
+#define BASS_ATTRIB_BUFFER 13
+#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100
+#define BASS_ATTRIB_MUSIC_PANSEP 0x101
+#define BASS_ATTRIB_MUSIC_PSCALER 0x102
+#define BASS_ATTRIB_MUSIC_BPM 0x103
+#define BASS_ATTRIB_MUSIC_SPEED 0x104
#define BASS_ATTRIB_MUSIC_VOL_GLOBAL 0x105
-#define BASS_ATTRIB_MUSIC_ACTIVE 0x106
-#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel #
-#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument #
+#define BASS_ATTRIB_MUSIC_ACTIVE 0x106
+#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel #
+#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument #
// BASS_ChannelSlideAttribute flags
-#define BASS_SLIDE_LOG 0x1000000
+#define BASS_SLIDE_LOG 0x1000000
// BASS_ChannelGetData flags
-#define BASS_DATA_AVAILABLE 0 // query how much data is buffered
-#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data
-#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data
-#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT
-#define BASS_DATA_FFT512 0x80000001 // 512 FFT
-#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT
-#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT
-#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT
-#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT
-#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT
-#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT
-#define BASS_DATA_FFT_INDIVIDUAL 0x10 // FFT flag: FFT for each channel, else all combined
-#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window
-#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias
-#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data
+#define BASS_DATA_AVAILABLE 0 // query how much data is buffered
+#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data
+#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data
+#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT
+#define BASS_DATA_FFT512 0x80000001 // 512 FFT
+#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT
+#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT
+#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT
+#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT
+#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT
+#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT
+#define BASS_DATA_FFT_INDIVIDUAL \
+ 0x10 // FFT flag: FFT for each channel, else all combined
+#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window
+#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias
+#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data
// BASS_ChannelGetLevelEx flags
-#define BASS_LEVEL_MONO 1
-#define BASS_LEVEL_STEREO 2
-#define BASS_LEVEL_RMS 4
-#define BASS_LEVEL_VOLPAN 8
+#define BASS_LEVEL_MONO 1
+#define BASS_LEVEL_STEREO 2
+#define BASS_LEVEL_RMS 4
+#define BASS_LEVEL_VOLPAN 8
// BASS_ChannelGetTags types : what's returned
-#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure
-#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block
-#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings
-#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings
-#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings
-#define BASS_TAG_META 5 // ICY metadata : ANSI string
-#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings
-#define BASS_TAG_MP4 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings
-#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings
-#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string
-#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string
-#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure
-#define BASS_TAG_MF 13 // Media Foundation tags : series of null-terminated UTF-8 strings
-#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure
-#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string
-#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string
-#define BASS_TAG_RIFF_INFO 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings
-#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure
-#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure
-#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string
-#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure
-#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure
-#define BASS_TAG_APE_BINARY 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure
-#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string
-#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string
-#define BASS_TAG_MUSIC_ORDERS 0x10002 // MOD order list : BYTE array of pattern numbers
-#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string
-#define BASS_TAG_MUSIC_INST 0x10100 // + instrument #, MOD instrument name : ANSI string
-#define BASS_TAG_MUSIC_SAMPLE 0x10300 // + sample #, MOD sample name : ANSI string
-
+#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure
+#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block
+#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings
+#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings
+#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings
+#define BASS_TAG_META 5 // ICY metadata : ANSI string
+#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings
+#define BASS_TAG_MP4 \
+ 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings
+#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings
+#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string
+#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string
+#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure
+#define BASS_TAG_MF \
+ 13 // Media Foundation tags : series of null-terminated UTF-8 strings
+#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure
+#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string
+#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string
+#define BASS_TAG_RIFF_INFO \
+ 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings
+#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure
+#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure
+#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string
+#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure
+#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure
+#define BASS_TAG_APE_BINARY \
+ 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure
+#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string
+#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string
+#define BASS_TAG_MUSIC_ORDERS \
+ 0x10002 // MOD order list : BYTE array of pattern numbers
+#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string
+#define BASS_TAG_MUSIC_INST \
+ 0x10100 // + instrument #, MOD instrument name : ANSI string
+#define BASS_TAG_MUSIC_SAMPLE \
+ 0x10300 // + sample #, MOD sample name : ANSI string
+
// ID3v1 tag structure
typedef struct {
- char id[3];
- char title[30];
- char artist[30];
- char album[30];
- char year[4];
- char comment[30];
- BYTE genre;
+ char id[3];
+ char title[30];
+ char artist[30];
+ char album[30];
+ char year[4];
+ char comment[30];
+ BYTE genre;
} TAG_ID3;
-
+
// Binary APE tag structure
-typedef struct {
- const char *key;
- const void *data;
- DWORD length;
-} TAG_APE_BINARY;
-
-// BWF "bext" tag structure
+typedef struct {
+ const char *key;
+ const void *data;
+ DWORD length;
+} TAG_APE_BINARY;
+
+// BWF "bext" tag structure
#ifdef _MSC_VER
#pragma warning(push)
-#pragma warning(disable:4200)
+#pragma warning(disable : 4200)
#endif
-#pragma pack(push,1)
+#pragma pack(push, 1)
typedef struct {
- char Description[256]; // description
- char Originator[32]; // name of the originator
- char OriginatorReference[32]; // reference of the originator
- char OriginationDate[10]; // date of creation (yyyy-mm-dd)
- char OriginationTime[8]; // time of creation (hh-mm-ss)
- QWORD TimeReference; // first sample count since midnight (little-endian)
- WORD Version; // BWF version (little-endian)
- BYTE UMID[64]; // SMPTE UMID
- BYTE Reserved[190];
-#if defined(__GNUC__) && __GNUC__<3
- char CodingHistory[0]; // history
-#elif 1 // change to 0 if compiler fails the following line
- char CodingHistory[]; // history
+ char Description[256]; // description
+ char Originator[32]; // name of the originator
+ char OriginatorReference[32]; // reference of the originator
+ char OriginationDate[10]; // date of creation (yyyy-mm-dd)
+ char OriginationTime[8]; // time of creation (hh-mm-ss)
+ QWORD TimeReference; // first sample count since midnight (little-endian)
+ WORD Version; // BWF version (little-endian)
+ BYTE UMID[64]; // SMPTE UMID
+ BYTE Reserved[190];
+#if defined(__GNUC__) && __GNUC__ < 3
+ char CodingHistory[0]; // history
+#elif 1 // change to 0 if compiler fails the following line
+ char CodingHistory[]; // history
#else
- char CodingHistory[1]; // history
+ char CodingHistory[1]; // history
#endif
} TAG_BEXT;
-#pragma pack(pop)
-
-// BWF "cart" tag structures
-typedef struct
-{
- DWORD dwUsage; // FOURCC timer usage ID
- DWORD dwValue; // timer value in samples from head
-} TAG_CART_TIMER;
-
-typedef struct
-{
- char Version[4]; // version of the data structure
- char Title[64]; // title of cart audio sequence
- char Artist[64]; // artist or creator name
- char CutID[64]; // cut number identification
- char ClientID[64]; // client identification
- char Category[64]; // category ID, PSA, NEWS, etc
- char Classification[64]; // classification or auxiliary key
- char OutCue[64]; // out cue text
- char StartDate[10]; // yyyy-mm-dd
- char StartTime[8]; // hh:mm:ss
- char EndDate[10]; // yyyy-mm-dd
- char EndTime[8]; // hh:mm:ss
- char ProducerAppID[64]; // name of vendor or application
- char ProducerAppVersion[64]; // version of producer application
- char UserDef[64]; // user defined text
- DWORD dwLevelReference; // sample value for 0 dB reference
- TAG_CART_TIMER PostTimer[8]; // 8 time markers after head
- char Reserved[276];
- char URL[1024]; // uniform resource locator
-#if defined(__GNUC__) && __GNUC__<3
- char TagText[0]; // free form text for scripts or tags
-#elif 1 // change to 0 if compiler fails the following line
- char TagText[]; // free form text for scripts or tags
-#else
- char TagText[1]; // free form text for scripts or tags
-#endif
-} TAG_CART;
-
-// RIFF "cue " tag structures
-typedef struct
-{
- DWORD dwName;
- DWORD dwPosition;
- DWORD fccChunk;
- DWORD dwChunkStart;
- DWORD dwBlockStart;
- DWORD dwSampleOffset;
-} TAG_CUE_POINT;
-
-typedef struct
-{
- DWORD dwCuePoints;
-#if defined(__GNUC__) && __GNUC__<3
- TAG_CUE_POINT CuePoints[0];
-#elif 1 // change to 0 if compiler fails the following line
- TAG_CUE_POINT CuePoints[];
-#else
- TAG_CUE_POINT CuePoints[1];
-#endif
-} TAG_CUE;
-
-// RIFF "smpl" tag structures
-typedef struct
-{
- DWORD dwIdentifier;
- DWORD dwType;
- DWORD dwStart;
- DWORD dwEnd;
- DWORD dwFraction;
- DWORD dwPlayCount;
-} TAG_SMPL_LOOP;
-
-typedef struct
-{
- DWORD dwManufacturer;
- DWORD dwProduct;
- DWORD dwSamplePeriod;
- DWORD dwMIDIUnityNote;
- DWORD dwMIDIPitchFraction;
- DWORD dwSMPTEFormat;
- DWORD dwSMPTEOffset;
- DWORD cSampleLoops;
- DWORD cbSamplerData;
-#if defined(__GNUC__) && __GNUC__<3
- TAG_SMPL_LOOP SampleLoops[0];
-#elif 1 // change to 0 if compiler fails the following line
- TAG_SMPL_LOOP SampleLoops[];
-#else
- TAG_SMPL_LOOP SampleLoops[1];
-#endif
-} TAG_SMPL;
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
+#pragma pack(pop)
+
+// BWF "cart" tag structures
+typedef struct {
+ DWORD dwUsage; // FOURCC timer usage ID
+ DWORD dwValue; // timer value in samples from head
+} TAG_CART_TIMER;
+
+typedef struct {
+ char Version[4]; // version of the data structure
+ char Title[64]; // title of cart audio sequence
+ char Artist[64]; // artist or creator name
+ char CutID[64]; // cut number identification
+ char ClientID[64]; // client identification
+ char Category[64]; // category ID, PSA, NEWS, etc
+ char Classification[64]; // classification or auxiliary key
+ char OutCue[64]; // out cue text
+ char StartDate[10]; // yyyy-mm-dd
+ char StartTime[8]; // hh:mm:ss
+ char EndDate[10]; // yyyy-mm-dd
+ char EndTime[8]; // hh:mm:ss
+ char ProducerAppID[64]; // name of vendor or application
+ char ProducerAppVersion[64]; // version of producer application
+ char UserDef[64]; // user defined text
+ DWORD dwLevelReference; // sample value for 0 dB reference
+ TAG_CART_TIMER PostTimer[8]; // 8 time markers after head
+ char Reserved[276];
+ char URL[1024]; // uniform resource locator
+#if defined(__GNUC__) && __GNUC__ < 3
+ char TagText[0]; // free form text for scripts or tags
+#elif 1 // change to 0 if compiler fails the following line
+ char TagText[]; // free form text for scripts or tags
+#else
+ char TagText[1]; // free form text for scripts or tags
+#endif
+} TAG_CART;
+
+// RIFF "cue " tag structures
+typedef struct {
+ DWORD dwName;
+ DWORD dwPosition;
+ DWORD fccChunk;
+ DWORD dwChunkStart;
+ DWORD dwBlockStart;
+ DWORD dwSampleOffset;
+} TAG_CUE_POINT;
+
+typedef struct {
+ DWORD dwCuePoints;
+#if defined(__GNUC__) && __GNUC__ < 3
+ TAG_CUE_POINT CuePoints[0];
+#elif 1 // change to 0 if compiler fails the following line
+ TAG_CUE_POINT CuePoints[];
+#else
+ TAG_CUE_POINT CuePoints[1];
+#endif
+} TAG_CUE;
+
+// RIFF "smpl" tag structures
+typedef struct {
+ DWORD dwIdentifier;
+ DWORD dwType;
+ DWORD dwStart;
+ DWORD dwEnd;
+ DWORD dwFraction;
+ DWORD dwPlayCount;
+} TAG_SMPL_LOOP;
+
+typedef struct {
+ DWORD dwManufacturer;
+ DWORD dwProduct;
+ DWORD dwSamplePeriod;
+ DWORD dwMIDIUnityNote;
+ DWORD dwMIDIPitchFraction;
+ DWORD dwSMPTEFormat;
+ DWORD dwSMPTEOffset;
+ DWORD cSampleLoops;
+ DWORD cbSamplerData;
+#if defined(__GNUC__) && __GNUC__ < 3
+ TAG_SMPL_LOOP SampleLoops[0];
+#elif 1 // change to 0 if compiler fails the following line
+ TAG_SMPL_LOOP SampleLoops[];
+#else
+ TAG_SMPL_LOOP SampleLoops[1];
+#endif
+} TAG_SMPL;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
// CoreAudio codec info structure
typedef struct {
- DWORD ftype; // file format
- DWORD atype; // audio format
- const char *name; // description
+ DWORD ftype; // file format
+ DWORD atype; // audio format
+ const char *name; // description
} TAG_CA_CODEC;
-#ifndef _WAVEFORMATEX_
-#define _WAVEFORMATEX_
-#pragma pack(push,1)
-typedef struct tWAVEFORMATEX
-{
- WORD wFormatTag;
- WORD nChannels;
- DWORD nSamplesPerSec;
- DWORD nAvgBytesPerSec;
- WORD nBlockAlign;
- WORD wBitsPerSample;
- WORD cbSize;
-} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX;
-typedef const WAVEFORMATEX *LPCWAVEFORMATEX;
-#pragma pack(pop)
-#endif
-
+#ifndef _WAVEFORMATEX_
+#define _WAVEFORMATEX_
+#pragma pack(push, 1)
+typedef struct tWAVEFORMATEX {
+ WORD wFormatTag;
+ WORD nChannels;
+ DWORD nSamplesPerSec;
+ DWORD nAvgBytesPerSec;
+ WORD nBlockAlign;
+ WORD wBitsPerSample;
+ WORD cbSize;
+} WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX;
+typedef const WAVEFORMATEX *LPCWAVEFORMATEX;
+#pragma pack(pop)
+#endif
+
// BASS_ChannelGetLength/GetPosition/SetPosition modes
-#define BASS_POS_BYTE 0 // byte position
-#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row)
-#define BASS_POS_OGG 3 // OGG bitstream number
-#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers
-#define BASS_POS_RELATIVE 0x4000000 // flag: seek relative to the current position
-#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position
-#define BASS_POS_DECODE 0x10000000 // flag: get the decoding (not playing) position
-#define BASS_POS_DECODETO 0x20000000 // flag: decode to the position instead of seeking
-#define BASS_POS_SCAN 0x40000000 // flag: scan to the position
+#define BASS_POS_BYTE 0 // byte position
+#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row)
+#define BASS_POS_OGG 3 // OGG bitstream number
+#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers
+#define BASS_POS_RELATIVE \
+ 0x4000000 // flag: seek relative to the current position
+#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position
+#define BASS_POS_DECODE \
+ 0x10000000 // flag: get the decoding (not playing) position
+#define BASS_POS_DECODETO \
+ 0x20000000 // flag: decode to the position instead of seeking
+#define BASS_POS_SCAN 0x40000000 // flag: scan to the position
// BASS_ChannelSetDevice/GetDevice option
-#define BASS_NODEVICE 0x20000
+#define BASS_NODEVICE 0x20000
// BASS_RecordSetInput flags
-#define BASS_INPUT_OFF 0x10000
-#define BASS_INPUT_ON 0x20000
-
-#define BASS_INPUT_TYPE_MASK 0xff000000
-#define BASS_INPUT_TYPE_UNDEF 0x00000000
-#define BASS_INPUT_TYPE_DIGITAL 0x01000000
-#define BASS_INPUT_TYPE_LINE 0x02000000
-#define BASS_INPUT_TYPE_MIC 0x03000000
-#define BASS_INPUT_TYPE_SYNTH 0x04000000
-#define BASS_INPUT_TYPE_CD 0x05000000
-#define BASS_INPUT_TYPE_PHONE 0x06000000
-#define BASS_INPUT_TYPE_SPEAKER 0x07000000
-#define BASS_INPUT_TYPE_WAVE 0x08000000
-#define BASS_INPUT_TYPE_AUX 0x09000000
-#define BASS_INPUT_TYPE_ANALOG 0x0a000000
+#define BASS_INPUT_OFF 0x10000
+#define BASS_INPUT_ON 0x20000
+
+#define BASS_INPUT_TYPE_MASK 0xff000000
+#define BASS_INPUT_TYPE_UNDEF 0x00000000
+#define BASS_INPUT_TYPE_DIGITAL 0x01000000
+#define BASS_INPUT_TYPE_LINE 0x02000000
+#define BASS_INPUT_TYPE_MIC 0x03000000
+#define BASS_INPUT_TYPE_SYNTH 0x04000000
+#define BASS_INPUT_TYPE_CD 0x05000000
+#define BASS_INPUT_TYPE_PHONE 0x06000000
+#define BASS_INPUT_TYPE_SPEAKER 0x07000000
+#define BASS_INPUT_TYPE_WAVE 0x08000000
+#define BASS_INPUT_TYPE_AUX 0x09000000
+#define BASS_INPUT_TYPE_ANALOG 0x0a000000
// BASS_ChannelSetFX effect types
-#define BASS_FX_DX8_CHORUS 0
-#define BASS_FX_DX8_COMPRESSOR 1
-#define BASS_FX_DX8_DISTORTION 2
-#define BASS_FX_DX8_ECHO 3
-#define BASS_FX_DX8_FLANGER 4
-#define BASS_FX_DX8_GARGLE 5
-#define BASS_FX_DX8_I3DL2REVERB 6
-#define BASS_FX_DX8_PARAMEQ 7
-#define BASS_FX_DX8_REVERB 8
-#define BASS_FX_VOLUME 9
+#define BASS_FX_DX8_CHORUS 0
+#define BASS_FX_DX8_COMPRESSOR 1
+#define BASS_FX_DX8_DISTORTION 2
+#define BASS_FX_DX8_ECHO 3
+#define BASS_FX_DX8_FLANGER 4
+#define BASS_FX_DX8_GARGLE 5
+#define BASS_FX_DX8_I3DL2REVERB 6
+#define BASS_FX_DX8_PARAMEQ 7
+#define BASS_FX_DX8_REVERB 8
+#define BASS_FX_VOLUME 9
typedef struct {
- float fWetDryMix;
- float fDepth;
- float fFeedback;
- float fFrequency;
- DWORD lWaveform; // 0=triangle, 1=sine
- float fDelay;
- DWORD lPhase; // BASS_DX8_PHASE_xxx
+ float fWetDryMix;
+ float fDepth;
+ float fFeedback;
+ float fFrequency;
+ DWORD lWaveform; // 0=triangle, 1=sine
+ float fDelay;
+ DWORD lPhase; // BASS_DX8_PHASE_xxx
} BASS_DX8_CHORUS;
typedef struct {
- float fGain;
- float fAttack;
- float fRelease;
- float fThreshold;
- float fRatio;
- float fPredelay;
+ float fGain;
+ float fAttack;
+ float fRelease;
+ float fThreshold;
+ float fRatio;
+ float fPredelay;
} BASS_DX8_COMPRESSOR;
typedef struct {
- float fGain;
- float fEdge;
- float fPostEQCenterFrequency;
- float fPostEQBandwidth;
- float fPreLowpassCutoff;
+ float fGain;
+ float fEdge;
+ float fPostEQCenterFrequency;
+ float fPostEQBandwidth;
+ float fPreLowpassCutoff;
} BASS_DX8_DISTORTION;
typedef struct {
- float fWetDryMix;
- float fFeedback;
- float fLeftDelay;
- float fRightDelay;
- BOOL lPanDelay;
+ float fWetDryMix;
+ float fFeedback;
+ float fLeftDelay;
+ float fRightDelay;
+ BOOL lPanDelay;
} BASS_DX8_ECHO;
typedef struct {
- float fWetDryMix;
- float fDepth;
- float fFeedback;
- float fFrequency;
- DWORD lWaveform; // 0=triangle, 1=sine
- float fDelay;
- DWORD lPhase; // BASS_DX8_PHASE_xxx
+ float fWetDryMix;
+ float fDepth;
+ float fFeedback;
+ float fFrequency;
+ DWORD lWaveform; // 0=triangle, 1=sine
+ float fDelay;
+ DWORD lPhase; // BASS_DX8_PHASE_xxx
} BASS_DX8_FLANGER;
typedef struct {
- DWORD dwRateHz; // Rate of modulation in hz
- DWORD dwWaveShape; // 0=triangle, 1=square
+ DWORD dwRateHz; // Rate of modulation in hz
+ DWORD dwWaveShape; // 0=triangle, 1=square
} BASS_DX8_GARGLE;
typedef struct {
- int lRoom; // [-10000, 0] default: -1000 mB
- int lRoomHF; // [-10000, 0] default: 0 mB
- float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0
- float flDecayTime; // [0.1, 20.0] default: 1.49s
- float flDecayHFRatio; // [0.1, 2.0] default: 0.83
- int lReflections; // [-10000, 1000] default: -2602 mB
- float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s
- int lReverb; // [-10000, 2000] default: 200 mB
- float flReverbDelay; // [0.0, 0.1] default: 0.011 s
- float flDiffusion; // [0.0, 100.0] default: 100.0 %
- float flDensity; // [0.0, 100.0] default: 100.0 %
- float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz
+ int lRoom; // [-10000, 0] default: -1000 mB
+ int lRoomHF; // [-10000, 0] default: 0 mB
+ float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0
+ float flDecayTime; // [0.1, 20.0] default: 1.49s
+ float flDecayHFRatio; // [0.1, 2.0] default: 0.83
+ int lReflections; // [-10000, 1000] default: -2602 mB
+ float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s
+ int lReverb; // [-10000, 2000] default: 200 mB
+ float flReverbDelay; // [0.0, 0.1] default: 0.011 s
+ float flDiffusion; // [0.0, 100.0] default: 100.0 %
+ float flDensity; // [0.0, 100.0] default: 100.0 %
+ float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz
} BASS_DX8_I3DL2REVERB;
typedef struct {
- float fCenter;
- float fBandwidth;
- float fGain;
+ float fCenter;
+ float fBandwidth;
+ float fGain;
} BASS_DX8_PARAMEQ;
typedef struct {
- float fInGain; // [-96.0,0.0] default: 0.0 dB
- float fReverbMix; // [-96.0,0.0] default: 0.0 db
- float fReverbTime; // [0.001,3000.0] default: 1000.0 ms
- float fHighFreqRTRatio; // [0.001,0.999] default: 0.001
+ float fInGain; // [-96.0,0.0] default: 0.0 dB
+ float fReverbMix; // [-96.0,0.0] default: 0.0 db
+ float fReverbTime; // [0.001,3000.0] default: 1000.0 ms
+ float fHighFreqRTRatio; // [0.001,0.999] default: 0.001
} BASS_DX8_REVERB;
-#define BASS_DX8_PHASE_NEG_180 0
-#define BASS_DX8_PHASE_NEG_90 1
-#define BASS_DX8_PHASE_ZERO 2
-#define BASS_DX8_PHASE_90 3
-#define BASS_DX8_PHASE_180 4
-
+#define BASS_DX8_PHASE_NEG_180 0
+#define BASS_DX8_PHASE_NEG_90 1
+#define BASS_DX8_PHASE_ZERO 2
+#define BASS_DX8_PHASE_90 3
+#define BASS_DX8_PHASE_180 4
+
typedef struct {
- float fTarget;
- float fCurrent;
- float fTime;
- DWORD lCurve;
+ float fTarget;
+ float fCurrent;
+ float fTime;
+ DWORD lCurve;
} BASS_FX_VOLUME_PARAM;
-
-typedef void (CALLBACK IOSNOTIFYPROC)(DWORD status);
-/* iOS notification callback function.
-status : The notification (BASS_IOSNOTIFY_xxx) */
-
-#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started
-#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended
+
+typedef void(CALLBACK IOSNOTIFYPROC)(DWORD status);
+/* iOS notification callback function.
+status : The notification (BASS_IOSNOTIFY_xxx) */
+
+#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started
+#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended
BOOL BASSDEF(BASS_SetConfig)(DWORD option, DWORD value);
DWORD BASSDEF(BASS_GetConfig)(DWORD option);
@@ -989,15 +1019,19 @@ void *BASSDEF(BASS_GetConfigPtr)(DWORD option);
DWORD BASSDEF(BASS_GetVersion)();
int BASSDEF(BASS_ErrorGetCode)();
BOOL BASSDEF(BASS_GetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info);
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
-BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win, const GUID *dsguid);
+#if defined(_WIN32) && !defined(_WIN32_WCE) && \
+ !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, HWND win,
+ const GUID *dsguid);
#else
-BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win, void *dsguid);
+BOOL BASSDEF(BASS_Init)(int device, DWORD freq, DWORD flags, void *win,
+ void *dsguid);
#endif
BOOL BASSDEF(BASS_SetDevice)(DWORD device);
DWORD BASSDEF(BASS_GetDevice)();
BOOL BASSDEF(BASS_Free)();
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
+#if defined(_WIN32) && !defined(_WIN32_WCE) && \
+ !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
void *BASSDEF(BASS_GetDSoundObject)(DWORD object);
#endif
BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info);
@@ -1015,19 +1049,29 @@ const BASS_PLUGININFO *BASSDEF(BASS_PluginGetInfo)(HPLUGIN handle);
BOOL BASSDEF(BASS_Set3DFactors)(float distf, float rollf, float doppf);
BOOL BASSDEF(BASS_Get3DFactors)(float *distf, float *rollf, float *doppf);
-BOOL BASSDEF(BASS_Set3DPosition)(const BASS_3DVECTOR *pos, const BASS_3DVECTOR *vel, const BASS_3DVECTOR *front, const BASS_3DVECTOR *top);
-BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel, BASS_3DVECTOR *front, BASS_3DVECTOR *top);
+BOOL BASSDEF(BASS_Set3DPosition)(const BASS_3DVECTOR *pos,
+ const BASS_3DVECTOR *vel,
+ const BASS_3DVECTOR *front,
+ const BASS_3DVECTOR *top);
+BOOL BASSDEF(BASS_Get3DPosition)(BASS_3DVECTOR *pos, BASS_3DVECTOR *vel,
+ BASS_3DVECTOR *front, BASS_3DVECTOR *top);
void BASSDEF(BASS_Apply3D)();
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !(WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
-BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay, float damp);
-BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay, float *damp);
+#if defined(_WIN32) && !defined(_WIN32_WCE) && \
+ !(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+BOOL BASSDEF(BASS_SetEAXParameters)(int env, float vol, float decay,
+ float damp);
+BOOL BASSDEF(BASS_GetEAXParameters)(DWORD *env, float *vol, float *decay,
+ float *damp);
#endif
-HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD flags, DWORD freq);
+HMUSIC BASSDEF(BASS_MusicLoad)(BOOL mem, const void *file, QWORD offset,
+ DWORD length, DWORD flags, DWORD freq);
BOOL BASSDEF(BASS_MusicFree)(HMUSIC handle);
-HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, const void *file, QWORD offset, DWORD length, DWORD max, DWORD flags);
-HSAMPLE BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD chans, DWORD max, DWORD flags);
+HSAMPLE BASSDEF(BASS_SampleLoad)(BOOL mem, const void *file, QWORD offset,
+ DWORD length, DWORD max, DWORD flags);
+HSAMPLE BASSDEF(BASS_SampleCreate)(DWORD length, DWORD freq, DWORD chans,
+ DWORD max, DWORD flags);
BOOL BASSDEF(BASS_SampleFree)(HSAMPLE handle);
BOOL BASSDEF(BASS_SampleSetData)(HSAMPLE handle, const void *buffer);
BOOL BASSDEF(BASS_SampleGetData)(HSAMPLE handle, void *buffer);
@@ -1037,14 +1081,22 @@ HCHANNEL BASSDEF(BASS_SampleGetChannel)(HSAMPLE handle, BOOL onlynew);
DWORD BASSDEF(BASS_SampleGetChannels)(HSAMPLE handle, HCHANNEL *channels);
BOOL BASSDEF(BASS_SampleStop)(HSAMPLE handle);
-HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags, STREAMPROC *proc, void *user);
-HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset, QWORD length, DWORD flags);
-HSTREAM BASSDEF(BASS_StreamCreateURL)(const char *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user);
-HSTREAM BASSDEF(BASS_StreamCreateFileUser)(DWORD system, DWORD flags, const BASS_FILEPROCS *proc, void *user);
+HSTREAM BASSDEF(BASS_StreamCreate)(DWORD freq, DWORD chans, DWORD flags,
+ STREAMPROC *proc, void *user);
+HSTREAM BASSDEF(BASS_StreamCreateFile)(BOOL mem, const void *file, QWORD offset,
+ QWORD length, DWORD flags);
+HSTREAM BASSDEF(BASS_StreamCreateURL)(const char *url, DWORD offset,
+ DWORD flags, DOWNLOADPROC *proc,
+ void *user);
+HSTREAM BASSDEF(BASS_StreamCreateFileUser)(DWORD system, DWORD flags,
+ const BASS_FILEPROCS *proc,
+ void *user);
BOOL BASSDEF(BASS_StreamFree)(HSTREAM handle);
QWORD BASSDEF(BASS_StreamGetFilePosition)(HSTREAM handle, DWORD mode);
-DWORD BASSDEF(BASS_StreamPutData)(HSTREAM handle, const void *buffer, DWORD length);
-DWORD BASSDEF(BASS_StreamPutFileData)(HSTREAM handle, const void *buffer, DWORD length);
+DWORD BASSDEF(BASS_StreamPutData)(HSTREAM handle, const void *buffer,
+ DWORD length);
+DWORD BASSDEF(BASS_StreamPutFileData)(HSTREAM handle, const void *buffer,
+ DWORD length);
BOOL BASSDEF(BASS_RecordGetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info);
BOOL BASSDEF(BASS_RecordInit)(int device);
@@ -1055,7 +1107,8 @@ BOOL BASSDEF(BASS_RecordGetInfo)(BASS_RECORDINFO *info);
const char *BASSDEF(BASS_RecordGetInputName)(int input);
BOOL BASSDEF(BASS_RecordSetInput)(int input, DWORD flags, float volume);
DWORD BASSDEF(BASS_RecordGetInput)(int input, float *volume);
-HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags, RECORDPROC *proc, void *user);
+HRECORD BASSDEF(BASS_RecordStart)(DWORD freq, DWORD chans, DWORD flags,
+ RECORDPROC *proc, void *user);
double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos);
QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, double pos);
@@ -1071,24 +1124,39 @@ BOOL BASSDEF(BASS_ChannelPlay)(DWORD handle, BOOL restart);
BOOL BASSDEF(BASS_ChannelStop)(DWORD handle);
BOOL BASSDEF(BASS_ChannelPause)(DWORD handle);
BOOL BASSDEF(BASS_ChannelSetAttribute)(DWORD handle, DWORD attrib, float value);
-BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib, float *value);
-BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib, float value, DWORD time);
+BOOL BASSDEF(BASS_ChannelGetAttribute)(DWORD handle, DWORD attrib,
+ float *value);
+BOOL BASSDEF(BASS_ChannelSlideAttribute)(DWORD handle, DWORD attrib,
+ float value, DWORD time);
BOOL BASSDEF(BASS_ChannelIsSliding)(DWORD handle, DWORD attrib);
-BOOL BASSDEF(BASS_ChannelSetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size);
-DWORD BASSDEF(BASS_ChannelGetAttributeEx)(DWORD handle, DWORD attrib, void *value, DWORD size);
-BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min, float max, int iangle, int oangle, float outvol);
-BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min, float *max, DWORD *iangle, DWORD *oangle, float *outvol);
-BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos, const BASS_3DVECTOR *orient, const BASS_3DVECTOR *vel);
-BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos, BASS_3DVECTOR *orient, BASS_3DVECTOR *vel);
+BOOL BASSDEF(BASS_ChannelSetAttributeEx)(DWORD handle, DWORD attrib,
+ void *value, DWORD size);
+DWORD BASSDEF(BASS_ChannelGetAttributeEx)(DWORD handle, DWORD attrib,
+ void *value, DWORD size);
+BOOL BASSDEF(BASS_ChannelSet3DAttributes)(DWORD handle, int mode, float min,
+ float max, int iangle, int oangle,
+ float outvol);
+BOOL BASSDEF(BASS_ChannelGet3DAttributes)(DWORD handle, DWORD *mode, float *min,
+ float *max, DWORD *iangle,
+ DWORD *oangle, float *outvol);
+BOOL BASSDEF(BASS_ChannelSet3DPosition)(DWORD handle, const BASS_3DVECTOR *pos,
+ const BASS_3DVECTOR *orient,
+ const BASS_3DVECTOR *vel);
+BOOL BASSDEF(BASS_ChannelGet3DPosition)(DWORD handle, BASS_3DVECTOR *pos,
+ BASS_3DVECTOR *orient,
+ BASS_3DVECTOR *vel);
QWORD BASSDEF(BASS_ChannelGetLength)(DWORD handle, DWORD mode);
BOOL BASSDEF(BASS_ChannelSetPosition)(DWORD handle, QWORD pos, DWORD mode);
QWORD BASSDEF(BASS_ChannelGetPosition)(DWORD handle, DWORD mode);
DWORD BASSDEF(BASS_ChannelGetLevel)(DWORD handle);
-BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length, DWORD flags);
+BOOL BASSDEF(BASS_ChannelGetLevelEx)(DWORD handle, float *levels, float length,
+ DWORD flags);
DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length);
-HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param, SYNCPROC *proc, void *user);
+HSYNC BASSDEF(BASS_ChannelSetSync)(DWORD handle, DWORD type, QWORD param,
+ SYNCPROC *proc, void *user);
BOOL BASSDEF(BASS_ChannelRemoveSync)(DWORD handle, HSYNC sync);
-HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user, int priority);
+HDSP BASSDEF(BASS_ChannelSetDSP)(DWORD handle, DSPPROC *proc, void *user,
+ int priority);
BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp);
BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan);
BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan);
@@ -1099,41 +1167,51 @@ BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, const void *params);
BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *params);
BOOL BASSDEF(BASS_FXReset)(HFX handle);
BOOL BASSDEF(BASS_FXSetPriority)(HFX handle, int priority);
-
+
#ifdef __cplusplus
}
-
-#if defined(_WIN32) && !defined(NOBASSOVERLOADS)
-static inline HPLUGIN BASS_PluginLoad(const WCHAR *file, DWORD flags)
-{
- return BASS_PluginLoad((const char*)file, flags|BASS_UNICODE);
-}
-
-static inline HMUSIC BASS_MusicLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD flags, DWORD freq)
-{
- return BASS_MusicLoad(mem, (const void*)file, offset, length, flags|BASS_UNICODE, freq);
-}
-
-static inline HSAMPLE BASS_SampleLoad(BOOL mem, const WCHAR *file, QWORD offset, DWORD length, DWORD max, DWORD flags)
-{
- return BASS_SampleLoad(mem, (const void*)file, offset, length, max, flags|BASS_UNICODE);
-}
-
-static inline HSTREAM BASS_StreamCreateFile(BOOL mem, const WCHAR *file, QWORD offset, QWORD length, DWORD flags)
-{
- return BASS_StreamCreateFile(mem, (const void*)file, offset, length, flags|BASS_UNICODE);
-}
-
-static inline HSTREAM BASS_StreamCreateURL(const WCHAR *url, DWORD offset, DWORD flags, DOWNLOADPROC *proc, void *user)
-{
- return BASS_StreamCreateURL((const char*)url, offset, flags|BASS_UNICODE, proc, user);
-}
-
-static inline BOOL BASS_SetConfigPtr(DWORD option, const WCHAR *value)
-{
- return BASS_SetConfigPtr(option|BASS_UNICODE, (const void*)value);
-}
-#endif
+
+#if defined(_WIN32) && !defined(NOBASSOVERLOADS)
+static inline HPLUGIN BASS_PluginLoad(const WCHAR *file, DWORD flags)
+{
+ return BASS_PluginLoad((const char *)file, flags | BASS_UNICODE);
+}
+
+static inline HMUSIC BASS_MusicLoad(BOOL mem, const WCHAR *file, QWORD offset,
+ DWORD length, DWORD flags, DWORD freq)
+{
+ return BASS_MusicLoad(mem, (const void *)file, offset, length,
+ flags | BASS_UNICODE, freq);
+}
+
+static inline HSAMPLE BASS_SampleLoad(BOOL mem, const WCHAR *file, QWORD offset,
+ DWORD length, DWORD max, DWORD flags)
+{
+ return BASS_SampleLoad(mem, (const void *)file, offset, length, max,
+ flags | BASS_UNICODE);
+}
+
+static inline HSTREAM BASS_StreamCreateFile(BOOL mem, const WCHAR *file,
+ QWORD offset, QWORD length,
+ DWORD flags)
+{
+ return BASS_StreamCreateFile(mem, (const void *)file, offset, length,
+ flags | BASS_UNICODE);
+}
+
+static inline HSTREAM BASS_StreamCreateURL(const WCHAR *url, DWORD offset,
+ DWORD flags, DOWNLOADPROC *proc,
+ void *user)
+{
+ return BASS_StreamCreateURL((const char *)url, offset, flags | BASS_UNICODE,
+ proc, user);
+}
+
+static inline BOOL BASS_SetConfigPtr(DWORD option, const WCHAR *value)
+{
+ return BASS_SetConfigPtr(option | BASS_UNICODE, (const void *)value);
+}
+#endif
#endif
#endif
diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h
index 34c5926b..1fbca250 100644
--- a/include/chatlogpiece.h
+++ b/include/chatlogpiece.h
@@ -1,15 +1,16 @@
#ifndef CHATLOGPIECE_H
#define CHATLOGPIECE_H
-#include <QString>
#include <QDateTime>
+#include <QString>
-class chatlogpiece
-{
+class chatlogpiece {
public:
chatlogpiece();
- chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song);
- chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime);
+ chatlogpiece(QString p_name, QString p_showname, QString p_message,
+ bool p_song);
+ chatlogpiece(QString p_name, QString p_showname, QString p_message,
+ bool p_song, QDateTime p_datetime);
QString get_name();
QString get_showname();
diff --git a/include/courtroom.h b/include/courtroom.h
index 99a090b0..5d9a4b84 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -1,73 +1,70 @@
#ifndef COURTROOM_H
#define COURTROOM_H
-#include "aoimage.h"
+#include "aoapplication.h"
+#include "aoblipplayer.h"
#include "aobutton.h"
#include "aocharbutton.h"
+#include "aocharmovie.h"
#include "aoemotebutton.h"
-#include "aopacket.h"
-#include "aoscene.h"
+#include "aoevidencebutton.h"
+#include "aoevidencedisplay.h"
+#include "aoimage.h"
+#include "aolineedit.h"
#include "aomovie.h"
-#include "aocharmovie.h"
#include "aomusicplayer.h"
+#include "aopacket.h"
+#include "aoscene.h"
#include "aosfxplayer.h"
-#include "aoblipplayer.h"
-#include "aoevidencebutton.h"
#include "aotextarea.h"
-#include "aolineedit.h"
#include "aotextedit.h"
-#include "aoevidencedisplay.h"
-#include "datatypes.h"
-#include "aoapplication.h"
-#include "lobby.h"
-#include "hardware_functions.h"
-#include "file_functions.h"
+#include "chatlogpiece.h"
#include "datatypes.h"
#include "debug_functions.h"
-#include "chatlogpiece.h"
+#include "file_functions.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 <QCloseEvent>
+#include <QComboBox>
+#include <QLineEdit>
+#include <QListWidget>
+#include <QMainWindow>
#include <QMap>
-#include <QTextBrowser>
+#include <QPlainTextEdit>
+#include <QSlider>
#include <QSpinBox>
+#include <QTextBrowser>
+#include <QVector>
-#include <QDebug>
-#include <QScrollBar>
-#include <QRegExp>
#include <QBrush>
-#include <QTextCharFormat>
+#include <QDebug>
+#include <QFileDialog>
#include <QFont>
#include <QInputDialog>
-#include <QFileDialog>
+#include <QRegExp>
+#include <QScrollBar>
#include <QTextBoundaryFinder>
+#include <QTextCharFormat>
#include <stack>
class AOApplication;
-class Courtroom : public QMainWindow
-{
+class Courtroom : public QMainWindow {
Q_OBJECT
public:
explicit Courtroom(AOApplication *p_ao_app);
- 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_music(QString f_music){music_list.append(f_music);}
- void append_area(QString f_area){area_list.append(f_area);}
+ 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_music(QString f_music) { music_list.append(f_music); }
+ void append_area(QString f_area) { area_list.append(f_area); }
void fix_last_area()
{
- if (area_list.size() > 0)
- {
+ if (area_list.size() > 0) {
QString malplaced = area_list.last();
area_list.removeLast();
append_music(malplaced);
@@ -76,31 +73,27 @@ public:
void arup_append(int players, QString status, QString cm, QString locked)
{
- arup_players.append(players);
- arup_statuses.append(status);
- arup_cms.append(cm);
- arup_locks.append(locked);
+ arup_players.append(players);
+ arup_statuses.append(status);
+ arup_cms.append(cm);
+ arup_locks.append(locked);
}
void arup_modify(int type, int place, QString value)
{
- if (type == 0)
- {
+ if (type == 0) {
if (arup_players.size() > place)
arup_players[place] = value.toInt();
}
- else if (type == 1)
- {
+ else if (type == 1) {
if (arup_statuses.size() > place)
arup_statuses[place] = value;
}
- else if (type == 2)
- {
+ else if (type == 2) {
if (arup_cms.size() > place)
arup_cms[place] = value;
}
- else if (type == 3)
- {
+ else if (type == 3) {
if (arup_locks.size() > place)
arup_locks[place] = value;
}
@@ -109,105 +102,114 @@ public:
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();
- //sets font size based on theme ini files
+ // sets font size based on theme ini files
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_window_title(QString p_title);
- //reads theme inis and sets size and pos based on the identifier
+ // 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
+ // 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);
- //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);
- //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);
- //called when a DONE#% from the server was received
+ // called when a DONE#% from the server was 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();
// Sets the local pair list based on the characters available on the server.
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();
- //sets text color based on text color in chatmessage
+ // sets text color based on text color in chatmessage
void set_text_color();
// And gets the colour, too!
QColor get_text_color(QString color);
- //takes in serverD-formatted IP list as prints a converted version to server OOC
- //admittedly poorly named
+ // takes in serverD-formatted IP list as prints a converted version to server
+ // OOC admittedly poorly named
void set_ip_list(QString p_list);
- //disables chat if current cid matches second argument
- //enables if p_muted is false
+ // disables chat if current cid matches second argument
+ // enables if p_muted is false
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);
- //cid = character id, returns the cid of the currently selected character
- int get_cid() {return m_cid;}
- QString get_current_char() {return current_char;}
- QString get_current_background() {return current_background;}
+ // cid = character id, returns the cid of the currently selected character
+ int get_cid() { return m_cid; }
+ QString get_current_char() { return current_char; }
+ QString get_current_background() { return current_background; }
- //properly sets up some varibles: resets user state
+ // 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
+ // helper function that populates ui_music_list with the contents of
+ // music_list
void list_music();
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_server_chatmessage(QString p_name, QString p_message, QString p_colour);
+ void append_server_chatmessage(QString p_name, QString p_message,
+ QString p_colour);
- //these functions handle chatmessages sequentially.
- //The process itself is very convoluted and merits separate documentation
- //But the general idea is objection animation->pre animation->talking->idle
+ // these functions handle chatmessages sequentially.
+ // The process itself is very convoluted and merits separate documentation
+ // But the general idea is objection animation->pre animation->talking->idle
void handle_chatmessage(QStringList *p_contents);
void handle_chatmessage_2();
void handle_chatmessage_3();
- //This function filters out the common CC inline text trickery, for appending to
- //the IC chatlog.
+ // This function filters out the common CC inline text trickery, for appending
+ // to the IC chatlog.
QString filter_ic_text(QString p_text);
- //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
+ // 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
// 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);
- //prints who played the song to IC chat and plays said song(if found on local filesystem)
- //takes in a list where the first element is the song name and the second is the char id of who played it
+ // prints who played the song to IC chat and plays said song(if found on local
+ // 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 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);
- //sets the hp bar of defense(p_bar 1) or pro(p_bar 2)
- //state is an number between 0 and 10 inclusive
+ // sets the hp bar of defense(p_bar 1) or pro(p_bar 2)
+ // state is an number between 0 and 10 inclusive
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 announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno);
+ void announce_case(QString title, bool def, bool pro, bool jud, bool jur,
+ bool steno);
void check_connection_received();
@@ -230,18 +232,13 @@ private:
// This is for inline message-colouring.
- enum INLINE_COLOURS {
- INLINE_BLUE,
- INLINE_GREEN,
- INLINE_ORANGE,
- INLINE_GREY
- };
+ enum INLINE_COLOURS { INLINE_BLUE, INLINE_GREEN, INLINE_ORANGE, INLINE_GREY };
// A stack of inline colours.
std::stack<INLINE_COLOURS> inline_colour_stack;
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;
@@ -278,15 +275,15 @@ private:
QVector<int> music_row_to_number;
QVector<int> area_row_to_number;
- //triggers ping_server() every 60 seconds
+ // triggers ping_server() every 60 seconds
QTimer *keepalive_timer;
- //determines how fast messages tick onto screen
+ // determines how fast messages tick onto screen
QTimer *chat_tick_timer;
- //int chat_tick_interval = 60;
- //which tick position(character in chat message) we are at
+ // int chat_tick_interval = 60;
+ // which tick position(character in chat message) we are at
int tick_pos = 0;
- //used to determine how often blips sound
+ // used to determine how often blips sound
int blip_pos = 0;
int blip_rate = 1;
int rainbow_counter = 0;
@@ -299,21 +296,23 @@ private:
// True, if the log should go downwards.
bool log_goes_downwards = false;
- //delay before chat messages starts ticking
+ // delay before chat messages starts ticking
QTimer *text_delay_timer;
- //delay before sfx plays
+ // delay before sfx plays
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;
- //times how long the blinking testimony should be shown(green one in the corner)
+ // times how long the blinking testimony should be shown(green one in the
+ // corner)
QTimer *testimony_show_timer;
- //times how long the blinking testimony should be hidden
+ // 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
+ // every time point in char.inis times this equals the final time
const int time_mod = 40;
static const int chatmessage_size = 23;
@@ -324,28 +323,30 @@ private:
bool testimony_in_progress = false;
- //in milliseconds
+ // in milliseconds
const int testimony_show_time = 1500;
- //in milliseconds
+ // in milliseconds
const int testimony_hide_time = 500;
- //char id, muted or not
+ // char id, muted or not
QMap<int, bool> mute_map;
- //QVector<int> muted_cids;
+ // QVector<int> muted_cids;
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;
- //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;
- //character id, which index of the char_list the player is
+ // character id, which index of the char_list the player is
int m_cid = -1;
- //cid and this may differ in cases of ini-editing
+ // cid and this may differ in cases of ini-editing
QString current_char = "";
int objection_state = 0;
@@ -378,10 +379,11 @@ private:
int evidence_rows = 3;
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;
- //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;
QString current_background = "default";
@@ -430,11 +432,11 @@ private:
QLineEdit *ui_ooc_chat_message;
QLineEdit *ui_ooc_chat_name;
- //QLineEdit *ui_area_password;
+ // QLineEdit *ui_area_password;
QLineEdit *ui_music_search;
QWidget *ui_emotes;
- QVector<AOEmoteButton*> ui_emote_list;
+ QVector<AOEmoteButton *> ui_emote_list;
AOButton *ui_emote_left;
AOButton *ui_emote_right;
@@ -499,7 +501,7 @@ private:
AOImage *ui_evidence;
AOLineEdit *ui_evidence_name;
QWidget *ui_evidence_buttons;
- QVector<AOEvidenceButton*> ui_evidence_list;
+ QVector<AOEvidenceButton *> ui_evidence_list;
AOButton *ui_evidence_left;
AOButton *ui_evidence_right;
AOButton *ui_evidence_present;
@@ -512,11 +514,11 @@ private:
AOImage *ui_char_select_background;
- //abstract widget to hold char buttons
+ // abstract widget to hold char buttons
QWidget *ui_char_buttons;
- QVector<AOCharButton*> ui_char_button_list;
- QVector<AOCharButton*> ui_char_button_list_filtered;
+ QVector<AOCharButton *> ui_char_button_list;
+ QVector<AOCharButton *> ui_char_button_list_filtered;
AOImage *ui_selector;
AOButton *ui_back_to_lobby;
@@ -557,7 +559,8 @@ public slots:
void mod_called(QString p_ip);
- void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno);
+ void case_called(QString msg, bool def, bool pro, bool jud, bool jur,
+ bool steno);
private slots:
void start_chat_ticking();
diff --git a/include/datatypes.h b/include/datatypes.h
index aaa5de52..207f5062 100644
--- a/include/datatypes.h
+++ b/include/datatypes.h
@@ -3,16 +3,14 @@
#include <QString>
-struct server_type
-{
+struct server_type {
QString name;
QString desc;
QString ip;
int port;
};
-struct emote_type
-{
+struct emote_type {
QString comment;
QString preanim;
QString anim;
@@ -22,23 +20,20 @@ struct emote_type
int sfx_duration;
};
-struct char_type
-{
+struct char_type {
QString name;
QString description;
QString evidence_string;
bool taken;
};
-struct evi_type
-{
+struct evi_type {
QString name;
QString description;
QString image;
};
-struct chatmessage_type
-{
+struct chatmessage_type {
QString message;
QString character;
QString side;
@@ -55,29 +50,25 @@ struct chatmessage_type
int flip;
};
-struct area_type
-{
+struct area_type {
QString name;
QString background;
bool passworded;
};
-struct pos_type
-{
+struct pos_type {
int x;
int y;
};
-struct pos_size_type
-{
+struct pos_size_type {
int x = 0;
int y = 0;
int width = 0;
int height = 0;
};
-enum CHAT_MESSAGE
-{
+enum CHAT_MESSAGE {
DESK_MOD = 0,
PRE_EMOTE,
CHAR_NAME,
@@ -103,17 +94,6 @@ enum CHAT_MESSAGE
NONINTERRUPTING_PRE
};
-enum COLOR
-{
- WHITE = 0,
- GREEN,
- RED,
- ORANGE,
- BLUE,
- YELLOW,
- RAINBOW,
- PINK,
- CYAN
-};
+enum COLOR { WHITE = 0, GREEN, RED, ORANGE, BLUE, YELLOW, RAINBOW, PINK, CYAN };
#endif // DATATYPES_H
diff --git a/include/debug_functions.h b/include/debug_functions.h
index 160274cc..383431ab 100644
--- a/include/debug_functions.h
+++ b/include/debug_functions.h
@@ -1,8 +1,8 @@
#ifndef DEBUG_FUNCTIONS_H
#define DEBUG_FUNCTIONS_H
-#include <QString>
#include <QMessageBox>
+#include <QString>
void call_error(QString message);
void call_notice(QString message);
diff --git a/include/discord-rpc.h b/include/discord-rpc.h
index feb874b2..455f62aa 100644
--- a/include/discord-rpc.h
+++ b/include/discord-rpc.h
@@ -24,61 +24,63 @@ extern "C" {
#endif
typedef struct DiscordRichPresence {
- const char* state; /* max 128 bytes */
- const char* details; /* max 128 bytes */
- int64_t startTimestamp;
- int64_t endTimestamp;
- const char* largeImageKey; /* max 32 bytes */
- const char* largeImageText; /* max 128 bytes */
- const char* smallImageKey; /* max 32 bytes */
- const char* smallImageText; /* max 128 bytes */
- const char* partyId; /* max 128 bytes */
- int partySize;
- int partyMax;
- const char* matchSecret; /* max 128 bytes */
- const char* joinSecret; /* max 128 bytes */
- const char* spectateSecret; /* max 128 bytes */
- int8_t instance;
+ const char *state; /* max 128 bytes */
+ const char *details; /* max 128 bytes */
+ int64_t startTimestamp;
+ int64_t endTimestamp;
+ const char *largeImageKey; /* max 32 bytes */
+ const char *largeImageText; /* max 128 bytes */
+ const char *smallImageKey; /* max 32 bytes */
+ const char *smallImageText; /* max 128 bytes */
+ const char *partyId; /* max 128 bytes */
+ int partySize;
+ int partyMax;
+ const char *matchSecret; /* max 128 bytes */
+ const char *joinSecret; /* max 128 bytes */
+ const char *spectateSecret; /* max 128 bytes */
+ int8_t instance;
} DiscordRichPresence;
typedef struct DiscordJoinRequest {
- const char* userId;
- const char* username;
- const char* discriminator;
- const char* avatar;
+ const char *userId;
+ const char *username;
+ const char *discriminator;
+ const char *avatar;
} DiscordJoinRequest;
typedef struct DiscordEventHandlers {
- void (*ready)(void);
- void (*disconnected)(int errorCode, const char* message);
- void (*errored)(int errorCode, const char* message);
- void (*joinGame)(const char* joinSecret);
- void (*spectateGame)(const char* spectateSecret);
- void (*joinRequest)(const DiscordJoinRequest* request);
+ void (*ready)(void);
+ void (*disconnected)(int errorCode, const char *message);
+ void (*errored)(int errorCode, const char *message);
+ void (*joinGame)(const char *joinSecret);
+ void (*spectateGame)(const char *spectateSecret);
+ void (*joinRequest)(const DiscordJoinRequest *request);
} DiscordEventHandlers;
#define DISCORD_REPLY_NO 0
#define DISCORD_REPLY_YES 1
#define DISCORD_REPLY_IGNORE 2
-DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
- DiscordEventHandlers* handlers,
+DISCORD_EXPORT void Discord_Initialize(const char *applicationId,
+ DiscordEventHandlers *handlers,
int autoRegister,
- const char* optionalSteamId);
+ const char *optionalSteamId);
DISCORD_EXPORT void Discord_Shutdown(void);
/* checks for incoming messages, dispatches callbacks */
DISCORD_EXPORT void Discord_RunCallbacks(void);
-/* If you disable the lib starting its own io thread, you'll need to call this from your own */
+/* If you disable the lib starting its own io thread, you'll need to call this
+ * from your own */
#ifdef DISCORD_DISABLE_IO_THREAD
DISCORD_EXPORT void Discord_UpdateConnection(void);
#endif
-DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
+DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence);
DISCORD_EXPORT void Discord_ClearPresence(void);
-DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
+DISCORD_EXPORT void Discord_Respond(const char *userid,
+ /* DISCORD_REPLY_ */ int reply);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/include/discord_register.h b/include/discord_register.h
index 4c16b68a..655a3dfb 100644
--- a/include/discord_register.h
+++ b/include/discord_register.h
@@ -1,25 +1,27 @@
#pragma once
#if defined(DISCORD_DYNAMIC_LIB)
-# if defined(_WIN32)
-# if defined(DISCORD_BUILDING_SDK)
-# define DISCORD_EXPORT __declspec(dllexport)
-# else
-# define DISCORD_EXPORT __declspec(dllimport)
-# endif
-# else
-# define DISCORD_EXPORT __attribute__((visibility("default")))
-# endif
+#if defined(_WIN32)
+#if defined(DISCORD_BUILDING_SDK)
+#define DISCORD_EXPORT __declspec(dllexport)
#else
-# define DISCORD_EXPORT
+#define DISCORD_EXPORT __declspec(dllimport)
+#endif
+#else
+#define DISCORD_EXPORT __attribute__((visibility("default")))
+#endif
+#else
+#define DISCORD_EXPORT
#endif
#ifdef __cplusplus
extern "C" {
#endif
-DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command);
-DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
+DISCORD_EXPORT void Discord_Register(const char *applicationId,
+ const char *command);
+DISCORD_EXPORT void Discord_RegisterSteamGame(const char *applicationId,
+ const char *steamId);
#ifdef __cplusplus
}
diff --git a/include/discord_rich_presence.h b/include/discord_rich_presence.h
index e7ecc6ef..77c0eff7 100644
--- a/include/discord_rich_presence.h
+++ b/include/discord_rich_presence.h
@@ -1,11 +1,11 @@
#ifndef DISCORD_RICH_PRESENCE_H
#define DISCORD_RICH_PRESENCE_H
+#include <QDebug>
#include <cstring>
#include <ctime>
-#include <QDebug>
-#include <string>
#include <discord-rpc.h>
+#include <string>
#include <cstring>
#include <ctime>
@@ -14,12 +14,12 @@
namespace AttorneyOnline {
-class Discord
-{
+class Discord {
private:
- const char* APPLICATION_ID = "399779271737868288";
+ const char *APPLICATION_ID = "399779271737868288";
std::string server_name, server_id;
int64_t timestamp;
+
public:
Discord();
~Discord();
@@ -30,5 +30,5 @@ public:
void state_spectate();
};
-}
+} // namespace AttorneyOnline
#endif // DISCORD_RICH_PRESENCE_H
diff --git a/include/discord_rpc.h b/include/discord_rpc.h
index 3e1441e0..6bd44041 100644
--- a/include/discord_rpc.h
+++ b/include/discord_rpc.h
@@ -24,63 +24,65 @@ extern "C" {
#endif
typedef struct DiscordRichPresence {
- const char* state; /* max 128 bytes */
- const char* details; /* max 128 bytes */
- int64_t startTimestamp;
- int64_t endTimestamp;
- const char* largeImageKey; /* max 32 bytes */
- const char* largeImageText; /* max 128 bytes */
- const char* smallImageKey; /* max 32 bytes */
- const char* smallImageText; /* max 128 bytes */
- const char* partyId; /* max 128 bytes */
- int partySize;
- int partyMax;
- const char* matchSecret; /* max 128 bytes */
- const char* joinSecret; /* max 128 bytes */
- const char* spectateSecret; /* max 128 bytes */
- int8_t instance;
+ const char *state; /* max 128 bytes */
+ const char *details; /* max 128 bytes */
+ int64_t startTimestamp;
+ int64_t endTimestamp;
+ const char *largeImageKey; /* max 32 bytes */
+ const char *largeImageText; /* max 128 bytes */
+ const char *smallImageKey; /* max 32 bytes */
+ const char *smallImageText; /* max 128 bytes */
+ const char *partyId; /* max 128 bytes */
+ int partySize;
+ int partyMax;
+ const char *matchSecret; /* max 128 bytes */
+ const char *joinSecret; /* max 128 bytes */
+ const char *spectateSecret; /* max 128 bytes */
+ int8_t instance;
} DiscordRichPresence;
typedef struct DiscordUser {
- const char* userId;
- const char* username;
- const char* discriminator;
- const char* avatar;
+ const char *userId;
+ const char *username;
+ const char *discriminator;
+ const char *avatar;
} DiscordUser;
typedef struct DiscordEventHandlers {
- void (*ready)(const DiscordUser* request);
- void (*disconnected)(int errorCode, const char* message);
- void (*errored)(int errorCode, const char* message);
- void (*joinGame)(const char* joinSecret);
- void (*spectateGame)(const char* spectateSecret);
- void (*joinRequest)(const DiscordUser* request);
+ void (*ready)(const DiscordUser *request);
+ void (*disconnected)(int errorCode, const char *message);
+ void (*errored)(int errorCode, const char *message);
+ void (*joinGame)(const char *joinSecret);
+ void (*spectateGame)(const char *spectateSecret);
+ void (*joinRequest)(const DiscordUser *request);
} DiscordEventHandlers;
#define DISCORD_REPLY_NO 0
#define DISCORD_REPLY_YES 1
#define DISCORD_REPLY_IGNORE 2
-DISCORD_EXPORT void Discord_Initialize(const char* applicationId,
- DiscordEventHandlers* handlers,
+DISCORD_EXPORT void Discord_Initialize(const char *applicationId,
+ DiscordEventHandlers *handlers,
int autoRegister,
- const char* optionalSteamId);
+ const char *optionalSteamId);
DISCORD_EXPORT void Discord_Shutdown(void);
/* checks for incoming messages, dispatches callbacks */
DISCORD_EXPORT void Discord_RunCallbacks(void);
-/* If you disable the lib starting its own io thread, you'll need to call this from your own */
+/* If you disable the lib starting its own io thread, you'll need to call this
+ * from your own */
#ifdef DISCORD_DISABLE_IO_THREAD
DISCORD_EXPORT void Discord_UpdateConnection(void);
#endif
-DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence);
+DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence);
DISCORD_EXPORT void Discord_ClearPresence(void);
-DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply);
+DISCORD_EXPORT void Discord_Respond(const char *userid,
+ /* DISCORD_REPLY_ */ int reply);
-DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers);
+DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers *handlers);
#ifdef __cplusplus
} /* extern "C" */
diff --git a/include/encryption_functions.h b/include/encryption_functions.h
index dc67d122..b70e8e65 100644
--- a/include/encryption_functions.h
+++ b/include/encryption_functions.h
@@ -3,11 +3,11 @@
#include <QString>
+#include <QVector>
#include <cstddef>
-#include <stdlib.h>
-#include <sstream>
#include <iomanip>
-#include <QVector>
+#include <sstream>
+#include <stdlib.h>
QString fanta_encrypt(QString p_input, unsigned int key);
QString fanta_decrypt(QString p_input, unsigned int key);
diff --git a/include/file_functions.h b/include/file_functions.h
index 6937ed8a..8bb2e5f6 100644
--- a/include/file_functions.h
+++ b/include/file_functions.h
@@ -1,8 +1,8 @@
#ifndef FILE_FUNCTIONS_H
#define FILE_FUNCTIONS_H
-#include <QFileInfo>
#include <QDir>
+#include <QFileInfo>
#include <QString>
bool file_exists(QString file_path);
diff --git a/include/hex_functions.h b/include/hex_functions.h
index 285f096a..d178ba1b 100644
--- a/include/hex_functions.h
+++ b/include/hex_functions.h
@@ -1,17 +1,16 @@
#ifndef HEX_OPERATIONS_H
#define HEX_OPERATIONS_H
+#include <algorithm>
#include <bitset>
#include <cstdint>
-#include <iostream>
-#include <algorithm>
-#include <string>
#include <iomanip>
+#include <iostream>
#include <sstream>
+#include <string>
-namespace omni
-{
- std::string int_to_hex(unsigned int input);
+namespace omni {
+std::string int_to_hex(unsigned int input);
}
-#endif //HEX_OPERATIONS_H
+#endif // HEX_OPERATIONS_H
diff --git a/include/lobby.h b/include/lobby.h
index 19276a7d..833450d4 100644
--- a/include/lobby.h
+++ b/include/lobby.h
@@ -1,16 +1,16 @@
#ifndef LOBBY_H
#define LOBBY_H
-#include "aoimage.h"
#include "aobutton.h"
+#include "aoimage.h"
#include "aopacket.h"
#include "aotextarea.h"
-#include <QMainWindow>
-#include <QListWidget>
#include <QLabel>
-#include <QPlainTextEdit>
#include <QLineEdit>
+#include <QListWidget>
+#include <QMainWindow>
+#include <QPlainTextEdit>
#include <QProgressBar>
#include <QTextBrowser>
@@ -19,8 +19,7 @@
class AOApplication;
-class Lobby : public QMainWindow
-{
+class Lobby : public QMainWindow {
Q_OBJECT
public:
@@ -33,8 +32,8 @@ public:
void append_error(QString f_message);
void set_player_count(int players_online, int max_players);
void set_loading_text(QString p_text);
- void show_loading_overlay(){ui_loading_background->show();}
- void hide_loading_overlay(){ui_loading_background->hide();}
+ void show_loading_overlay() { ui_loading_background->show(); }
+ void hide_loading_overlay() { ui_loading_background->hide(); }
QString get_chatlog();
int get_selected_server();
void enable_connect_button();
diff --git a/include/misc_functions.h b/include/misc_functions.h
index 026c6353..5287bee8 100644
--- a/include/misc_functions.h
+++ b/include/misc_functions.h
@@ -1,8 +1,8 @@
#ifndef MISC_FUNCTIONS_H
#define MISC_FUNCTIONS_H
-#include <QTime>
#include <QCoreApplication>
+#include <QTime>
void delay(int p_milliseconds);
diff --git a/include/networkmanager.h b/include/networkmanager.h
index 08b10db8..ed57a956 100644
--- a/include/networkmanager.h
+++ b/include/networkmanager.h
@@ -1,8 +1,8 @@
#ifndef NETWORKMANAGER_H
#define NETWORKMANAGER_H
-// Qt for Android has stubbed QDnsLookup. This is not documented in any part of their wiki.
-// This prevents SRV lookup/failover behavior from functioning.
+// Qt for Android has stubbed QDnsLookup. This is not documented in any part of
+// their wiki. This prevents SRV lookup/failover behavior from functioning.
// https://bugreports.qt.io/browse/QTBUG-56143
#ifndef ANDROID
#define MS_FAILOVER_SUPPORTED
@@ -14,17 +14,16 @@
#undef MS_FAILOVER_SUPPORTED
#endif
-#include "aopacket.h"
#include "aoapplication.h"
+#include "aopacket.h"
-#include <QTcpSocket>
#include <QDnsLookup>
+#include <QTcpSocket>
#include <QTime>
#include <QTimer>
#include <cstring>
-class NetworkManager : public QObject
-{
+class NetworkManager : public QObject {
Q_OBJECT
public:
diff --git a/include/text_file_functions.h b/include/text_file_functions.h
index 119f38e2..1da4d925 100644
--- a/include/text_file_functions.h
+++ b/include/text_file_functions.h
@@ -3,11 +3,11 @@
#include "aoapplication.h"
#include "file_functions.h"
-#include <QTextStream>
-#include <QStringList>
-#include <QVector>
-#include <QDebug>
#include <QColor>
+#include <QDebug>
#include <QSettings>
+#include <QStringList>
+#include <QTextStream>
+#include <QVector>
#endif // TEXT_FILE_FUNCTIONS_H
diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp
index 4ef1edd3..9bed218d 100644
--- a/src/aoapplication.cpp
+++ b/src/aoapplication.cpp
@@ -1,17 +1,18 @@
#include "aoapplication.h"
-#include "lobby.h"
#include "courtroom.h"
-#include "networkmanager.h"
#include "debug_functions.h"
+#include "lobby.h"
+#include "networkmanager.h"
-#include "aooptionsdialog.h"
#include "aocaseannouncerdialog.h"
+#include "aooptionsdialog.h"
AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
{
// Create the QSettings class that points to the config.ini.
- configini = new QSettings(get_base_path() + "config.ini", QSettings::IniFormat);
+ configini =
+ new QSettings(get_base_path() + "config.ini", QSettings::IniFormat);
net_manager = new NetworkManager(this);
discord = new AttorneyOnline::Discord();
@@ -28,8 +29,7 @@ AOApplication::~AOApplication()
void AOApplication::construct_lobby()
{
- if (lobby_constructed)
- {
+ if (lobby_constructed) {
qDebug() << "W: lobby was attempted constructed when it already exists";
return;
}
@@ -38,8 +38,8 @@ void AOApplication::construct_lobby()
lobby_constructed = true;
QRect geometry = QGuiApplication::primaryScreen()->geometry();
- int x = (geometry.width()-w_lobby->width()) / 2;
- int y = (geometry.height()-w_lobby->height()) / 2;
+ int x = (geometry.width() - w_lobby->width()) / 2;
+ int y = (geometry.height() - w_lobby->height()) / 2;
w_lobby->move(x, y);
if (is_discord_enabled())
@@ -50,8 +50,7 @@ void AOApplication::construct_lobby()
void AOApplication::destruct_lobby()
{
- if(!lobby_constructed)
- {
+ if (!lobby_constructed) {
qDebug() << "W: lobby was attempted destructed when it did not exist";
return;
}
@@ -63,8 +62,7 @@ void AOApplication::destruct_lobby()
void AOApplication::construct_courtroom()
{
- if (courtroom_constructed)
- {
+ if (courtroom_constructed) {
qDebug() << "W: courtroom was attempted constructed when it already exists";
return;
}
@@ -73,15 +71,14 @@ void AOApplication::construct_courtroom()
courtroom_constructed = true;
QRect geometry = QGuiApplication::primaryScreen()->geometry();
- int x = (geometry.width()-w_courtroom->width()) / 2;
- int y = (geometry.height()-w_courtroom->height()) / 2;
+ int x = (geometry.width() - w_courtroom->width()) / 2;
+ int y = (geometry.height() - w_courtroom->height()) / 2;
w_courtroom->move(x, y);
}
void AOApplication::destruct_courtroom()
{
- if (!courtroom_constructed)
- {
+ if (!courtroom_constructed) {
qDebug() << "W: courtroom was attempted destructed when it did not exist";
return;
}
@@ -93,16 +90,11 @@ void AOApplication::destruct_courtroom()
QString AOApplication::get_version_string()
{
- return
- QString::number(RELEASE) + "." +
- QString::number(MAJOR_VERSION) + "." +
- QString::number(MINOR_VERSION);
+ return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." +
+ QString::number(MINOR_VERSION);
}
-void AOApplication::reload_theme()
-{
- current_theme = read_theme();
-}
+void AOApplication::reload_theme() { current_theme = read_theme(); }
void AOApplication::set_favorite_list()
{
@@ -133,8 +125,7 @@ void AOApplication::add_favorite_server(int p_server)
void AOApplication::server_disconnected()
{
- if (courtroom_constructed)
- {
+ if (courtroom_constructed) {
call_notice("Disconnected from server.");
construct_lobby();
destruct_courtroom();
@@ -150,38 +141,38 @@ void AOApplication::loading_cancelled()
void AOApplication::ms_connect_finished(bool connected, bool will_retry)
{
- if (connected)
- {
+ if (connected) {
AOPacket *f_packet = new AOPacket("ALL#%");
send_ms_packet(f_packet);
}
- else
- {
- if (will_retry)
- {
+ else {
+ if (will_retry) {
if (lobby_constructed)
- w_lobby->append_error("Error connecting to master server. Will try again in "
- + QString::number(net_manager->ms_reconnect_delay) + " seconds.");
+ w_lobby->append_error(
+ "Error connecting to master server. Will try again in " +
+ QString::number(net_manager->ms_reconnect_delay) + " seconds.");
}
- else
- {
+ else {
call_error("There was an error connecting to the master server.\n"
- "We deploy multiple master servers to mitigate any possible downtime, "
- "but the client appears to have exhausted all possible methods of finding "
+ "We deploy multiple master servers to mitigate any possible "
+ "downtime, "
+ "but the client appears to have exhausted all possible "
+ "methods of finding "
"and connecting to one.\n"
- "Please check your Internet connection and firewall, and please try again.");
+ "Please check your Internet connection and firewall, and "
+ "please try again.");
}
}
}
void AOApplication::call_settings_menu()
{
- AOOptionsDialog settings(nullptr, this);
- settings.exec();
+ AOOptionsDialog settings(nullptr, this);
+ settings.exec();
}
void AOApplication::call_announce_menu(Courtroom *court)
{
- AOCaseAnnouncerDialog announcer(nullptr, this, court);
- announcer.exec();
+ AOCaseAnnouncerDialog announcer(nullptr, this, court);
+ announcer.exec();
}
diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp
index 4dfb895c..0355414d 100644
--- a/src/aoblipplayer.cpp
+++ b/src/aoblipplayer.cpp
@@ -1,6 +1,6 @@
#include "aoblipplayer.h"
-#if defined(BASSAUDIO) //Using bass.dll for the blips
+#if defined(BASSAUDIO) // Using bass.dll for the blips
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
{
m_parent = parent;
@@ -11,11 +11,11 @@ void AOBlipPlayer::set_blips(QString p_sfx)
{
QString f_path = ao_app->get_sounds_path(p_sfx);
- for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
- {
+ for (int n_stream = 0; n_stream < 5; ++n_stream) {
BASS_StreamFree(m_stream_list[n_stream]);
- m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
+ m_stream_list[n_stream] = BASS_StreamCreateFile(
+ FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
}
set_volume(m_volume);
@@ -40,12 +40,11 @@ void AOBlipPlayer::set_volume(int p_value)
float volume = p_value / 100.0f;
- for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
- {
+ for (int n_stream = 0; n_stream < 5; ++n_stream) {
BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
}
}
-#elif defined(QTAUDIO) //Using Qt's QSoundEffect class
+#elif defined(QTAUDIO) // Using Qt's QSoundEffect class
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
{
m_parent = parent;
@@ -56,8 +55,7 @@ void AOBlipPlayer::set_blips(QString p_sfx)
{
QString f_path = ao_app->get_sounds_path(p_sfx);
- for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
- {
+ for (int n_stream = 0; n_stream < 5; ++n_stream) {
m_blips.setSource(QUrl::fromLocalFile(f_path));
}
@@ -79,25 +77,16 @@ void AOBlipPlayer::set_volume(int p_value)
m_volume = p_value;
m_blips.setVolume(m_volume);
}
-#else //No audio
+#else // No audio
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
{
m_parent = parent;
ao_app = p_ao_app;
}
-void AOBlipPlayer::set_blips(QString p_sfx)
-{
-
-}
-
-void AOBlipPlayer::blip_tick()
-{
-
-}
+void AOBlipPlayer::set_blips(QString p_sfx) {}
-void AOBlipPlayer::set_volume(int p_value)
-{
+void AOBlipPlayer::blip_tick() {}
-}
+void AOBlipPlayer::set_volume(int p_value) {}
#endif
diff --git a/src/aobutton.cpp b/src/aobutton.cpp
index 5be2e678..fee946a4 100644
--- a/src/aobutton.cpp
+++ b/src/aobutton.cpp
@@ -3,15 +3,13 @@
#include "debug_functions.h"
#include "file_functions.h"
-AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent)
+AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app)
+ : QPushButton(parent)
{
ao_app = p_ao_app;
}
-AOButton::~AOButton()
-{
-
-}
+AOButton::~AOButton() {}
void AOButton::set_image(QString p_image)
{
@@ -23,4 +21,3 @@ void AOButton::set_image(QString p_image)
else
this->setStyleSheet("border-image:url(\"" + default_image_path + "\")");
}
-
diff --git a/src/aocaseannouncerdialog.cpp b/src/aocaseannouncerdialog.cpp
index 5b82b64f..d91433a6 100644
--- a/src/aocaseannouncerdialog.cpp
+++ b/src/aocaseannouncerdialog.cpp
@@ -1,7 +1,9 @@
#include "aocaseannouncerdialog.h"
-AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_ao_app, Courtroom *p_court)
- : QDialog(parent)
+AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent,
+ AOApplication *p_ao_app,
+ Courtroom *p_court)
+ : QDialog(parent)
{
ao_app = p_ao_app;
court = p_court;
@@ -14,21 +16,27 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
sizepolicy.setHorizontalStretch(0);
sizepolicy.setVerticalStretch(0);
- sizepolicy.setHeightForWidth(ui_announcer_buttons->sizePolicy().hasHeightForWidth());
+ sizepolicy.setHeightForWidth(
+ ui_announcer_buttons->sizePolicy().hasHeightForWidth());
ui_announcer_buttons->setSizePolicy(sizepolicy);
ui_announcer_buttons->setOrientation(Qt::Horizontal);
- ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok |
+ QDialogButtonBox::Cancel);
- QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this, SLOT(ok_pressed()));
- QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this, SLOT(cancel_pressed()));
+ QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this,
+ SLOT(ok_pressed()));
+ QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this,
+ SLOT(cancel_pressed()));
setUpdatesEnabled(false);
ui_vbox_layout = new QVBoxLayout(this);
ui_form_layout = new QFormLayout(this);
- ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
- ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop);
+ ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
+ Qt::AlignVCenter);
+ ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
+ Qt::AlignTop);
ui_form_layout->setContentsMargins(6, 6, 6, 6);
ui_vbox_layout->addItem(ui_form_layout);
@@ -66,17 +74,12 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
void AOCaseAnnouncerDialog::ok_pressed()
{
- court->announce_case(ui_case_title_textbox->text(),
- ui_defense_needed->isChecked(),
- ui_prosecutor_needed->isChecked(),
- ui_judge_needed->isChecked(),
- ui_juror_needed->isChecked(),
- ui_steno_needed->isChecked());
+ court->announce_case(
+ ui_case_title_textbox->text(), ui_defense_needed->isChecked(),
+ ui_prosecutor_needed->isChecked(), ui_judge_needed->isChecked(),
+ ui_juror_needed->isChecked(), ui_steno_needed->isChecked());
done(0);
}
-void AOCaseAnnouncerDialog::cancel_pressed()
-{
- done(0);
-}
+void AOCaseAnnouncerDialog::cancel_pressed() { done(0); }
diff --git a/src/aocharbutton.cpp b/src/aocharbutton.cpp
index 76610270..6c27e3ea 100644
--- a/src/aocharbutton.cpp
+++ b/src/aocharbutton.cpp
@@ -2,7 +2,9 @@
#include "file_functions.h"
-AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken) : QPushButton(parent)
+AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos,
+ int y_pos, bool is_taken)
+ : QPushButton(parent)
{
m_parent = parent;
@@ -40,28 +42,20 @@ void AOCharButton::reset()
ui_selector->hide();
}
-void AOCharButton::set_taken(bool is_taken)
-{
- taken = is_taken;
-}
+void AOCharButton::set_taken(bool is_taken) { taken = is_taken; }
void AOCharButton::apply_taken_image()
{
- if (taken)
- {
- ui_taken->move(0,0);
+ if (taken) {
+ ui_taken->move(0, 0);
ui_taken->show();
}
- else
- {
+ else {
ui_taken->hide();
}
}
-void AOCharButton::set_passworded()
-{
- ui_passworded->show();
-}
+void AOCharButton::set_passworded() { ui_passworded->show(); }
void AOCharButton::set_image(QString p_character)
{
@@ -71,14 +65,13 @@ void AOCharButton::set_image(QString p_character)
if (file_exists(image_path))
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
- else
- {
+ else {
this->setStyleSheet("border-image:url()");
this->setText(p_character);
}
}
-void AOCharButton::enterEvent(QEvent * e)
+void AOCharButton::enterEvent(QEvent *e)
{
ui_selector->move(this->x() - 1, this->y() - 1);
ui_selector->raise();
@@ -88,10 +81,8 @@ void AOCharButton::enterEvent(QEvent * e)
QPushButton::enterEvent(e);
}
-void AOCharButton::leaveEvent(QEvent * e)
+void AOCharButton::leaveEvent(QEvent *e)
{
ui_selector->hide();
QPushButton::leaveEvent(e);
}
-
-
diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp
index 57487233..3e0a4de8 100644
--- a/src/aocharmovie.cpp
+++ b/src/aocharmovie.cpp
@@ -1,10 +1,11 @@
#include "aocharmovie.h"
-#include "misc_functions.h"
-#include "file_functions.h"
#include "aoapplication.h"
+#include "file_functions.h"
+#include "misc_functions.h"
-AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
+AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app)
+ : QLabel(p_parent)
{
ao_app = p_ao_app;
@@ -19,11 +20,14 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_
void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
{
- QString original_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif");
+ 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, p_emote + ".png");
- QString apng_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng");
+ QString apng_path =
+ ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng");
QString placeholder_path = ao_app->get_theme_path("placeholder.gif");
- QString placeholder_default_path = ao_app->get_default_theme_path("placeholder.gif");
+ QString placeholder_default_path =
+ ao_app->get_default_theme_path("placeholder.gif");
QString gif_path;
if (file_exists(apng_path))
@@ -44,8 +48,7 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
movie_frames.clear();
QImage f_image = reader->read();
- while (!f_image.isNull())
- {
+ while (!f_image.isNull()) {
if (m_flipped)
movie_frames.append(f_image.mirrored(true, false));
else
@@ -73,8 +76,7 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
play_once = false;
- for (int n_frame = 0 ; n_frame < m_movie->frameCount() ; ++n_frame)
- {
+ for (int n_frame = 0; n_frame < m_movie->frameCount(); ++n_frame) {
real_duration += m_movie->nextFrameDelay();
m_movie->jumpToFrame(n_frame + 1);
}
@@ -86,8 +88,7 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
double percentage_modifier = 100.0;
- if (real_duration != 0 && duration != 0)
- {
+ if (real_duration != 0 && duration != 0) {
double modifier = full_duration / static_cast<double>(real_duration);
percentage_modifier = 100 / modifier;
@@ -99,17 +100,14 @@ void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration)
qDebug() << "% mod: " << percentage_modifier;
#endif
- if (full_duration == 0 || full_duration >= real_duration)
- {
+ if (full_duration == 0 || full_duration >= real_duration) {
play_once = true;
}
- else
- {
+ else {
play_once = false;
preanim_timer->start(full_duration);
}
-
m_movie->setSpeed(static_cast<int>(percentage_modifier));
play(p_char, p_emote, "");
}
@@ -142,7 +140,8 @@ void AOCharMovie::play_idle(QString p_char, QString p_emote)
void AOCharMovie::stop()
{
- //for all intents and purposes, stopping is the same as hiding. at no point do we want a frozen gif to display
+ // for all intents and purposes, stopping is the same as hiding. at no point
+ // do we want a frozen gif to display
m_movie->stop();
preanim_timer->stop();
this->hide();
@@ -165,31 +164,28 @@ void AOCharMovie::move(int ax, int ay)
void AOCharMovie::frame_change(int n_frame)
{
- if (movie_frames.size() > n_frame)
- {
+ if (movie_frames.size() > n_frame) {
QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame));
auto aspect_ratio = Qt::KeepAspectRatio;
if (f_pixmap.size().width() > f_pixmap.size().height())
aspect_ratio = Qt::KeepAspectRatioByExpanding;
- if (f_pixmap.size().width() > this->size().width() || f_pixmap.size().height() > this->size().height())
- this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::SmoothTransformation));
+ if (f_pixmap.size().width() > this->size().width() ||
+ f_pixmap.size().height() > this->size().height())
+ this->setPixmap(f_pixmap.scaled(this->width(), this->height(),
+ aspect_ratio, Qt::SmoothTransformation));
else
- this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation));
+ 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);
+ }
- if (m_movie->frameCount() - 1 == n_frame && play_once)
- {
+ if (m_movie->frameCount() - 1 == n_frame && play_once) {
preanim_timer->start(m_movie->nextFrameDelay());
m_movie->stop();
}
}
-void AOCharMovie::timer_done()
-{
-
- done();
-}
+void AOCharMovie::timer_done() { done(); }
diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp
index 9c1d3889..29329c98 100644
--- a/src/aoemotebutton.cpp
+++ b/src/aoemotebutton.cpp
@@ -2,7 +2,9 @@
#include "file_functions.h"
-AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
+AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app,
+ int p_x, int p_y)
+ : QPushButton(p_parent)
{
parent = p_parent;
ao_app = p_ao_app;
@@ -16,21 +18,17 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x
void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix)
{
QString emotion_number = QString::number(p_emote + 1);
- QString image_path = ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix);
+ QString image_path = ao_app->get_character_path(
+ p_char, "emotions/button" + emotion_number + suffix);
- if (file_exists(image_path))
- {
+ if (file_exists(image_path)) {
this->setText("");
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
}
- else
- {
+ else {
this->setText(ao_app->get_emote_comment(p_char, p_emote));
this->setStyleSheet("border-image:url(\"\")");
}
}
-void AOEmoteButton::on_clicked()
-{
- emote_clicked(m_id);
-}
+void AOEmoteButton::on_clicked() { emote_clicked(m_id); }
diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp
index 15b598fc..a94519e0 100644
--- a/src/aoevidencebutton.cpp
+++ b/src/aoevidencebutton.cpp
@@ -2,7 +2,9 @@
#include "file_functions.h"
-AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
+AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app,
+ int p_x, int p_y)
+ : QPushButton(p_parent)
{
ao_app = p_ao_app;
m_parent = p_parent;
@@ -39,13 +41,11 @@ void AOEvidenceButton::set_image(QString p_image)
{
QString image_path = ao_app->get_evidence_path(p_image);
- if (file_exists(image_path))
- {
+ if (file_exists(image_path)) {
this->setText("");
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
}
- else
- {
+ else {
this->setText(p_image);
this->setStyleSheet("");
}
@@ -75,10 +75,7 @@ void AOEvidenceButton::set_selected(bool p_selected)
ui_selected->hide();
}
-void AOEvidenceButton::on_clicked()
-{
- evidence_clicked(m_id);
-}
+void AOEvidenceButton::on_clicked() { evidence_clicked(m_id); }
void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
{
@@ -102,7 +99,7 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e)
}
*/
-void AOEvidenceButton::enterEvent(QEvent * e)
+void AOEvidenceButton::enterEvent(QEvent *e)
{
ui_selector->show();
@@ -112,7 +109,7 @@ void AOEvidenceButton::enterEvent(QEvent * e)
QPushButton::enterEvent(e);
}
-void AOEvidenceButton::leaveEvent(QEvent * e)
+void AOEvidenceButton::leaveEvent(QEvent *e)
{
ui_selector->hide();
diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp
index 9ec105dd..9dd062b7 100644
--- a/src/aoevidencedisplay.cpp
+++ b/src/aoevidencedisplay.cpp
@@ -1,10 +1,11 @@
#include "aoevidencedisplay.h"
-#include "file_functions.h"
#include "datatypes.h"
+#include "file_functions.h"
#include "misc_functions.h"
-AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
+AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app)
+ : QLabel(p_parent)
{
ao_app = p_ao_app;
@@ -12,10 +13,12 @@ AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app)
evidence_icon = new QLabel(this);
sfx_player = new AOSfxPlayer(this, ao_app);
- connect(evidence_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
+ connect(evidence_movie, SIGNAL(frameChanged(int)), this,
+ SLOT(frame_change(int)));
}
-void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_side, int p_volume)
+void AOEvidenceDisplay::show_evidence(QString p_evidence_image,
+ bool is_left_side, int p_volume)
{
this->reset();
@@ -29,23 +32,23 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid
QString gif_name;
QString icon_identifier;
- if (is_left_side)
- {
+ if (is_left_side) {
icon_identifier = "left_evidence_icon";
gif_name = "evidence_appear_left.gif";
}
- else
- {
+ else {
icon_identifier = "right_evidence_icon";
gif_name = "evidence_appear_right.gif";
}
- pos_size_type icon_dimensions = ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini");
+ pos_size_type icon_dimensions =
+ ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini");
evidence_icon->move(icon_dimensions.x, icon_dimensions.y);
evidence_icon->resize(icon_dimensions.width, icon_dimensions.height);
- evidence_icon->setPixmap(f_pixmap.scaled(evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio));
+ evidence_icon->setPixmap(f_pixmap.scaled(
+ evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio));
QString f_default_gif_path = ao_app->get_default_theme_path(gif_name);
QString f_gif_path = ao_app->get_theme_path(gif_name);
@@ -57,7 +60,7 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid
evidence_movie->setFileName(final_gif_path);
- if(evidence_movie->frameCount() < 1)
+ if (evidence_movie->frameCount() < 1)
return;
this->setMovie(evidence_movie);
@@ -68,9 +71,8 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid
void AOEvidenceDisplay::frame_change(int p_frame)
{
- if (p_frame == (evidence_movie->frameCount() - 1))
- {
- //we need this or else the last frame wont show
+ if (p_frame == (evidence_movie->frameCount() - 1)) {
+ // we need this or else the last frame wont show
delay(evidence_movie->nextFrameDelay());
evidence_movie->stop();
@@ -88,9 +90,4 @@ void AOEvidenceDisplay::reset()
this->clear();
}
-QLabel* AOEvidenceDisplay::get_evidence_icon()
-{
- return evidence_icon;
-}
-
-
+QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; }
diff --git a/src/aoimage.cpp b/src/aoimage.cpp
index 7bb56bb6..ffdf25aa 100644
--- a/src/aoimage.cpp
+++ b/src/aoimage.cpp
@@ -8,10 +8,7 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
ao_app = p_ao_app;
}
-AOImage::~AOImage()
-{
-
-}
+AOImage::~AOImage() {}
void AOImage::set_image(QString p_image)
{
@@ -27,7 +24,8 @@ void AOImage::set_image(QString p_image)
QPixmap f_pixmap(final_image_path);
- this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
+ this->setPixmap(
+ f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
}
void AOImage::set_image_from_path(QString p_path)
@@ -43,5 +41,6 @@ void AOImage::set_image_from_path(QString p_path)
QPixmap f_pixmap(final_path);
- this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
+ this->setPixmap(
+ f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
}
diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp
index f6026e14..211d9f78 100644
--- a/src/aolineedit.cpp
+++ b/src/aolineedit.cpp
@@ -15,7 +15,4 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e)
this->setReadOnly(false);
}
-void AOLineEdit::on_enter_pressed()
-{
- this->setReadOnly(true);
-}
+void AOLineEdit::on_enter_pressed() { this->setReadOnly(true); }
diff --git a/src/aomovie.cpp b/src/aomovie.cpp
index edf5bdb0..86426882 100644
--- a/src/aomovie.cpp
+++ b/src/aomovie.cpp
@@ -1,7 +1,7 @@
#include "aomovie.h"
-#include "file_functions.h"
#include "courtroom.h"
+#include "file_functions.h"
#include "misc_functions.h"
AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
@@ -15,10 +15,7 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
}
-void AOMovie::set_play_once(bool p_play_once)
-{
- play_once = p_play_once;
-}
+void AOMovie::set_play_once(bool p_play_once) { play_once = p_play_once; }
void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme)
{
@@ -28,16 +25,21 @@ void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme)
QString custom_path;
if (p_gif == "custom")
- custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif));
+ custom_path =
+ ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif));
else
- custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble"));
+ custom_path = ao_app->get_image_suffix(
+ ao_app->get_character_path(p_char, p_gif + "_bubble"));
- QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble.gif";
- QString custom_theme_path = ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif");
+ QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" +
+ p_gif + "_bubble.gif";
+ QString custom_theme_path =
+ ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif");
QString theme_path = ao_app->get_theme_path(p_gif + ".gif");
QString default_theme_path = ao_app->get_default_theme_path(p_gif + ".gif");
QString placeholder_path = ao_app->get_theme_path("placeholder.gif");
- QString default_placeholder_path = ao_app->get_default_theme_path("placeholder.gif");
+ QString default_placeholder_path =
+ ao_app->get_default_theme_path("placeholder.gif");
if (file_exists(custom_path))
gif_path = custom_path;
@@ -70,14 +72,13 @@ void AOMovie::stop()
void AOMovie::frame_change(int n_frame)
{
- if (n_frame == (m_movie->frameCount() - 1) && play_once)
- {
- //we need this or else the last frame wont show
+ if (n_frame == (m_movie->frameCount() - 1) && play_once) {
+ // we need this or else the last frame wont show
delay(m_movie->nextFrameDelay());
this->stop();
- //signal connected to courtroom object, let it figure out what to do
+ // signal connected to courtroom object, let it figure out what to do
done();
}
}
diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp
index 27918092..e61555a5 100644
--- a/src/aomusicplayer.cpp
+++ b/src/aomusicplayer.cpp
@@ -7,10 +7,7 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
ao_app = p_ao_app;
}
-AOMusicPlayer::~AOMusicPlayer()
-{
- BASS_ChannelStop(m_stream);
-}
+AOMusicPlayer::~AOMusicPlayer() { BASS_ChannelStop(m_stream); }
void AOMusicPlayer::play(QString p_song)
{
@@ -18,7 +15,9 @@ void AOMusicPlayer::play(QString p_song)
QString f_path = ao_app->get_music_path(p_song);
- m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
+ m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0,
+ BASS_STREAM_AUTOFREE | BASS_UNICODE |
+ BASS_ASYNCFILE);
this->set_volume(m_volume);
@@ -40,10 +39,7 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
ao_app = p_ao_app;
}
-AOMusicPlayer::~AOMusicPlayer()
-{
- m_player.stop();
-}
+AOMusicPlayer::~AOMusicPlayer() { m_player.stop(); }
void AOMusicPlayer::play(QString p_song)
{
@@ -70,18 +66,9 @@ AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *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)
-{
-
-}
+void AOMusicPlayer::set_volume(int p_value) {}
#endif
diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp
index 0f6a054a..5653fd90 100644
--- a/src/aooptionsdialog.cpp
+++ b/src/aooptionsdialog.cpp
@@ -2,523 +2,554 @@
#include "aoapplication.h"
#include "bass.h"
-AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDialog(parent)
+AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
+ : QDialog(parent)
{
- ao_app = p_ao_app;
+ ao_app = p_ao_app;
+
+ // Setting up the basics.
+ // setAttribute(Qt::WA_DeleteOnClose);
+ setWindowTitle(tr("Settings"));
+ resize(398, 320);
+
+ ui_settings_buttons = new QDialogButtonBox(this);
+
+ QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed);
+ sizePolicy1.setHorizontalStretch(0);
+ sizePolicy1.setVerticalStretch(0);
+ sizePolicy1.setHeightForWidth(
+ ui_settings_buttons->sizePolicy().hasHeightForWidth());
+ ui_settings_buttons->setSizePolicy(sizePolicy1);
+ ui_settings_buttons->setOrientation(Qt::Horizontal);
+ ui_settings_buttons->setStandardButtons(QDialogButtonBox::Cancel |
+ QDialogButtonBox::Save);
+
+ QObject::connect(ui_settings_buttons, SIGNAL(accepted()), this,
+ SLOT(save_pressed()));
+ QObject::connect(ui_settings_buttons, SIGNAL(rejected()), this,
+ SLOT(discard_pressed()));
+
+ // We'll stop updates so that the window won't flicker while it's being made.
+ setUpdatesEnabled(false);
+
+ // First of all, we want a tabbed dialog, so let's add some layout.
+ ui_vertical_layout = new QVBoxLayout(this);
+ ui_settings_tabs = new QTabWidget(this);
+
+ ui_vertical_layout->addWidget(ui_settings_tabs);
+ ui_vertical_layout->addWidget(ui_settings_buttons);
+
+ // Let's add the tabs one by one.
+ // First, we'll start with 'Gameplay'.
+ ui_gameplay_tab = new QWidget();
+ ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay"));
+
+ ui_form_layout_widget = new QWidget(ui_gameplay_tab);
+ ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211));
- // Setting up the basics.
- // setAttribute(Qt::WA_DeleteOnClose);
- setWindowTitle(tr("Settings"));
- resize(398, 320);
+ ui_gameplay_form = new QFormLayout(ui_form_layout_widget);
+ ui_gameplay_form->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
+ Qt::AlignVCenter);
+ ui_gameplay_form->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
+ Qt::AlignTop);
+ ui_gameplay_form->setContentsMargins(0, 0, 0, 0);
- ui_settings_buttons = new QDialogButtonBox(this);
+ ui_theme_label = new QLabel(ui_form_layout_widget);
+ ui_theme_label->setText(tr("Theme:"));
+ ui_theme_label->setToolTip(
+ tr("Sets the theme used in-game. If the new theme changes "
+ "the lobby's look as well, you'll need to reload the "
+ "lobby for the changes to take effect, such as by joining "
+ "a server and leaving it."));
+ ui_gameplay_form->setWidget(0, QFormLayout::LabelRole, ui_theme_label);
- QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed);
- sizePolicy1.setHorizontalStretch(0);
- sizePolicy1.setVerticalStretch(0);
- sizePolicy1.setHeightForWidth(ui_settings_buttons->sizePolicy().hasHeightForWidth());
- ui_settings_buttons->setSizePolicy(sizePolicy1);
- ui_settings_buttons->setOrientation(Qt::Horizontal);
- ui_settings_buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save);
+ ui_theme_combobox = new QComboBox(ui_form_layout_widget);
- QObject::connect(ui_settings_buttons, SIGNAL(accepted()), this, SLOT(save_pressed()));
- QObject::connect(ui_settings_buttons, SIGNAL(rejected()), this, SLOT(discard_pressed()));
+ // Fill the combobox with the names of the themes.
+ QDirIterator it(p_ao_app->get_base_path() + "themes", QDir::Dirs,
+ QDirIterator::NoIteratorFlags);
+ while (it.hasNext()) {
+ QString actualname = QDir(it.next()).dirName();
+ if (actualname != "." && actualname != "..")
+ ui_theme_combobox->addItem(actualname);
+ if (actualname == p_ao_app->read_theme())
+ ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count() - 1);
+ }
- // We'll stop updates so that the window won't flicker while it's being made.
- setUpdatesEnabled(false);
+ ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox);
- // First of all, we want a tabbed dialog, so let's add some layout.
- ui_vertical_layout = new QVBoxLayout(this);
- ui_settings_tabs = new QTabWidget(this);
+ ui_theme_log_divider = new QFrame(ui_form_layout_widget);
+ ui_theme_log_divider->setMidLineWidth(0);
+ ui_theme_log_divider->setFrameShape(QFrame::HLine);
+ ui_theme_log_divider->setFrameShadow(QFrame::Sunken);
- ui_vertical_layout->addWidget(ui_settings_tabs);
- ui_vertical_layout->addWidget(ui_settings_buttons);
+ ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider);
- // Let's add the tabs one by one.
- // First, we'll start with 'Gameplay'.
- ui_gameplay_tab = new QWidget();
- ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay"));
+ ui_downwards_lbl = new QLabel(ui_form_layout_widget);
+ ui_downwards_lbl->setText(tr("Log goes downwards:"));
+ ui_downwards_lbl->setToolTip(
+ tr("If ticked, new messages will appear at "
+ "the bottom (like the OOC chatlog). The traditional "
+ "(AO1) behaviour is equivalent to this being unticked."));
- ui_form_layout_widget = new QWidget(ui_gameplay_tab);
- ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211));
+ ui_gameplay_form->setWidget(2, QFormLayout::LabelRole, ui_downwards_lbl);
- ui_gameplay_form = new QFormLayout(ui_form_layout_widget);
- ui_gameplay_form->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
- ui_gameplay_form->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
- ui_gameplay_form->setContentsMargins(0, 0, 0, 0);
+ ui_downwards_cb = new QCheckBox(ui_form_layout_widget);
+ ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards());
- ui_theme_label = new QLabel(ui_form_layout_widget);
- ui_theme_label->setText(tr("Theme:"));
- ui_theme_label->setToolTip(tr("Sets the theme used in-game. If the new theme changes "
- "the lobby's look as well, you'll need to reload the "
- "lobby for the changes to take effect, such as by joining "
- "a server and leaving it."));
- ui_gameplay_form->setWidget(0, QFormLayout::LabelRole, ui_theme_label);
+ ui_gameplay_form->setWidget(2, QFormLayout::FieldRole, ui_downwards_cb);
- ui_theme_combobox = new QComboBox(ui_form_layout_widget);
+ ui_length_lbl = new QLabel(ui_form_layout_widget);
+ ui_length_lbl->setText(tr("Log length:"));
+ ui_length_lbl->setToolTip(tr(
+ "The amount of messages the IC chatlog will keep before "
+ "deleting older messages. A value of 0 or below counts as 'infinite'."));
- // Fill the combobox with the names of the themes.
- QDirIterator it(p_ao_app->get_base_path() + "themes", QDir::Dirs, QDirIterator::NoIteratorFlags);
- while (it.hasNext())
- {
- QString actualname = QDir(it.next()).dirName();
- if (actualname != "." && actualname != "..")
- ui_theme_combobox->addItem(actualname);
- if (actualname == p_ao_app->read_theme())
- ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count()-1);
- }
+ ui_gameplay_form->setWidget(3, QFormLayout::LabelRole, ui_length_lbl);
- ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox);
+ ui_length_spinbox = new QSpinBox(ui_form_layout_widget);
+ ui_length_spinbox->setMaximum(10000);
+ ui_length_spinbox->setValue(p_ao_app->get_max_log_size());
- ui_theme_log_divider = new QFrame(ui_form_layout_widget);
- ui_theme_log_divider->setMidLineWidth(0);
- ui_theme_log_divider->setFrameShape(QFrame::HLine);
- ui_theme_log_divider->setFrameShadow(QFrame::Sunken);
+ ui_gameplay_form->setWidget(3, QFormLayout::FieldRole, ui_length_spinbox);
+
+ ui_log_names_divider = new QFrame(ui_form_layout_widget);
+ ui_log_names_divider->setFrameShape(QFrame::HLine);
+ ui_log_names_divider->setFrameShadow(QFrame::Sunken);
+
+ ui_gameplay_form->setWidget(4, QFormLayout::FieldRole, ui_log_names_divider);
- ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider);
+ ui_username_lbl = new QLabel(ui_form_layout_widget);
+ ui_username_lbl->setText(tr("Default username:"));
+ ui_username_lbl->setToolTip(
+ tr("Your OOC name will be automatically set to this value "
+ "when you join a server."));
- ui_downwards_lbl = new QLabel(ui_form_layout_widget);
- ui_downwards_lbl->setText(tr("Log goes downwards:"));
- ui_downwards_lbl->setToolTip(tr("If ticked, new messages will appear at "
- "the bottom (like the OOC chatlog). The traditional "
- "(AO1) behaviour is equivalent to this being unticked."));
+ ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_username_lbl);
- ui_gameplay_form->setWidget(2, QFormLayout::LabelRole, ui_downwards_lbl);
+ ui_username_textbox = new QLineEdit(ui_form_layout_widget);
+ ui_username_textbox->setMaxLength(30);
+ ui_username_textbox->setText(p_ao_app->get_default_username());
- ui_downwards_cb = new QCheckBox(ui_form_layout_widget);
- ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards());
+ ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_username_textbox);
- ui_gameplay_form->setWidget(2, QFormLayout::FieldRole, ui_downwards_cb);
+ ui_showname_lbl = new QLabel(ui_form_layout_widget);
+ ui_showname_lbl->setText(tr("Custom shownames:"));
+ ui_showname_lbl->setToolTip(
+ tr("Gives the default value for the in-game 'Custom shownames' "
+ "tickbox, which in turn determines whether the client should "
+ "display custom in-character names."));
- ui_length_lbl = new QLabel(ui_form_layout_widget);
- ui_length_lbl->setText(tr("Log length:"));
- ui_length_lbl->setToolTip(tr("The amount of messages the IC chatlog will keep before "
- "deleting older messages. A value of 0 or below counts as 'infinite'."));
+ ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_showname_lbl);
- ui_gameplay_form->setWidget(3, QFormLayout::LabelRole, ui_length_lbl);
+ ui_showname_cb = new QCheckBox(ui_form_layout_widget);
+ ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default());
- ui_length_spinbox = new QSpinBox(ui_form_layout_widget);
- ui_length_spinbox->setMaximum(10000);
- ui_length_spinbox->setValue(p_ao_app->get_max_log_size());
+ ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_showname_cb);
- ui_gameplay_form->setWidget(3, QFormLayout::FieldRole, ui_length_spinbox);
+ ui_net_divider = new QFrame(ui_form_layout_widget);
+ ui_net_divider->setFrameShape(QFrame::HLine);
+ ui_net_divider->setFrameShadow(QFrame::Sunken);
- ui_log_names_divider = new QFrame(ui_form_layout_widget);
- ui_log_names_divider->setFrameShape(QFrame::HLine);
- ui_log_names_divider->setFrameShadow(QFrame::Sunken);
+ ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_net_divider);
- ui_gameplay_form->setWidget(4, QFormLayout::FieldRole, ui_log_names_divider);
+ ui_ms_lbl = new QLabel(ui_form_layout_widget);
+ ui_ms_lbl->setText(tr("Backup MS:"));
+ ui_ms_lbl->setToolTip(
+ tr("If the built-in server lookups fail, the game will try the "
+ "address given here and use it as a backup master server address."));
- ui_username_lbl = new QLabel(ui_form_layout_widget);
- ui_username_lbl->setText(tr("Default username:"));
- ui_username_lbl->setToolTip(tr("Your OOC name will be automatically set to this value "
- "when you join a server."));
+ ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_ms_lbl);
- ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_username_lbl);
+ QSettings *configini = ao_app->configini;
+ ui_ms_textbox = new QLineEdit(ui_form_layout_widget);
+ ui_ms_textbox->setText(configini->value("master", "").value<QString>());
- ui_username_textbox = new QLineEdit(ui_form_layout_widget);
- ui_username_textbox->setMaxLength(30);
- ui_username_textbox->setText(p_ao_app->get_default_username());
+ ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_ms_textbox);
- ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_username_textbox);
+ ui_discord_lbl = new QLabel(ui_form_layout_widget);
+ ui_discord_lbl->setText(tr("Discord:"));
+ ui_discord_lbl->setToolTip(
+ tr("Allows others on Discord to see what server you are in, "
+ "what character are you playing, and how long you have "
+ "been playing for."));
- ui_showname_lbl = new QLabel(ui_form_layout_widget);
- ui_showname_lbl->setText(tr("Custom shownames:"));
- ui_showname_lbl->setToolTip(tr("Gives the default value for the in-game 'Custom shownames' "
- "tickbox, which in turn determines whether the client should "
- "display custom in-character names."));
+ ui_gameplay_form->setWidget(9, QFormLayout::LabelRole, ui_discord_lbl);
- ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_showname_lbl);
+ ui_discord_cb = new QCheckBox(ui_form_layout_widget);
+ ui_discord_cb->setChecked(ao_app->is_discord_enabled());
- ui_showname_cb = new QCheckBox(ui_form_layout_widget);
- ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default());
+ ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb);
- ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_showname_cb);
+ // Here we start the callwords tab.
+ ui_callwords_tab = new QWidget();
+ ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords"));
- ui_net_divider = new QFrame(ui_form_layout_widget);
- ui_net_divider->setFrameShape(QFrame::HLine);
- ui_net_divider->setFrameShadow(QFrame::Sunken);
+ ui_callwords_widget = new QWidget(ui_callwords_tab);
+ ui_callwords_widget->setGeometry(QRect(10, 10, 361, 211));
- ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_net_divider);
+ ui_callwords_layout = new QVBoxLayout(ui_callwords_widget);
+ ui_callwords_layout->setContentsMargins(0, 0, 0, 0);
- ui_ms_lbl = new QLabel(ui_form_layout_widget);
- ui_ms_lbl->setText(tr("Backup MS:"));
- ui_ms_lbl->setToolTip(tr("If the built-in server lookups fail, the game will try the "
- "address given here and use it as a backup master server address."));
+ ui_callwords_textbox = new QPlainTextEdit(ui_callwords_widget);
+ QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ sizePolicy.setHorizontalStretch(0);
+ sizePolicy.setVerticalStretch(0);
+ sizePolicy.setHeightForWidth(
+ ui_callwords_textbox->sizePolicy().hasHeightForWidth());
+ ui_callwords_textbox->setSizePolicy(sizePolicy);
- ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_ms_lbl);
+ // Let's fill the callwords text edit with the already present callwords.
+ ui_callwords_textbox->document()->clear();
+ foreach (QString callword, p_ao_app->get_call_words()) {
+ ui_callwords_textbox->appendPlainText(callword);
+ }
- QSettings* configini = ao_app->configini;
- ui_ms_textbox = new QLineEdit(ui_form_layout_widget);
- ui_ms_textbox->setText(configini->value("master", "").value<QString>());
+ ui_callwords_layout->addWidget(ui_callwords_textbox);
- ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_ms_textbox);
+ ui_callwords_explain_lbl = new QLabel(ui_callwords_widget);
+ ui_callwords_explain_lbl->setWordWrap(true);
+ ui_callwords_explain_lbl->setText(
+ tr("<html><head/><body>Enter as many callwords as you would like. These "
+ "are case insensitive. Make sure to leave every callword in its own "
+ "line!<br>Do not leave a line with a space at the end -- you will be "
+ "alerted everytime someone uses a space in their "
+ "messages.</body></html>"));
- ui_discord_lbl = new QLabel(ui_form_layout_widget);
- ui_discord_lbl->setText(tr("Discord:"));
- ui_discord_lbl->setToolTip(tr("Allows others on Discord to see what server you are in, "
- "what character are you playing, and how long you have "
- "been playing for."));
+ ui_callwords_layout->addWidget(ui_callwords_explain_lbl);
- ui_gameplay_form->setWidget(9, QFormLayout::LabelRole, ui_discord_lbl);
+// The audio tab.
+#ifdef BASSAUDIO
+ ui_audio_tab = new QWidget();
+ ui_settings_tabs->addTab(ui_audio_tab, tr("Audio"));
- ui_discord_cb = new QCheckBox(ui_form_layout_widget);
- ui_discord_cb->setChecked(ao_app->is_discord_enabled());
+ ui_audio_widget = new QWidget(ui_audio_tab);
+ ui_audio_widget->setGeometry(QRect(10, 10, 361, 211));
- ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb);
+ ui_audio_layout = new QFormLayout(ui_audio_widget);
+ ui_audio_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
+ Qt::AlignVCenter);
+ ui_audio_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
+ Qt::AlignTop);
+ ui_audio_layout->setContentsMargins(0, 0, 0, 0);
- // Here we start the callwords tab.
- ui_callwords_tab = new QWidget();
- ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords"));
+ ui_audio_device_lbl = new QLabel(ui_audio_widget);
+ ui_audio_device_lbl->setText(tr("Audio device:"));
+ ui_audio_device_lbl->setToolTip(tr("Sets the audio device for all sounds."));
- ui_callwords_widget = new QWidget(ui_callwords_tab);
- ui_callwords_widget->setGeometry(QRect(10, 10, 361, 211));
+ ui_audio_layout->setWidget(0, QFormLayout::LabelRole, ui_audio_device_lbl);
- ui_callwords_layout = new QVBoxLayout(ui_callwords_widget);
- ui_callwords_layout->setContentsMargins(0,0,0,0);
+ ui_audio_device_combobox = new QComboBox(ui_audio_widget);
- ui_callwords_textbox = new QPlainTextEdit(ui_callwords_widget);
- QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- sizePolicy.setHorizontalStretch(0);
- sizePolicy.setVerticalStretch(0);
- sizePolicy.setHeightForWidth(ui_callwords_textbox->sizePolicy().hasHeightForWidth());
- ui_callwords_textbox->setSizePolicy(sizePolicy);
+ // Let's fill out the combobox with the available audio devices. Or don't if
+ // there is no audio
+ int a = 0;
+ BASS_DEVICEINFO info;
- // Let's fill the callwords text edit with the already present callwords.
- ui_callwords_textbox->document()->clear();
- foreach (QString callword, p_ao_app->get_call_words()) {
- ui_callwords_textbox->appendPlainText(callword);
- }
+ if (needs_default_audiodev()) {
+ ui_audio_device_combobox->addItem("default");
+ }
- ui_callwords_layout->addWidget(ui_callwords_textbox);
+ for (a = 0; BASS_GetDeviceInfo(a, &info); a++) {
+ ui_audio_device_combobox->addItem(info.name);
+ if (p_ao_app->get_audio_output_device() == info.name)
+ ui_audio_device_combobox->setCurrentIndex(
+ ui_audio_device_combobox->count() - 1);
+ }
- ui_callwords_explain_lbl = new QLabel(ui_callwords_widget);
- ui_callwords_explain_lbl->setWordWrap(true);
- ui_callwords_explain_lbl->setText(tr("<html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html>"));
+ ui_audio_layout->setWidget(0, QFormLayout::FieldRole,
+ ui_audio_device_combobox);
- ui_callwords_layout->addWidget(ui_callwords_explain_lbl);
+ ui_audio_volume_divider = new QFrame(ui_audio_widget);
+ ui_audio_volume_divider->setFrameShape(QFrame::HLine);
+ ui_audio_volume_divider->setFrameShadow(QFrame::Sunken);
- // The audio tab.
- #ifdef BASSAUDIO
- ui_audio_tab = new QWidget();
- ui_settings_tabs->addTab(ui_audio_tab, tr("Audio"));
+ ui_audio_layout->setWidget(1, QFormLayout::FieldRole,
+ ui_audio_volume_divider);
- ui_audio_widget = new QWidget(ui_audio_tab);
- ui_audio_widget->setGeometry(QRect(10, 10, 361, 211));
+ ui_music_volume_lbl = new QLabel(ui_audio_widget);
+ ui_music_volume_lbl->setText(tr("Music:"));
+ ui_music_volume_lbl->setToolTip(tr("Sets the music's default volume."));
- ui_audio_layout = new QFormLayout(ui_audio_widget);
- ui_audio_layout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
- ui_audio_layout->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
- ui_audio_layout->setContentsMargins(0, 0, 0, 0);
+ ui_audio_layout->setWidget(2, QFormLayout::LabelRole, ui_music_volume_lbl);
- ui_audio_device_lbl = new QLabel(ui_audio_widget);
- ui_audio_device_lbl->setText(tr("Audio device:"));
- ui_audio_device_lbl->setToolTip(tr("Sets the audio device for all sounds."));
+ ui_music_volume_spinbox = new QSpinBox(ui_audio_widget);
+ ui_music_volume_spinbox->setValue(p_ao_app->get_default_music());
+ ui_music_volume_spinbox->setMaximum(100);
+ ui_music_volume_spinbox->setSuffix("%");
- ui_audio_layout->setWidget(0, QFormLayout::LabelRole, ui_audio_device_lbl);
+ ui_audio_layout->setWidget(2, QFormLayout::FieldRole,
+ ui_music_volume_spinbox);
- ui_audio_device_combobox = new QComboBox(ui_audio_widget);
+ ui_sfx_volume_lbl = new QLabel(ui_audio_widget);
+ ui_sfx_volume_lbl->setText(tr("SFX:"));
+ ui_sfx_volume_lbl->setToolTip(
+ tr("Sets the SFX's default volume. "
+ "Interjections and actual sound effects count as 'SFX'."));
- // Let's fill out the combobox with the available audio devices. Or don't if there is no audio
- int a = 0;
- BASS_DEVICEINFO info;
+ ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl);
- if (needs_default_audiodev())
- {
- ui_audio_device_combobox->addItem("default");
- }
+ ui_sfx_volume_spinbox = new QSpinBox(ui_audio_widget);
+ ui_sfx_volume_spinbox->setValue(p_ao_app->get_default_sfx());
+ ui_sfx_volume_spinbox->setMaximum(100);
+ ui_sfx_volume_spinbox->setSuffix("%");
- for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
- {
- ui_audio_device_combobox->addItem(info.name);
- if (p_ao_app->get_audio_output_device() == info.name)
- ui_audio_device_combobox->setCurrentIndex(ui_audio_device_combobox->count()-1);
- }
+ ui_audio_layout->setWidget(3, QFormLayout::FieldRole, ui_sfx_volume_spinbox);
- ui_audio_layout->setWidget(0, QFormLayout::FieldRole, ui_audio_device_combobox);
+ ui_blips_volume_lbl = new QLabel(ui_audio_widget);
+ ui_blips_volume_lbl->setText(tr("Blips:"));
+ ui_blips_volume_lbl->setToolTip(
+ tr("Sets the volume of the blips, the talking sound effects."));
- ui_audio_volume_divider = new QFrame(ui_audio_widget);
- ui_audio_volume_divider->setFrameShape(QFrame::HLine);
- ui_audio_volume_divider->setFrameShadow(QFrame::Sunken);
+ ui_audio_layout->setWidget(4, QFormLayout::LabelRole, ui_blips_volume_lbl);
- ui_audio_layout->setWidget(1, QFormLayout::FieldRole, ui_audio_volume_divider);
+ ui_blips_volume_spinbox = new QSpinBox(ui_audio_widget);
+ ui_blips_volume_spinbox->setValue(p_ao_app->get_default_blip());
+ ui_blips_volume_spinbox->setMaximum(100);
+ ui_blips_volume_spinbox->setSuffix("%");
- ui_music_volume_lbl = new QLabel(ui_audio_widget);
- ui_music_volume_lbl->setText(tr("Music:"));
- ui_music_volume_lbl->setToolTip(tr("Sets the music's default volume."));
+ ui_audio_layout->setWidget(4, QFormLayout::FieldRole,
+ ui_blips_volume_spinbox);
- ui_audio_layout->setWidget(2, QFormLayout::LabelRole, ui_music_volume_lbl);
+ ui_volume_blip_divider = new QFrame(ui_audio_widget);
+ ui_volume_blip_divider->setFrameShape(QFrame::HLine);
+ ui_volume_blip_divider->setFrameShadow(QFrame::Sunken);
- ui_music_volume_spinbox = new QSpinBox(ui_audio_widget);
- ui_music_volume_spinbox->setValue(p_ao_app->get_default_music());
- ui_music_volume_spinbox->setMaximum(100);
- ui_music_volume_spinbox->setSuffix("%");
+ ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider);
- ui_audio_layout->setWidget(2, QFormLayout::FieldRole, ui_music_volume_spinbox);
+ ui_bliprate_lbl = new QLabel(ui_audio_widget);
+ ui_bliprate_lbl->setText(tr("Blip rate:"));
+ ui_bliprate_lbl->setToolTip(
+ tr("Sets the delay between playing the blip sounds."));
- ui_sfx_volume_lbl = new QLabel(ui_audio_widget);
- ui_sfx_volume_lbl->setText(tr("SFX:"));
- ui_sfx_volume_lbl->setToolTip(tr("Sets the SFX's default volume. "
- "Interjections and actual sound effects count as 'SFX'."));
+ ui_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl);
- ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl);
+ ui_bliprate_spinbox = new QSpinBox(ui_audio_widget);
+ ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate());
+ ui_bliprate_spinbox->setMinimum(1);
- ui_sfx_volume_spinbox = new QSpinBox(ui_audio_widget);
- ui_sfx_volume_spinbox->setValue(p_ao_app->get_default_sfx());
- ui_sfx_volume_spinbox->setMaximum(100);
- ui_sfx_volume_spinbox->setSuffix("%");
+ ui_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox);
- ui_audio_layout->setWidget(3, QFormLayout::FieldRole, ui_sfx_volume_spinbox);
+ ui_blank_blips_lbl = new QLabel(ui_audio_widget);
+ ui_blank_blips_lbl->setText(tr("Blank blips:"));
+ ui_blank_blips_lbl->setToolTip(
+ tr("If true, the game will play a blip sound even "
+ "when a space is 'being said'."));
- ui_blips_volume_lbl = new QLabel(ui_audio_widget);
- ui_blips_volume_lbl->setText(tr("Blips:"));
- ui_blips_volume_lbl->setToolTip(tr("Sets the volume of the blips, the talking sound effects."));
+ ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl);
- ui_audio_layout->setWidget(4, QFormLayout::LabelRole, ui_blips_volume_lbl);
+ ui_blank_blips_cb = new QCheckBox(ui_audio_widget);
+ ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip());
- ui_blips_volume_spinbox = new QSpinBox(ui_audio_widget);
- ui_blips_volume_spinbox->setValue(p_ao_app->get_default_blip());
- ui_blips_volume_spinbox->setMaximum(100);
- ui_blips_volume_spinbox->setSuffix("%");
-
- ui_audio_layout->setWidget(4, QFormLayout::FieldRole, ui_blips_volume_spinbox);
-
- ui_volume_blip_divider = new QFrame(ui_audio_widget);
- ui_volume_blip_divider->setFrameShape(QFrame::HLine);
- ui_volume_blip_divider->setFrameShadow(QFrame::Sunken);
-
- ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider);
-
- ui_bliprate_lbl = new QLabel(ui_audio_widget);
- ui_bliprate_lbl->setText(tr("Blip rate:"));
- ui_bliprate_lbl->setToolTip(tr("Sets the delay between playing the blip sounds."));
-
- ui_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl);
-
- ui_bliprate_spinbox = new QSpinBox(ui_audio_widget);
- ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate());
- ui_bliprate_spinbox->setMinimum(1);
-
- ui_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox);
-
- ui_blank_blips_lbl = new QLabel(ui_audio_widget);
- ui_blank_blips_lbl->setText(tr("Blank blips:"));
- ui_blank_blips_lbl->setToolTip(tr("If true, the game will play a blip sound even "
- "when a space is 'being said'."));
-
- ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl);
-
- ui_blank_blips_cb = new QCheckBox(ui_audio_widget);
- ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip());
-
- ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb);
- #endif
+ ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb);
+#endif
- // The casing tab!
- ui_casing_tab = new QWidget();
- ui_settings_tabs->addTab(ui_casing_tab, tr("Casing"));
+ // The casing tab!
+ ui_casing_tab = new QWidget();
+ ui_settings_tabs->addTab(ui_casing_tab, tr("Casing"));
- ui_casing_widget = new QWidget(ui_casing_tab);
- ui_casing_widget->setGeometry(QRect(10,10, 361, 211));
+ ui_casing_widget = new QWidget(ui_casing_tab);
+ ui_casing_widget->setGeometry(QRect(10, 10, 361, 211));
- ui_casing_layout = new QFormLayout(ui_casing_widget);
- ui_casing_layout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
- ui_casing_layout->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop);
- ui_casing_layout->setContentsMargins(0, 0, 0, 0);
+ ui_casing_layout = new QFormLayout(ui_casing_widget);
+ ui_casing_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
+ Qt::AlignVCenter);
+ ui_casing_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
+ Qt::AlignTop);
+ ui_casing_layout->setContentsMargins(0, 0, 0, 0);
- // -- SERVER SUPPORTS CASING
+ // -- SERVER SUPPORTS CASING
- ui_casing_supported_lbl = new QLabel(ui_casing_widget);
- if (ao_app->casing_alerts_enabled)
- ui_casing_supported_lbl->setText(tr("This server supports case alerts."));
- else
- ui_casing_supported_lbl->setText(tr("This server does not support case alerts."));
- ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory."));
+ ui_casing_supported_lbl = new QLabel(ui_casing_widget);
+ if (ao_app->casing_alerts_enabled)
+ ui_casing_supported_lbl->setText(tr("This server supports case alerts."));
+ else
+ ui_casing_supported_lbl->setText(
+ tr("This server does not support case alerts."));
+ ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory."));
- ui_casing_layout->setWidget(0, QFormLayout::FieldRole, ui_casing_supported_lbl);
+ ui_casing_layout->setWidget(0, QFormLayout::FieldRole,
+ ui_casing_supported_lbl);
- // -- CASE ANNOUNCEMENTS
+ // -- CASE ANNOUNCEMENTS
- ui_casing_enabled_lbl = new QLabel(ui_casing_widget);
- ui_casing_enabled_lbl->setText(tr("Casing:"));
- ui_casing_enabled_lbl->setToolTip(tr("If checked, you will get alerts about case "
- "announcements."));
+ ui_casing_enabled_lbl = new QLabel(ui_casing_widget);
+ ui_casing_enabled_lbl->setText(tr("Casing:"));
+ ui_casing_enabled_lbl->setToolTip(
+ tr("If checked, you will get alerts about case "
+ "announcements."));
- ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl);
+ ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl);
- ui_casing_enabled_cb = new QCheckBox(ui_casing_widget);
- ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled());
+ ui_casing_enabled_cb = new QCheckBox(ui_casing_widget);
+ ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled());
- ui_casing_layout->setWidget(1, QFormLayout::FieldRole, ui_casing_enabled_cb);
+ ui_casing_layout->setWidget(1, QFormLayout::FieldRole, ui_casing_enabled_cb);
- // -- DEFENSE ANNOUNCEMENTS
+ // -- DEFENSE ANNOUNCEMENTS
- ui_casing_def_lbl = new QLabel(ui_casing_widget);
- ui_casing_def_lbl->setText(tr("Defense:"));
- ui_casing_def_lbl->setToolTip(tr("If checked, you will get alerts about case "
- "announcements if a defense spot is open."));
+ ui_casing_def_lbl = new QLabel(ui_casing_widget);
+ ui_casing_def_lbl->setText(tr("Defense:"));
+ ui_casing_def_lbl->setToolTip(tr("If checked, you will get alerts about case "
+ "announcements if a defense spot is open."));
- ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl);
+ ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl);
- ui_casing_def_cb = new QCheckBox(ui_casing_widget);
- ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled());
+ ui_casing_def_cb = new QCheckBox(ui_casing_widget);
+ ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled());
- ui_casing_layout->setWidget(2, QFormLayout::FieldRole, ui_casing_def_cb);
+ ui_casing_layout->setWidget(2, QFormLayout::FieldRole, ui_casing_def_cb);
- // -- PROSECUTOR ANNOUNCEMENTS
+ // -- PROSECUTOR ANNOUNCEMENTS
- ui_casing_pro_lbl = new QLabel(ui_casing_widget);
- ui_casing_pro_lbl->setText(tr("Prosecution:"));
- ui_casing_pro_lbl->setToolTip(tr("If checked, you will get alerts about case "
- "announcements if a prosecutor spot is open."));
+ ui_casing_pro_lbl = new QLabel(ui_casing_widget);
+ ui_casing_pro_lbl->setText(tr("Prosecution:"));
+ ui_casing_pro_lbl->setToolTip(
+ tr("If checked, you will get alerts about case "
+ "announcements if a prosecutor spot is open."));
- ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl);
+ ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl);
- ui_casing_pro_cb = new QCheckBox(ui_casing_widget);
- ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled());
+ ui_casing_pro_cb = new QCheckBox(ui_casing_widget);
+ ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled());
- ui_casing_layout->setWidget(3, QFormLayout::FieldRole, ui_casing_pro_cb);
+ ui_casing_layout->setWidget(3, QFormLayout::FieldRole, ui_casing_pro_cb);
- // -- JUDGE ANNOUNCEMENTS
+ // -- JUDGE ANNOUNCEMENTS
- ui_casing_jud_lbl = new QLabel(ui_casing_widget);
- ui_casing_jud_lbl->setText(tr("Judge:"));
- ui_casing_jud_lbl->setToolTip(tr("If checked, you will get alerts about case "
- "announcements if the judge spot is open."));
+ ui_casing_jud_lbl = new QLabel(ui_casing_widget);
+ ui_casing_jud_lbl->setText(tr("Judge:"));
+ ui_casing_jud_lbl->setToolTip(tr("If checked, you will get alerts about case "
+ "announcements if the judge spot is open."));
- ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl);
+ ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl);
- ui_casing_jud_cb = new QCheckBox(ui_casing_widget);
- ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled());
+ ui_casing_jud_cb = new QCheckBox(ui_casing_widget);
+ ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled());
- ui_casing_layout->setWidget(4, QFormLayout::FieldRole, ui_casing_jud_cb);
+ ui_casing_layout->setWidget(4, QFormLayout::FieldRole, ui_casing_jud_cb);
- // -- JUROR ANNOUNCEMENTS
+ // -- JUROR ANNOUNCEMENTS
- ui_casing_jur_lbl = new QLabel(ui_casing_widget);
- ui_casing_jur_lbl->setText(tr("Juror:"));
- ui_casing_jur_lbl->setToolTip(tr("If checked, you will get alerts about case "
- "announcements if a juror spot is open."));
+ ui_casing_jur_lbl = new QLabel(ui_casing_widget);
+ ui_casing_jur_lbl->setText(tr("Juror:"));
+ ui_casing_jur_lbl->setToolTip(tr("If checked, you will get alerts about case "
+ "announcements if a juror spot is open."));
- ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl);
+ ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl);
- ui_casing_jur_cb = new QCheckBox(ui_casing_widget);
- ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled());
+ ui_casing_jur_cb = new QCheckBox(ui_casing_widget);
+ ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled());
- ui_casing_layout->setWidget(5, QFormLayout::FieldRole, ui_casing_jur_cb);
+ ui_casing_layout->setWidget(5, QFormLayout::FieldRole, ui_casing_jur_cb);
- // -- STENO ANNOUNCEMENTS
+ // -- STENO ANNOUNCEMENTS
- ui_casing_steno_lbl = new QLabel(ui_casing_widget);
- ui_casing_steno_lbl->setText(tr("Stenographer:"));
- ui_casing_steno_lbl->setToolTip(tr("If checked, you will get alerts about case "
- "announcements if a stenographer spot is open."));
+ ui_casing_steno_lbl = new QLabel(ui_casing_widget);
+ ui_casing_steno_lbl->setText(tr("Stenographer:"));
+ ui_casing_steno_lbl->setToolTip(
+ tr("If checked, you will get alerts about case "
+ "announcements if a stenographer spot is open."));
- ui_casing_layout->setWidget(6, QFormLayout::LabelRole, ui_casing_steno_lbl);
+ ui_casing_layout->setWidget(6, QFormLayout::LabelRole, ui_casing_steno_lbl);
- ui_casing_steno_cb = new QCheckBox(ui_casing_widget);
- ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled());
+ ui_casing_steno_cb = new QCheckBox(ui_casing_widget);
+ ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled());
- ui_casing_layout->setWidget(6, QFormLayout::FieldRole, ui_casing_steno_cb);
+ ui_casing_layout->setWidget(6, QFormLayout::FieldRole, ui_casing_steno_cb);
- // -- CM ANNOUNCEMENTS
+ // -- CM ANNOUNCEMENTS
- ui_casing_cm_lbl = new QLabel(ui_casing_widget);
- ui_casing_cm_lbl->setText(tr("CM:"));
- ui_casing_cm_lbl->setToolTip(tr("If checked, you will appear amongst the potential "
- "CMs on the server."));
+ ui_casing_cm_lbl = new QLabel(ui_casing_widget);
+ ui_casing_cm_lbl->setText(tr("CM:"));
+ ui_casing_cm_lbl->setToolTip(
+ tr("If checked, you will appear amongst the potential "
+ "CMs on the server."));
- ui_casing_layout->setWidget(7, QFormLayout::LabelRole, ui_casing_cm_lbl);
+ ui_casing_layout->setWidget(7, QFormLayout::LabelRole, ui_casing_cm_lbl);
- ui_casing_cm_cb = new QCheckBox(ui_casing_widget);
- ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled());
+ ui_casing_cm_cb = new QCheckBox(ui_casing_widget);
+ ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled());
- ui_casing_layout->setWidget(7, QFormLayout::FieldRole, ui_casing_cm_cb);
+ ui_casing_layout->setWidget(7, QFormLayout::FieldRole, ui_casing_cm_cb);
- // -- CM CASES ANNOUNCEMENTS
+ // -- CM CASES ANNOUNCEMENTS
- ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget);
- ui_casing_cm_cases_lbl->setText(tr("Hosting cases:"));
- ui_casing_cm_cases_lbl->setToolTip(tr("If you're a CM, enter what cases you are "
- "willing to host."));
+ ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget);
+ ui_casing_cm_cases_lbl->setText(tr("Hosting cases:"));
+ ui_casing_cm_cases_lbl->setToolTip(
+ tr("If you're a CM, enter what cases you are "
+ "willing to host."));
- ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_cm_cases_lbl);
+ ui_casing_layout->setWidget(8, QFormLayout::LabelRole,
+ ui_casing_cm_cases_lbl);
- ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget);
- ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases());
+ ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget);
+ ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases());
- ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_cm_cases_textbox);
+ ui_casing_layout->setWidget(8, QFormLayout::FieldRole,
+ ui_casing_cm_cases_textbox);
- // When we're done, we should continue the updates!
- setUpdatesEnabled(true);
+ // When we're done, we should continue the updates!
+ setUpdatesEnabled(true);
}
void AOOptionsDialog::save_pressed()
{
- // Save everything into the config.ini.
- QSettings* configini = ao_app->configini;
-
- configini->setValue("theme", ui_theme_combobox->currentText());
- configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked());
- configini->setValue("log_maximum", ui_length_spinbox->value());
- configini->setValue("default_username", ui_username_textbox->text());
- configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
- configini->setValue("master", ui_ms_textbox->text());
- configini->setValue("discord", ui_discord_cb->isChecked());
-
- QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");
-
- if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text))
- {
- // Nevermind!
- }
- else
- {
- QTextStream out(callwordsini);
- out << ui_callwords_textbox->toPlainText();
- callwordsini->close();
- }
-
- configini->setValue("default_audio_device", ui_audio_device_combobox->currentText());
- configini->setValue("default_music", ui_music_volume_spinbox->value());
- configini->setValue("default_sfx", ui_sfx_volume_spinbox->value());
- configini->setValue("default_blip", ui_blips_volume_spinbox->value());
- configini->setValue("blip_rate", ui_bliprate_spinbox->value());
- configini->setValue("blank_blip", ui_blank_blips_cb->isChecked());
-
- configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked());
- configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked());
- configini->setValue("casing_prosecution_enabled", ui_casing_pro_cb->isChecked());
- configini->setValue("casing_judge_enabled", ui_casing_jud_cb->isChecked());
- configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked());
- configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked());
- configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked());
- configini->setValue("casing_can_host_cases", ui_casing_cm_cases_textbox->text());
-
+ // Save everything into the config.ini.
+ QSettings *configini = ao_app->configini;
+
+ configini->setValue("theme", ui_theme_combobox->currentText());
+ configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked());
+ configini->setValue("log_maximum", ui_length_spinbox->value());
+ configini->setValue("default_username", ui_username_textbox->text());
+ configini->setValue("show_custom_shownames", ui_showname_cb->isChecked());
+ configini->setValue("master", ui_ms_textbox->text());
+ configini->setValue("discord", ui_discord_cb->isChecked());
+
+ QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");
+
+ if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate |
+ QIODevice::Text)) {
+ // Nevermind!
+ }
+ else {
+ QTextStream out(callwordsini);
+ out << ui_callwords_textbox->toPlainText();
callwordsini->close();
- done(0);
+ }
+
+ configini->setValue("default_audio_device",
+ ui_audio_device_combobox->currentText());
+ configini->setValue("default_music", ui_music_volume_spinbox->value());
+ configini->setValue("default_sfx", ui_sfx_volume_spinbox->value());
+ configini->setValue("default_blip", ui_blips_volume_spinbox->value());
+ configini->setValue("blip_rate", ui_bliprate_spinbox->value());
+ configini->setValue("blank_blip", ui_blank_blips_cb->isChecked());
+
+ configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked());
+ configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked());
+ configini->setValue("casing_prosecution_enabled",
+ ui_casing_pro_cb->isChecked());
+ configini->setValue("casing_judge_enabled", ui_casing_jud_cb->isChecked());
+ configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked());
+ configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked());
+ configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked());
+ configini->setValue("casing_can_host_cases",
+ ui_casing_cm_cases_textbox->text());
+
+ callwordsini->close();
+ done(0);
}
-void AOOptionsDialog::discard_pressed()
-{
- done(0);
-}
+void AOOptionsDialog::discard_pressed() { done(0); }
-#if (defined (_WIN32) || defined (_WIN64))
-bool AOOptionsDialog::needs_default_audiodev()
-{
- return true;
-}
-#elif (defined (LINUX) || defined (__linux__))
-bool AOOptionsDialog::needs_default_audiodev()
-{
- return false;
-}
+#if (defined(_WIN32) || defined(_WIN64))
+bool AOOptionsDialog::needs_default_audiodev() { return true; }
+#elif (defined(LINUX) || defined(__linux__))
+bool AOOptionsDialog::needs_default_audiodev() { return false; }
#elif defined __APPLE__
-bool AOOptionsDialog::needs_default_audiodev()
-{
- return true;
-}
+bool AOOptionsDialog::needs_default_audiodev() { return true; }
#else
#error This operating system is not supported.
#endif
diff --git a/src/aopacket.cpp b/src/aopacket.cpp
index b957efea..6afd39e7 100644
--- a/src/aopacket.cpp
+++ b/src/aopacket.cpp
@@ -8,8 +8,7 @@ AOPacket::AOPacket(QString p_packet_string)
m_header = packet_contents.at(0);
- for(int n_string = 1 ; n_string < packet_contents.size() - 1 ; ++n_string)
- {
+ for (int n_string = 1; n_string < packet_contents.size() - 1; ++n_string) {
m_contents.append(packet_contents.at(n_string));
}
}
@@ -20,23 +19,18 @@ AOPacket::AOPacket(QString p_header, QStringList &p_contents)
m_contents = p_contents;
}
-AOPacket::~AOPacket()
-{
-
-}
+AOPacket::~AOPacket() {}
QString AOPacket::to_string()
{
QString f_string = m_header;
- for (QString i_string : m_contents)
- {
+ for (QString i_string : m_contents) {
f_string += ("#" + i_string);
}
f_string += "#%";
-
if (encrypted)
return "#" + f_string;
else
@@ -59,10 +53,12 @@ void AOPacket::decrypt_header(unsigned int p_key)
void AOPacket::net_encode()
{
- for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
- {
+ for (int n_element = 0; n_element < m_contents.size(); ++n_element) {
QString f_element = m_contents.at(n_element);
- f_element.replace("#", "<num>").replace("%", "<percent>").replace("$", "<dollar>").replace("&", "<and>");
+ f_element.replace("#", "<num>")
+ .replace("%", "<percent>")
+ .replace("$", "<dollar>")
+ .replace("&", "<and>");
m_contents.removeAt(n_element);
m_contents.insert(n_element, f_element);
@@ -71,13 +67,14 @@ void AOPacket::net_encode()
void AOPacket::net_decode()
{
- for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
- {
+ for (int n_element = 0; n_element < m_contents.size(); ++n_element) {
QString f_element = m_contents.at(n_element);
- f_element.replace("<num>", "#").replace("<percent>", "%").replace("<dollar>", "$").replace("<and>", "&");
+ f_element.replace("<num>", "#")
+ .replace("<percent>", "%")
+ .replace("<dollar>", "$")
+ .replace("<and>", "&");
m_contents.removeAt(n_element);
m_contents.insert(n_element, f_element);
}
}
-
diff --git a/src/aoscene.cpp b/src/aoscene.cpp
index 344522b6..aad6c103 100644
--- a/src/aoscene.cpp
+++ b/src/aoscene.cpp
@@ -12,7 +12,8 @@ AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
void AOScene::set_image(QString p_image)
{
QString background_path = ao_app->get_background_path(p_image + ".png");
- QString animated_background_path = ao_app->get_background_path(p_image + ".gif");
+ QString animated_background_path =
+ ao_app->get_background_path(p_image + ".gif");
QString default_path = ao_app->get_default_background_path(p_image + ".png");
QPixmap background(background_path);
@@ -28,25 +29,22 @@ void AOScene::set_image(QString p_image)
m_movie->setFileName(animated_background_path);
m_movie->setScaledSize(QSize(w, h));
- if (m_movie->isValid())
- {
+ if (m_movie->isValid()) {
this->setMovie(m_movie);
m_movie->start();
}
- else if (file_exists(background_path))
- {
+ else if (file_exists(background_path)) {
this->setPixmap(background.scaled(w, h));
}
- else
- {
+ else {
this->setPixmap(default_bg.scaled(w, h));
}
}
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.
+ // 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 default_path = ao_app->get_default_background_path(p_image);
@@ -61,16 +59,16 @@ void AOScene::set_legacy_desk(QString p_image)
int vp_width = m_parent->width();
int vp_height = m_parent->height();
- //double y_modifier = 147 / 192;
- //double w_modifier = vp_width / 256;
+ // double y_modifier = 147 / 192;
+ // double w_modifier = vp_width / 256;
double h_modifier = vp_height / 192;
- //int final_y = y_modifier * vp_height;
- //int final_w = w_modifier * f_desk.width();
+ // 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());
- //this->resize(final_w, final_h);
- //this->setPixmap(f_desk.scaled(final_w, final_h));
+ // this->resize(final_w, final_h);
+ // this->setPixmap(f_desk.scaled(final_w, final_h));
this->resize(vp_width, final_h);
this->setPixmap(f_desk.scaled(vp_width, final_h));
}
diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp
index 710d7a8a..543da5ca 100644
--- a/src/aosfxplayer.cpp
+++ b/src/aosfxplayer.cpp
@@ -1,7 +1,7 @@
#include "aosfxplayer.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)
{
m_parent = parent;
@@ -11,7 +11,7 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
{
BASS_ChannelStop(m_stream);
-
+
QString misc_path = "";
QString char_path = "";
QString sound_path = ao_app->get_sounds_path(p_sfx);
@@ -24,13 +24,15 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
QString f_path;
if (file_exists(char_path))
- f_path = char_path;
+ f_path = char_path;
else if (file_exists(misc_path))
f_path = misc_path;
else
f_path = sound_path;
- 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(m_volume);
@@ -39,10 +41,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
BASS_ChannelPlay(m_stream, false);
}
-void AOSfxPlayer::stop()
-{
- BASS_ChannelStop(m_stream);
-}
+void AOSfxPlayer::stop() { BASS_ChannelStop(m_stream); }
void AOSfxPlayer::set_volume(int p_value)
{
@@ -50,7 +49,7 @@ void AOSfxPlayer::set_volume(int p_value)
float volume = p_value / 100.0f;
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)
{
m_parent = parent;
@@ -73,26 +72,23 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
QString f_path;
if (file_exists(char_path))
- f_path = char_path;
+ f_path = char_path;
else if (file_exists(misc_path))
f_path = misc_path;
else
f_path = sound_path;
- if (file_exists(f_path)) //if its missing, it will glitch out
+ if (file_exists(f_path)) // if its missing, it will glitch out
{
- m_sfx.setSource(QUrl::fromLocalFile(f_path));
+ m_sfx.setSource(QUrl::fromLocalFile(f_path));
- set_volume(m_volume);
+ set_volume(m_volume);
- m_sfx.play();
+ m_sfx.play();
}
}
-void AOSfxPlayer::stop()
-{
- m_sfx.stop();
-}
+void AOSfxPlayer::stop() { m_sfx.stop(); }
void AOSfxPlayer::set_volume(int p_value)
{
@@ -106,18 +102,9 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *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::stop()
-{
-
-}
+void AOSfxPlayer::stop() {}
-void AOSfxPlayer::set_volume(int p_value)
-{
-
-}
+void AOSfxPlayer::set_volume(int p_value) {}
#endif
diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp
index 5e146326..ebc75e28 100644
--- a/src/aotextarea.cpp
+++ b/src/aotextarea.cpp
@@ -1,24 +1,26 @@
#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)
+void AOTextArea::append_chatmessage(QString p_name, QString p_message,
+ QString p_colour)
{
const QTextCursor old_cursor = this->textCursor();
const int old_scrollbar_value = this->verticalScrollBar()->value();
- const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum();
+ const bool is_scrolled_down =
+ old_scrollbar_value == this->verticalScrollBar()->maximum();
this->moveCursor(QTextCursor::End);
this->append("");
- this->insertHtml("<b><font color=" + p_colour + ">" + p_name.toHtmlEscaped() + "</font></b>:&nbsp;");
+ this->insertHtml("<b><font color=" + p_colour + ">" + p_name.toHtmlEscaped() +
+ "</font></b>:&nbsp;");
- //cheap workarounds ahoy
+ // cheap workarounds ahoy
p_message += " ";
- QString result = p_message.toHtmlEscaped().replace("\n", "<br>").replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>" );
+ QString result = p_message.toHtmlEscaped()
+ .replace("\n", "<br>")
+ .replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>");
this->insertHtml(result);
@@ -29,32 +31,35 @@ void AOTextArea::append_error(QString p_message)
{
const QTextCursor old_cursor = this->textCursor();
const int old_scrollbar_value = this->verticalScrollBar()->value();
- const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum();
+ const bool is_scrolled_down =
+ old_scrollbar_value == this->verticalScrollBar()->maximum();
this->moveCursor(QTextCursor::End);
this->append("");
p_message += " ";
- QString result = p_message.replace("\n", "<br>").replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>" );
+ QString result = p_message.replace("\n", "<br>")
+ .replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>");
this->insertHtml("<font color='red'>" + result + "</font>");
this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down);
}
-void AOTextArea::auto_scroll(QTextCursor old_cursor, int old_scrollbar_value, bool is_scrolled_down)
+void AOTextArea::auto_scroll(QTextCursor old_cursor, int old_scrollbar_value,
+ bool is_scrolled_down)
{
- if (old_cursor.hasSelection() || !is_scrolled_down)
- {
- // The user has selected text or scrolled away from the bottom: maintain position.
- this->setTextCursor(old_cursor);
- this->verticalScrollBar()->setValue(old_scrollbar_value);
+ if (old_cursor.hasSelection() || !is_scrolled_down) {
+ // The user has selected text or scrolled away from the bottom: maintain
+ // position.
+ this->setTextCursor(old_cursor);
+ this->verticalScrollBar()->setValue(old_scrollbar_value);
}
- else
- {
- // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom.
- this->moveCursor(QTextCursor::End);
- this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum());
+ else {
+ // The user hasn't selected any text and the scrollbar is at the bottom:
+ // scroll to the bottom.
+ this->moveCursor(QTextCursor::End);
+ this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum());
}
}
diff --git a/src/aotextedit.cpp b/src/aotextedit.cpp
index 30e48b73..22d9a62e 100644
--- a/src/aotextedit.cpp
+++ b/src/aotextedit.cpp
@@ -4,7 +4,7 @@ AOTextEdit::AOTextEdit(QWidget *parent) : QPlainTextEdit(parent)
{
this->setReadOnly(true);
- //connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed()));
+ // connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed()));
}
void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
@@ -14,8 +14,4 @@ void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
this->setReadOnly(false);
}
-void AOTextEdit::on_enter_pressed()
-{
- this->setReadOnly(true);
-}
-
+void AOTextEdit::on_enter_pressed() { this->setReadOnly(true); }
diff --git a/src/charselect.cpp b/src/charselect.cpp
index 4987cf57..c207d572 100644
--- a/src/charselect.cpp
+++ b/src/charselect.cpp
@@ -1,8 +1,8 @@
#include "courtroom.h"
#include "lobby.h"
-#include "file_functions.h"
#include "debug_functions.h"
+#include "file_functions.h"
#include "hardware_functions.h"
void Courtroom::construct_char_select()
@@ -44,27 +44,34 @@ void Courtroom::construct_char_select()
set_size_and_pos(ui_char_buttons, "char_buttons");
- connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked()));
+ connect(ui_back_to_lobby, SIGNAL(clicked()), this,
+ SLOT(on_back_to_lobby_clicked()));
- connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked()));
- connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked()));
+ connect(ui_char_select_left, SIGNAL(clicked()), this,
+ SLOT(on_char_select_left_clicked()));
+ connect(ui_char_select_right, SIGNAL(clicked()), this,
+ SLOT(on_char_select_right_clicked()));
connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked()));
- connect(ui_char_search, SIGNAL(textEdited(const QString&)), this, SLOT(on_char_search_changed()));
- connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, SLOT(on_char_passworded_clicked()));
- connect(ui_char_taken, SIGNAL(stateChanged(int)), this, SLOT(on_char_taken_clicked()));
+ connect(ui_char_search, SIGNAL(textEdited(const QString &)), this,
+ SLOT(on_char_search_changed()));
+ connect(ui_char_passworded, SIGNAL(stateChanged(int)), this,
+ SLOT(on_char_passworded_clicked()));
+ connect(ui_char_taken, SIGNAL(stateChanged(int)), this,
+ SLOT(on_char_taken_clicked()));
}
void Courtroom::set_char_select()
{
QString filename = "courtroom_design.ini";
- pos_size_type f_charselect = ao_app->get_element_dimensions("char_select", filename);
+ pos_size_type f_charselect =
+ ao_app->get_element_dimensions("char_select", filename);
- if (f_charselect.width < 0 || f_charselect.height < 0)
- {
- qDebug() << "W: did not find courtroom width or height in courtroom_design.ini!";
+ if (f_charselect.width < 0 || f_charselect.height < 0) {
+ qDebug()
+ << "W: did not find courtroom width or height in courtroom_design.ini!";
this->resize(714, 668);
}
else
@@ -85,25 +92,22 @@ void Courtroom::set_char_select_page()
ui_char_select_left->hide();
ui_char_select_right->hide();
- for (AOCharButton *i_button : ui_char_button_list)
- {
+ for (AOCharButton *i_button : ui_char_button_list) {
i_button->reset();
i_button->hide();
- i_button->move(0,0);
+ i_button->move(0, 0);
}
int total_pages = ui_char_button_list_filtered.size() / max_chars_on_page;
int chars_on_page = 0;
- if (ui_char_button_list_filtered.size() % max_chars_on_page != 0)
- {
+ if (ui_char_button_list_filtered.size() % max_chars_on_page != 0) {
++total_pages;
- //i. e. not on the last page
+ // i. e. not on the last page
if (total_pages > current_char_page + 1)
chars_on_page = max_chars_on_page;
else
chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page;
-
}
else
chars_on_page = max_chars_on_page;
@@ -119,23 +123,23 @@ void Courtroom::set_char_select_page()
void Courtroom::char_clicked(int n_char)
{
- QString char_ini_path = ao_app->get_character_path(char_list.at(n_char).name, "char.ini");
+ QString char_ini_path =
+ ao_app->get_character_path(char_list.at(n_char).name, "char.ini");
qDebug() << "char_ini_path" << char_ini_path;
- if (!file_exists(char_ini_path))
- {
+ if (!file_exists(char_ini_path)) {
call_notice("Could not find " + char_ini_path);
return;
}
- if (n_char == m_cid)
- {
+ if (n_char == m_cid) {
enter_courtroom(m_cid);
}
- else
- {
- ao_app->send_server_packet(new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" + QString::number(n_char) + "#" + get_hdid() + "#%"));
+ else {
+ ao_app->send_server_packet(
+ new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" +
+ QString::number(n_char) + "#" + get_hdid() + "#%"));
}
ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name);
@@ -143,126 +147,125 @@ void Courtroom::char_clicked(int n_char)
void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
{
- if (ui_char_button_list_filtered.size() == 0)
- return;
+ if (ui_char_button_list_filtered.size() == 0)
+ return;
- QPoint f_spacing = ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini");
+ QPoint f_spacing =
+ ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini");
- int x_spacing = f_spacing.x();
- int x_mod_count = 0;
+ int x_spacing = f_spacing.x();
+ int x_mod_count = 0;
- int y_spacing = f_spacing.y();
- int y_mod_count = 0;
+ int y_spacing = f_spacing.y();
+ int y_mod_count = 0;
- char_columns = ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) + 1;
- char_rows = ((ui_char_buttons->height() - button_height) / (y_spacing + button_height)) + 1;
+ char_columns =
+ ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) +
+ 1;
+ char_rows = ((ui_char_buttons->height() - button_height) /
+ (y_spacing + button_height)) +
+ 1;
- max_chars_on_page = char_columns * char_rows;
+ max_chars_on_page = char_columns * char_rows;
- int startout = starting;
- for (int n = starting ; n < startout+chars_on_this_page ; ++n)
- {
- int x_pos = (button_width + x_spacing) * x_mod_count;
- int y_pos = (button_height + y_spacing) * y_mod_count;
+ int startout = starting;
+ for (int n = starting; n < startout + chars_on_this_page; ++n) {
+ int x_pos = (button_width + x_spacing) * x_mod_count;
+ int y_pos = (button_height + y_spacing) * y_mod_count;
- ui_char_button_list_filtered.at(n)->move(x_pos, y_pos);
- ui_char_button_list_filtered.at(n)->show();
- ui_char_button_list_filtered.at(n)->apply_taken_image();
+ ui_char_button_list_filtered.at(n)->move(x_pos, y_pos);
+ ui_char_button_list_filtered.at(n)->show();
+ ui_char_button_list_filtered.at(n)->apply_taken_image();
- ++x_mod_count;
+ ++x_mod_count;
- if (x_mod_count == char_columns)
- {
- ++y_mod_count;
- x_mod_count = 0;
- }
+ if (x_mod_count == char_columns) {
+ ++y_mod_count;
+ x_mod_count = 0;
}
+ }
}
void Courtroom::character_loading_finished()
{
- // Zeroeth, we'll clear any leftover characters from previous server visits.
- ao_app->generated_chars = 0;
- if (ui_char_button_list.size() > 0)
- {
- foreach (AOCharButton* item, ui_char_button_list) {
- delete item;
- }
- ui_char_button_list.clear();
+ // Zeroeth, we'll clear any leftover characters from previous server visits.
+ ao_app->generated_chars = 0;
+ if (ui_char_button_list.size() > 0) {
+ foreach (AOCharButton *item, ui_char_button_list) {
+ delete item;
}
+ ui_char_button_list.clear();
+ }
- // First, we'll make all the character buttons in the very beginning.
- // 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++)
- {
- AOCharButton* char_button = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
- char_button->reset();
- char_button->hide();
- char_button->set_image(char_list.at(n).name);
- ui_char_button_list.append(char_button);
-
- connect(char_button, &AOCharButton::clicked, [this, n](){
- this->char_clicked(n);
- });
-
- // This part here serves as a way of showing to the player that the game is still running, it is
- // just loading the pictures of the characters.
- if (ao_app->lobby_constructed)
- {
- ao_app->generated_chars++;
- int total_loading_size = ao_app->char_list_size * 2 + ao_app->evidence_list_size + ao_app->music_list_size;
- int loading_value = int(((ao_app->loaded_chars + ao_app->generated_chars + ao_app->loaded_music + ao_app->loaded_evidence) / static_cast<double>(total_loading_size)) * 100);
- ao_app->w_lobby->set_loading_value(loading_value);
- ao_app->w_lobby->set_loading_text("Generating chars:\n" + QString::number(ao_app->generated_chars) + "/" + QString::number(ao_app->char_list_size));
- }
+ // First, we'll make all the character buttons in the very beginning.
+ // 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++) {
+ AOCharButton *char_button =
+ new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken);
+ char_button->reset();
+ char_button->hide();
+ char_button->set_image(char_list.at(n).name);
+ ui_char_button_list.append(char_button);
+
+ connect(char_button, &AOCharButton::clicked,
+ [this, n]() { this->char_clicked(n); });
+
+ // This part here serves as a way of showing to the player that the game is
+ // still running, it is just loading the pictures of the characters.
+ if (ao_app->lobby_constructed) {
+ ao_app->generated_chars++;
+ int total_loading_size = ao_app->char_list_size * 2 +
+ ao_app->evidence_list_size +
+ ao_app->music_list_size;
+ int loading_value =
+ int(((ao_app->loaded_chars + ao_app->generated_chars +
+ ao_app->loaded_music + ao_app->loaded_evidence) /
+ static_cast<double>(total_loading_size)) *
+ 100);
+ ao_app->w_lobby->set_loading_value(loading_value);
+ ao_app->w_lobby->set_loading_text(
+ "Generating chars:\n" + QString::number(ao_app->generated_chars) +
+ "/" + QString::number(ao_app->char_list_size));
}
+ }
- filter_character_list();
+ filter_character_list();
}
void Courtroom::filter_character_list()
{
- ui_char_button_list_filtered.clear();
- for (int i = 0; i < char_list.size(); i++)
- {
- AOCharButton* current_char = ui_char_button_list.at(i);
+ ui_char_button_list_filtered.clear();
+ for (int i = 0; i < char_list.size(); i++) {
+ AOCharButton *current_char = ui_char_button_list.at(i);
- // It seems passwording characters is unimplemented yet?
- // Until then, this will stay here, I suppose.
- //if (ui_char_passworded->isChecked() && character_is_passworded??)
- // continue;
+ // It seems passwording characters is unimplemented yet?
+ // Until then, this will stay here, I suppose.
+ // if (ui_char_passworded->isChecked() && character_is_passworded??)
+ // continue;
- if (!ui_char_taken->isChecked() && char_list.at(i).taken)
- continue;
+ if (!ui_char_taken->isChecked() && char_list.at(i).taken)
+ continue;
- if (!char_list.at(i).name.contains(ui_char_search->text(), Qt::CaseInsensitive))
- continue;
+ if (!char_list.at(i).name.contains(ui_char_search->text(),
+ Qt::CaseInsensitive))
+ continue;
- // We only really need to update the fact that a character is taken
- // for the buttons that actually appear.
- // You'd also update the passwordedness and etc. here later.
- current_char->reset();
- current_char->set_taken(char_list.at(i).taken);
+ // We only really need to update the fact that a character is taken
+ // for the buttons that actually appear.
+ // You'd also update the passwordedness and etc. here later.
+ current_char->reset();
+ current_char->set_taken(char_list.at(i).taken);
- ui_char_button_list_filtered.append(current_char);
- }
+ ui_char_button_list_filtered.append(current_char);
+ }
- current_char_page = 0;
- set_char_select_page();
+ current_char_page = 0;
+ set_char_select_page();
}
-void Courtroom::on_char_search_changed()
-{
- filter_character_list();
-}
+void Courtroom::on_char_search_changed() { filter_character_list(); }
-void Courtroom::on_char_passworded_clicked()
-{
- filter_character_list();
-}
+void Courtroom::on_char_passworded_clicked() { filter_character_list(); }
-void Courtroom::on_char_taken_clicked()
-{
- filter_character_list();
-}
+void Courtroom::on_char_taken_clicked() { filter_character_list(); }
diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp
index 6c861f01..be3be4a2 100644
--- a/src/chatlogpiece.cpp
+++ b/src/chatlogpiece.cpp
@@ -9,7 +9,8 @@ chatlogpiece::chatlogpiece()
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)
{
name = p_name;
showname = p_showname;
@@ -18,7 +19,8 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message
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, QDateTime p_datetime)
{
name = p_name;
showname = p_showname;
@@ -27,36 +29,17 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message
datetime = p_datetime.toUTC();
}
-QString chatlogpiece::get_name()
-{
- return name;
-}
+QString chatlogpiece::get_name() { return name; }
-QString chatlogpiece::get_showname()
-{
- return showname;
-}
+QString chatlogpiece::get_showname() { return showname; }
-QString chatlogpiece::get_message()
-{
- return message;
-}
+QString chatlogpiece::get_message() { return message; }
-QDateTime chatlogpiece::get_datetime()
-{
- return datetime;
-}
-
-bool chatlogpiece::get_is_song()
-{
- return is_song;
-}
+QDateTime chatlogpiece::get_datetime() { return datetime; }
-QString chatlogpiece::get_datetime_as_string()
-{
- return datetime.toString();
-}
+bool chatlogpiece::get_is_song() { return is_song; }
+QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); }
QString chatlogpiece::get_full()
{
diff --git a/src/courtroom.cpp b/src/courtroom.cpp
index cd01f64b..25b4826c 100644
--- a/src/courtroom.cpp
+++ b/src/courtroom.cpp
@@ -3,32 +3,29 @@
Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
{
ao_app = p_ao_app;
- #ifdef BASSAUDIO
+#ifdef BASSAUDIO
// Change the default audio output device to be the one the user has given
// in his config.ini file for now.
unsigned int a = 0;
BASS_DEVICEINFO info;
- if (ao_app->get_audio_output_device() == "default")
- {
- BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr);
- load_bass_opus_plugin();
- }
- else
- {
- for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
- {
- if (ao_app->get_audio_output_device() == info.name)
- {
- BASS_SetDevice(a);
- BASS_Init(static_cast<int>(a), 48000, BASS_DEVICE_LATENCY, nullptr, nullptr);
- load_bass_opus_plugin();
- qDebug() << info.name << "was set as the default audio output device.";
- break;
- }
+ if (ao_app->get_audio_output_device() == "default") {
+ BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr);
+ load_bass_opus_plugin();
+ }
+ else {
+ for (a = 0; BASS_GetDeviceInfo(a, &info); a++) {
+ if (ao_app->get_audio_output_device() == info.name) {
+ BASS_SetDevice(a);
+ BASS_Init(static_cast<int>(a), 48000, BASS_DEVICE_LATENCY, nullptr,
+ nullptr);
+ load_bass_opus_plugin();
+ qDebug() << info.name << "was set as the default audio output device.";
+ break;
}
+ }
}
- #endif
+#endif
keepalive_timer = new QTimer(this);
keepalive_timer->start(60000);
@@ -131,8 +128,8 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_ooc_chat_name->setMaxLength(30);
ui_ooc_chat_name->setText(p_ao_app->get_default_username());
- //ui_area_password = new QLineEdit(this);
- //ui_area_password->setFrame(false);
+ // ui_area_password = new QLineEdit(this);
+ // ui_area_password->setFrame(false);
ui_music_search = new QLineEdit(this);
ui_music_search->setFrame(false);
ui_music_search->setPlaceholderText(tr("Search"));
@@ -154,7 +151,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_pos_dropdown->addItem("sea");
ui_defense_bar = new AOImage(this, ao_app);
- ui_prosecution_bar = new AOImage(this, ao_app);
+ ui_prosecution_bar = new AOImage(this, ao_app);
ui_music_label = new QLabel(this);
ui_sfx_label = new QLabel(this);
@@ -244,7 +241,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ui_pair_list = new QListWidget(this);
ui_pair_offset_spinbox = new QSpinBox(this);
- ui_pair_offset_spinbox->setRange(-100,100);
+ ui_pair_offset_spinbox->setRange(-100, 100);
ui_pair_offset_spinbox->setSuffix("% offset");
ui_pair_button = new AOButton(this, ao_app);
@@ -259,81 +256,117 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done()));
connect(ui_vp_player_char, SIGNAL(done()), this, SLOT(preanim_done()));
- connect(text_delay_timer, SIGNAL(timeout()), this, SLOT(start_chat_ticking()));
+ connect(text_delay_timer, SIGNAL(timeout()), this,
+ SLOT(start_chat_ticking()));
connect(sfx_delay_timer, SIGNAL(timeout()), this, SLOT(play_sfx()));
connect(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick()));
connect(realization_timer, SIGNAL(timeout()), this, SLOT(realization_done()));
- connect(testimony_show_timer, SIGNAL(timeout()), this, SLOT(hide_testimony()));
- connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony()));
+ connect(testimony_show_timer, SIGNAL(timeout()), this,
+ SLOT(hide_testimony()));
+ connect(testimony_hide_timer, SIGNAL(timeout()), this,
+ SLOT(show_testimony()));
- connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked()));
- connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked()));
+ connect(ui_emote_left, SIGNAL(clicked()), this,
+ SLOT(on_emote_left_clicked()));
+ connect(ui_emote_right, SIGNAL(clicked()), this,
+ SLOT(on_emote_right_clicked()));
- connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int)));
- connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int)));
+ connect(ui_emote_dropdown, SIGNAL(activated(int)), this,
+ SLOT(on_emote_dropdown_changed(int)));
+ connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(on_pos_dropdown_changed(int)));
- connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex)));
+ connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this,
+ SLOT(on_mute_list_clicked(QModelIndex)));
- connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed()));
+ connect(ui_ic_chat_message, SIGNAL(returnPressed()), this,
+ SLOT(on_chat_return_pressed()));
- connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed()));
+ connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this,
+ SLOT(on_ooc_return_pressed()));
- connect(ui_music_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_music_list_double_clicked(QModelIndex)));
- connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_area_list_double_clicked(QModelIndex)));
+ connect(ui_music_list, SIGNAL(doubleClicked(QModelIndex)), this,
+ SLOT(on_music_list_double_clicked(QModelIndex)));
+ connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this,
+ SLOT(on_area_list_double_clicked(QModelIndex)));
connect(ui_hold_it, SIGNAL(clicked()), this, SLOT(on_hold_it_clicked()));
connect(ui_objection, SIGNAL(clicked()), this, SLOT(on_objection_clicked()));
connect(ui_take_that, SIGNAL(clicked()), this, SLOT(on_take_that_clicked()));
- connect(ui_custom_objection, SIGNAL(clicked()), this, SLOT(on_custom_objection_clicked()));
+ connect(ui_custom_objection, SIGNAL(clicked()), this,
+ SLOT(on_custom_objection_clicked()));
- connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked()));
+ connect(ui_realization, SIGNAL(clicked()), this,
+ SLOT(on_realization_clicked()));
connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked()));
- connect(ui_defense_minus, SIGNAL(clicked()), this, SLOT(on_defense_minus_clicked()));
- connect(ui_defense_plus, SIGNAL(clicked()), this, SLOT(on_defense_plus_clicked()));
- connect(ui_prosecution_minus, SIGNAL(clicked()), this, SLOT(on_prosecution_minus_clicked()));
- connect(ui_prosecution_plus, SIGNAL(clicked()), this, SLOT(on_prosecution_plus_clicked()));
-
- connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this, SLOT(on_text_color_changed(int)));
-
- connect(ui_music_slider, SIGNAL(valueChanged(int)), this, SLOT(on_music_slider_moved(int)));
- connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this, SLOT(on_sfx_slider_moved(int)));
- connect(ui_blip_slider, SIGNAL(valueChanged(int)), this, SLOT(on_blip_slider_moved(int)));
-
- connect(ui_log_limit_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_log_limit_changed(int)));
-
- connect(ui_ooc_toggle, SIGNAL(clicked()), this, SLOT(on_ooc_toggle_clicked()));
-
- connect(ui_music_search, SIGNAL(textChanged(QString)), this, SLOT(on_music_search_edited(QString)));
-
- connect(ui_witness_testimony, SIGNAL(clicked()), this, SLOT(on_witness_testimony_clicked()));
- connect(ui_cross_examination, SIGNAL(clicked()), this, SLOT(on_cross_examination_clicked()));
+ connect(ui_defense_minus, SIGNAL(clicked()), this,
+ SLOT(on_defense_minus_clicked()));
+ connect(ui_defense_plus, SIGNAL(clicked()), this,
+ SLOT(on_defense_plus_clicked()));
+ connect(ui_prosecution_minus, SIGNAL(clicked()), this,
+ SLOT(on_prosecution_minus_clicked()));
+ connect(ui_prosecution_plus, SIGNAL(clicked()), this,
+ SLOT(on_prosecution_plus_clicked()));
+
+ connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(on_text_color_changed(int)));
+
+ connect(ui_music_slider, SIGNAL(valueChanged(int)), this,
+ SLOT(on_music_slider_moved(int)));
+ connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this,
+ SLOT(on_sfx_slider_moved(int)));
+ connect(ui_blip_slider, SIGNAL(valueChanged(int)), this,
+ SLOT(on_blip_slider_moved(int)));
+
+ connect(ui_log_limit_spinbox, SIGNAL(valueChanged(int)), this,
+ SLOT(on_log_limit_changed(int)));
+
+ connect(ui_ooc_toggle, SIGNAL(clicked()), this,
+ SLOT(on_ooc_toggle_clicked()));
+
+ connect(ui_music_search, SIGNAL(textChanged(QString)), this,
+ SLOT(on_music_search_edited(QString)));
+
+ connect(ui_witness_testimony, SIGNAL(clicked()), this,
+ SLOT(on_witness_testimony_clicked()));
+ connect(ui_cross_examination, SIGNAL(clicked()), this,
+ SLOT(on_cross_examination_clicked()));
connect(ui_guilty, SIGNAL(clicked()), this, SLOT(on_guilty_clicked()));
- connect(ui_not_guilty, SIGNAL(clicked()), this, SLOT(on_not_guilty_clicked()));
+ connect(ui_not_guilty, SIGNAL(clicked()), this,
+ SLOT(on_not_guilty_clicked()));
- connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked()));
- connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked()));
+ connect(ui_change_character, SIGNAL(clicked()), this,
+ SLOT(on_change_character_clicked()));
+ connect(ui_reload_theme, SIGNAL(clicked()), this,
+ SLOT(on_reload_theme_clicked()));
connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked()));
connect(ui_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked()));
- connect(ui_announce_casing, SIGNAL(clicked()), this, SLOT(on_announce_casing_clicked()));
- connect(ui_switch_area_music, SIGNAL(clicked()), this, SLOT(on_switch_area_music_clicked()));
+ connect(ui_announce_casing, SIGNAL(clicked()), this,
+ SLOT(on_announce_casing_clicked()));
+ connect(ui_switch_area_music, SIGNAL(clicked()), this,
+ SLOT(on_switch_area_music_clicked()));
connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked()));
connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked()));
connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked()));
connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked()));
- connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked()));
+ connect(ui_showname_enable, SIGNAL(clicked()), this,
+ SLOT(on_showname_enable_clicked()));
connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked()));
- connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_pair_list_clicked(QModelIndex)));
- connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_pair_offset_changed(int)));
+ connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this,
+ SLOT(on_pair_list_clicked(QModelIndex)));
+ connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this,
+ SLOT(on_pair_offset_changed(int)));
- connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked()));
+ connect(ui_evidence_button, SIGNAL(clicked()), this,
+ SLOT(on_evidence_button_clicked()));
set_widgets();
@@ -344,9 +377,8 @@ void Courtroom::set_mute_list()
{
mute_map.clear();
- //maps which characters are muted based on cid, none are muted by default
- for (int n_cid = 0 ; n_cid < char_list.size() ; n_cid++)
- {
+ // maps which characters are muted based on cid, none are muted by default
+ for (int n_cid = 0; n_cid < char_list.size(); n_cid++) {
mute_map.insert(n_cid, false);
}
@@ -357,9 +389,8 @@ void Courtroom::set_mute_list()
sorted_mute_list.sort();
- for (QString i_name : sorted_mute_list)
- {
- //mute_map.insert(i_name, false);
+ for (QString i_name : sorted_mute_list) {
+ // mute_map.insert(i_name, false);
ui_mute_list->addItem(i_name);
}
}
@@ -373,8 +404,7 @@ void Courtroom::set_pair_list()
sorted_pair_list.sort();
- for (QString i_name : sorted_pair_list)
- {
+ for (QString i_name : sorted_pair_list) {
ui_pair_list->addItem(i_name);
}
}
@@ -386,16 +416,15 @@ void Courtroom::set_widgets()
QString filename = "courtroom_design.ini";
- pos_size_type f_courtroom = ao_app->get_element_dimensions("courtroom", filename);
+ pos_size_type f_courtroom =
+ ao_app->get_element_dimensions("courtroom", filename);
- if (f_courtroom.width < 0 || f_courtroom.height < 0)
- {
+ if (f_courtroom.width < 0 || f_courtroom.height < 0) {
qDebug() << "W: did not find courtroom width or height in " << filename;
this->resize(714, 668);
}
- else
- {
+ else {
m_courtroom_width = f_courtroom.width;
m_courtroom_height = f_courtroom.height;
@@ -411,17 +440,16 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_viewport, "viewport");
// If there is a point to it, show all CCCC features.
- // We also do this this soon so that set_size_and_pos can hide them all later, if needed.
- if (ao_app->cccc_ic_support_enabled)
- {
+ // We also do this this soon so that set_size_and_pos can hide them all later,
+ // if needed.
+ if (ao_app->cccc_ic_support_enabled) {
ui_pair_button->show();
ui_pre_non_interrupt->show();
ui_showname_enable->show();
ui_ic_chat_name->show();
ui_ic_chat_name->setEnabled(true);
}
- else
- {
+ else {
ui_pair_button->hide();
ui_pre_non_interrupt->hide();
ui_showname_enable->hide();
@@ -429,17 +457,16 @@ void Courtroom::set_widgets()
ui_ic_chat_name->setEnabled(false);
}
- if (ao_app->casing_alerts_enabled)
- {
+ if (ao_app->casing_alerts_enabled) {
ui_announce_casing->show();
}
- else
- {
+ else {
ui_announce_casing->hide();
}
// We also show the non-server-dependent client additions.
- // Once again, if the theme can't display it, set_move_and_pos will catch them.
+ // Once again, if the theme can't display it, set_move_and_pos will catch
+ // them.
ui_settings->show();
ui_log_limit_label->show();
ui_log_limit_spinbox->show();
@@ -454,13 +481,15 @@ void Courtroom::set_widgets()
ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height());
ui_vp_sideplayer_char->move(0, 0);
- ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height());
+ ui_vp_sideplayer_char->combo_resize(ui_viewport->width(),
+ ui_viewport->height());
- //the AO2 desk element
+ // the AO2 desk element
ui_vp_desk->move(0, 0);
ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height());
- //the size of the ui_vp_legacy_desk element relies on various factors and is set in set_scene()
+ // the size of the ui_vp_legacy_desk element relies on various factors and is
+ // set in set_scene()
double y_modifier = 147.0 / 192.0;
int final_y = static_cast<int>(y_modifier * ui_viewport->height());
@@ -514,21 +543,21 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_music_list, "music_list");
- if (is_ao2_bg)
- {
+ if (is_ao2_bg) {
set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message");
set_size_and_pos(ui_vp_chatbox, "ao2_chatbox");
set_size_and_pos(ui_ic_chat_name, "ao2_ic_chat_name");
}
- else
- {
+ else {
set_size_and_pos(ui_ic_chat_message, "ic_chat_message");
set_size_and_pos(ui_vp_chatbox, "chatbox");
set_size_and_pos(ui_ic_chat_name, "ic_chat_name");
}
- ui_ic_chat_message->setStyleSheet("QLineEdit{background-color: rgba(100, 100, 100, 255);}");
- ui_ic_chat_name->setStyleSheet("QLineEdit{background-color: rgba(180, 180, 180, 255);}");
+ ui_ic_chat_message->setStyleSheet(
+ "QLineEdit{background-color: rgba(100, 100, 100, 255);}");
+ ui_ic_chat_name->setStyleSheet(
+ "QLineEdit{background-color: rgba(180, 180, 180, 255);}");
ui_vp_chatbox->set_image("chatmed.png");
ui_vp_chatbox->hide();
@@ -542,7 +571,7 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_ooc_chat_name, "ooc_chat_name");
ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);");
- //set_size_and_pos(ui_area_password, "area_password");
+ // set_size_and_pos(ui_area_password, "area_password");
set_size_and_pos(ui_music_search, "music_search");
set_size_and_pos(ui_emotes, "emotes");
@@ -557,10 +586,12 @@ void Courtroom::set_widgets()
set_size_and_pos(ui_pos_dropdown, "pos_dropdown");
set_size_and_pos(ui_defense_bar, "defense_bar");
- ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state) + ".png");
+ ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state) +
+ ".png");
set_size_and_pos(ui_prosecution_bar, "prosecution_bar");
- ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state) + ".png");
+ ui_prosecution_bar->set_image(
+ "prosecutionbar" + QString::number(prosecution_bar_state) + ".png");
set_size_and_pos(ui_music_label, "music_label");
ui_music_label->setText("Music");
@@ -717,12 +748,13 @@ void Courtroom::set_fonts()
// Set color of labels and checkboxes
const QString design_file = "courtroom_fonts.ini";
QColor f_color = ao_app->get_color("label_color", design_file);
- QString color_string = "color: rgba(" +
- QString::number(f_color.red()) + ", " +
- QString::number(f_color.green()) + ", " +
- QString::number(f_color.blue()) + ", 255); }";
- QString style_sheet_string = "QLabel {" + color_string + "}"
- "QCheckBox {" + color_string + "}";
+ QString color_string = "color: rgba(" + QString::number(f_color.red()) +
+ ", " + QString::number(f_color.green()) + ", " +
+ QString::number(f_color.blue()) + ", 255); }";
+ QString style_sheet_string = "QLabel {" + color_string +
+ "}"
+ "QCheckBox {" +
+ color_string + "}";
setStyleSheet(style_sheet_string);
}
@@ -733,16 +765,14 @@ void Courtroom::set_font(QWidget *widget, QString p_identifier)
QString class_name = widget->metaObject()->className();
QString fontt = ao_app->get_font_name(p_identifier + "_font", design_file);
- widget->setFont(QFont(fontt, f_weight));
-
+ widget->setFont(QFont(fontt, f_weight));
QColor f_color = ao_app->get_color(p_identifier + "_color", design_file);
- QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" +
- "color: rgba(" +
- QString::number(f_color.red()) + ", " +
- QString::number(f_color.green()) + ", " +
- QString::number(f_color.blue()) + ", 255); }";
+ QString style_sheet_string =
+ class_name + " { background-color: rgba(0, 0, 0, 0);\n" + "color: rgba(" +
+ QString::number(f_color.red()) + ", " + QString::number(f_color.green()) +
+ ", " + QString::number(f_color.blue()) + ", 255); }";
widget->setStyleSheet(style_sheet_string);
}
@@ -756,15 +786,14 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier)
{
QString filename = "courtroom_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;
p_widget->hide();
}
- else
- {
+ else {
p_widget->move(design_ini_result.x, design_ini_result.y);
p_widget->resize(design_ini_result.width, design_ini_result.height);
}
@@ -772,9 +801,9 @@ void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier)
void Courtroom::set_taken(int n_char, bool p_taken)
{
- if (n_char >= char_list.size())
- {
- qDebug() << "W: set_taken attempted to set an index bigger than char_list size";
+ if (n_char >= char_list.size()) {
+ qDebug()
+ << "W: set_taken attempted to set an index bigger than char_list size";
return;
}
@@ -818,32 +847,28 @@ void Courtroom::set_background(QString p_background)
file_exists(ao_app->get_background_path("prosecutiondesk.png")) &&
file_exists(ao_app->get_background_path("stand.png"));
- if (is_ao2_bg)
- {
+ if (is_ao2_bg) {
set_size_and_pos(ui_vp_chatbox, "ao2_chatbox");
set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message");
}
- else
- {
+ else {
set_size_and_pos(ui_vp_chatbox, "chatbox");
set_size_and_pos(ui_ic_chat_message, "ic_chat_message");
}
}
void Courtroom::enter_courtroom(int p_cid)
-{
+{
m_cid = p_cid;
QString f_char;
- if (m_cid == -1)
- {
+ if (m_cid == -1) {
if (ao_app->is_discord_enabled())
ao_app->discord->state_spectate();
f_char = "";
}
- else
- {
+ else {
f_char = ao_app->get_char_name(char_list.at(m_cid).name);
if (ao_app->is_discord_enabled())
@@ -870,8 +895,7 @@ void Courtroom::enter_courtroom(int p_cid)
QString side = ao_app->get_char_side(f_char);
- if (side == "jud")
- {
+ if (side == "jud") {
ui_witness_testimony->show();
ui_cross_examination->show();
ui_not_guilty->show();
@@ -881,8 +905,7 @@ void Courtroom::enter_courtroom(int p_cid)
ui_prosecution_minus->show();
ui_prosecution_plus->show();
}
- else
- {
+ else {
ui_witness_testimony->hide();
ui_cross_examination->hide();
ui_guilty->hide();
@@ -895,7 +918,7 @@ void Courtroom::enter_courtroom(int p_cid)
if (ao_app->custom_objection_enabled &&
(file_exists(ao_app->get_character_path(current_char, "custom.gif")) ||
- file_exists(ao_app->get_character_path(current_char, "custom.apng"))) &&
+ file_exists(ao_app->get_character_path(current_char, "custom.apng"))) &&
file_exists(ao_app->get_character_path(current_char, "custom.wav")))
ui_custom_objection->show();
else
@@ -923,7 +946,7 @@ void Courtroom::enter_courtroom(int p_cid)
set_widgets();
- //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml());
+ // ui_server_chatlog->setHtml(ui_server_chatlog->toHtml());
ui_char_select_background->hide();
@@ -943,14 +966,12 @@ void Courtroom::list_music()
int n_listed_songs = 0;
- for (int n_song = 0 ; n_song < music_list.size() ; ++n_song)
- {
+ for (int n_song = 0; n_song < music_list.size(); ++n_song) {
QString i_song = music_list.at(n_song);
QString i_song_listname = i_song;
i_song_listname = i_song_listname.left(i_song_listname.lastIndexOf("."));
- if (i_song.toLower().contains(ui_music_search->text().toLower()))
- {
+ if (i_song.toLower().contains(ui_music_search->text().toLower())) {
ui_music_list->addItem(i_song_listname);
music_row_to_number.append(n_song);
@@ -983,8 +1004,7 @@ void Courtroom::list_areas()
int n_listed_areas = 0;
- for (int n_area = 0 ; n_area < area_list.size() ; ++n_area)
- {
+ for (int n_area = 0; n_area < area_list.size(); ++n_area) {
QString i_area = "";
i_area.append("[");
i_area.append(QString::number(n_area));
@@ -992,8 +1012,7 @@ void Courtroom::list_areas()
i_area.append(area_list.at(n_area));
- if (ao_app->arup_enabled)
- {
+ if (ao_app->arup_enabled) {
i_area.append("\n ");
i_area.append(arup_statuses.at(n_area));
@@ -1008,35 +1027,30 @@ void Courtroom::list_areas()
i_area.append(arup_locks.at(n_area));
}
- if (i_area.toLower().contains(ui_music_search->text().toLower()))
- {
+ if (i_area.toLower().contains(ui_music_search->text().toLower())) {
ui_area_list->addItem(i_area);
area_row_to_number.append(n_area);
- if (ao_app->arup_enabled)
- {
+ if (ao_app->arup_enabled) {
// Colouring logic here.
ui_area_list->item(n_listed_areas)->setBackground(free_brush);
- if (arup_locks.at(n_area) == "LOCKED")
- {
- ui_area_list->item(n_listed_areas)->setBackground(locked_brush);
+ if (arup_locks.at(n_area) == "LOCKED") {
+ ui_area_list->item(n_listed_areas)->setBackground(locked_brush);
}
- else
- {
- if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS")
- ui_area_list->item(n_listed_areas)->setBackground(lfp_brush);
- else if (arup_statuses.at(n_area) == "CASING")
- ui_area_list->item(n_listed_areas)->setBackground(casing_brush);
- else if (arup_statuses.at(n_area) == "RECESS")
- ui_area_list->item(n_listed_areas)->setBackground(recess_brush);
- else if (arup_statuses.at(n_area) == "RP")
- ui_area_list->item(n_listed_areas)->setBackground(rp_brush);
- else if (arup_statuses.at(n_area) == "GAMING")
- ui_area_list->item(n_listed_areas)->setBackground(gaming_brush);
+ else {
+ if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS")
+ ui_area_list->item(n_listed_areas)->setBackground(lfp_brush);
+ else if (arup_statuses.at(n_area) == "CASING")
+ ui_area_list->item(n_listed_areas)->setBackground(casing_brush);
+ else if (arup_statuses.at(n_area) == "RECESS")
+ ui_area_list->item(n_listed_areas)->setBackground(recess_brush);
+ else if (arup_statuses.at(n_area) == "RP")
+ ui_area_list->item(n_listed_areas)->setBackground(rp_brush);
+ else if (arup_statuses.at(n_area) == "GAMING")
+ ui_area_list->item(n_listed_areas)->setBackground(gaming_brush);
}
}
- else
- {
+ else {
ui_area_list->item(n_listed_areas)->setBackground(free_brush);
}
@@ -1047,17 +1061,22 @@ void Courtroom::list_areas()
void Courtroom::append_ms_chatmessage(QString f_name, QString f_message)
{
- ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name());
+ ui_ms_chatlog->append_chatmessage(
+ f_name, f_message,
+ ao_app->get_color("ooc_default_color", "courtroom_design.ini").name());
}
-void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_colour)
+void Courtroom::append_server_chatmessage(QString p_name, QString p_message,
+ QString p_colour)
{
QString colour = "#000000";
if (p_colour == "0")
- colour = ao_app->get_color("ooc_default_color", "courtroom_design.ini").name();
+ colour =
+ ao_app->get_color("ooc_default_color", "courtroom_design.ini").name();
if (p_colour == "1")
- colour = ao_app->get_color("ooc_server_color", "courtroom_design.ini").name();
+ colour =
+ ao_app->get_color("ooc_server_color", "courtroom_design.ini").name();
ui_server_chatlog->append_chatmessage(p_name, p_message, colour);
}
@@ -1067,33 +1086,32 @@ void Courtroom::on_chat_return_pressed()
if (ui_ic_chat_message->text() == "" || is_muted)
return;
- if ((anim_state < 3 || text_state < 2) &&
- objection_state == 0)
+ if ((anim_state < 3 || text_state < 2) && objection_state == 0)
return;
- //MS#
- //deskmod#
- //pre-emote#
- //character#
- //emote#
- //message#
- //side#
- //sfx-name#
- //emote_modifier#
- //char_id#
- //sfx_delay#
- //objection_modifier#
- //evidence#
- //placeholder#
- //realization#
- //text_color#%
+ // MS#
+ // deskmod#
+ // pre-emote#
+ // character#
+ // emote#
+ // message#
+ // side#
+ // sfx-name#
+ // emote_modifier#
+ // char_id#
+ // sfx_delay#
+ // objection_modifier#
+ // evidence#
+ // placeholder#
+ // realization#
+ // text_color#%
// Additionally, in our case:
- //showname#
- //other_charid#
- //self_offset#
- //noninterrupting_preanim#%
+ // showname#
+ // other_charid#
+ // self_offset#
+ // noninterrupting_preanim#%
QStringList packet_contents;
@@ -1101,9 +1119,9 @@ void Courtroom::on_chat_return_pressed()
QString f_desk_mod = "chat";
- if (ao_app->desk_mod_enabled)
- {
- f_desk_mod = QString::number(ao_app->get_desk_mod(current_char, current_emote));
+ if (ao_app->desk_mod_enabled) {
+ f_desk_mod =
+ QString::number(ao_app->get_desk_mod(current_char, current_emote));
if (f_desk_mod == "-1")
f_desk_mod = "chat";
}
@@ -1124,26 +1142,22 @@ void Courtroom::on_chat_return_pressed()
int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote);
- //needed or else legacy won't understand what we're saying
- if (objection_state > 0)
- {
- if (ui_pre->isChecked())
- {
+ // needed or else legacy won't understand what we're saying
+ if (objection_state > 0) {
+ if (ui_pre->isChecked()) {
if (f_emote_mod == 5)
f_emote_mod = 6;
else
f_emote_mod = 2;
}
}
- else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked())
- {
+ else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked()) {
if (f_emote_mod == 0)
f_emote_mod = 1;
else if (f_emote_mod == 5 && ao_app->prezoom_enabled)
f_emote_mod = 4;
}
- else
- {
+ else {
if (f_emote_mod == 1)
f_emote_mod = 0;
else if (f_emote_mod == 4)
@@ -1153,12 +1167,13 @@ void Courtroom::on_chat_return_pressed()
packet_contents.append(QString::number(f_emote_mod));
packet_contents.append(QString::number(m_cid));
- packet_contents.append(QString::number(ao_app->get_sfx_delay(current_char, current_emote)));
+ packet_contents.append(
+ QString::number(ao_app->get_sfx_delay(current_char, current_emote)));
QString f_obj_state;
if ((objection_state == 4 && !ao_app->custom_objection_enabled) ||
- (objection_state < 0))
+ (objection_state < 0))
f_obj_state = "0";
else
f_obj_state = QString::number(objection_state);
@@ -1166,16 +1181,15 @@ void Courtroom::on_chat_return_pressed()
packet_contents.append(f_obj_state);
if (is_presenting_evidence)
- //the evidence index is shifted by 1 because 0 is no evidence per legacy standards
- //besides, older clients crash if we pass -1
+ // the evidence index is shifted by 1 because 0 is no evidence per legacy
+ // standards besides, older clients crash if we pass -1
packet_contents.append(QString::number(current_evidence + 1));
else
packet_contents.append("0");
QString f_flip;
- if (ao_app->flipping_enabled)
- {
+ if (ao_app->flipping_enabled) {
if (ui_flip->isChecked())
f_flip = "1";
else
@@ -1200,38 +1214,32 @@ void Courtroom::on_chat_return_pressed()
packet_contents.append(f_text_color);
// If the server we're on supports CCCC stuff, we should use it!
- if (ao_app->cccc_ic_support_enabled)
- {
- // If there is a showname entered, use that -- else, just send an empty packet-part.
- if (!ui_ic_chat_name->text().isEmpty())
- {
+ if (ao_app->cccc_ic_support_enabled) {
+ // If there is a showname entered, use that -- else, just send an empty
+ // packet-part.
+ if (!ui_ic_chat_name->text().isEmpty()) {
packet_contents.append(ui_ic_chat_name->text());
}
- else
- {
+ else {
packet_contents.append("");
}
- // Similarly, we send over whom we're paired with, unless we have chosen ourselves.
- // Or a charid of -1 or lower, through some means.
- if (other_charid > -1 && other_charid != m_cid)
- {
+ // Similarly, we send over whom we're paired with, unless we have chosen
+ // ourselves. Or a charid of -1 or lower, through some means.
+ if (other_charid > -1 && other_charid != m_cid) {
packet_contents.append(QString::number(other_charid));
packet_contents.append(QString::number(offset_with_pair));
}
- else
- {
+ else {
packet_contents.append("-1");
packet_contents.append("0");
}
// Finally, we send over if we want our pres to not interrupt.
- if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked())
- {
+ if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked()) {
packet_contents.append("1");
}
- else
- {
+ else {
packet_contents.append("0");
}
}
@@ -1247,21 +1255,19 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
if (p_contents->size() < 15)
return;
- for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string)
- {
- //m_chatmessage[n_string] = p_contents->at(n_string);
+ for (int n_string = 0; n_string < chatmessage_size; ++n_string) {
+ // m_chatmessage[n_string] = p_contents->at(n_string);
- // Note that we have added stuff that vanilla clients and servers simply won't send.
- // So now, we have to check if the thing we want even exists amongst the packet's content.
- // We also have to check if the server even supports CCCC's IC features, or if it's just japing us.
- // Also, don't forget! A size 15 message will have indices from 0 to 14.
+ // Note that we have added stuff that vanilla clients and servers simply
+ // won't send. So now, we have to check if the thing we want even exists
+ // amongst the packet's content. We also have to check if the server even
+ // supports CCCC's IC features, or if it's just japing us. Also, don't
+ // forget! A size 15 message will have indices from 0 to 14.
if (n_string < p_contents->size() &&
- (n_string < 15 || ao_app->cccc_ic_support_enabled))
- {
+ (n_string < 15 || ao_app->cccc_ic_support_enabled)) {
m_chatmessage[n_string] = p_contents->at(n_string);
}
- else
- {
+ else {
m_chatmessage[n_string] = "";
}
}
@@ -1275,16 +1281,13 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
return;
QString f_showname;
- if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())
- {
- f_showname = ao_app->get_showname(char_list.at(f_char_id).name);
+ if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) {
+ f_showname = ao_app->get_showname(char_list.at(f_char_id).name);
}
- else
- {
- f_showname = m_chatmessage[SHOWNAME];
+ else {
+ f_showname = m_chatmessage[SHOWNAME];
}
-
QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n';
if (f_message == previous_ic_message)
@@ -1297,10 +1300,11 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
chat_tick_timer->stop();
ui_vp_evidence_display->reset();
- chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == "";
+ chatmessage_is_empty =
+ m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == "";
- if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && m_chatmessage[CHAR_ID].toInt() == m_cid)
- {
+ if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() &&
+ m_chatmessage[CHAR_ID].toInt() == m_cid) {
ui_ic_chat_message->clear();
objection_state = 0;
realization_state = 0;
@@ -1314,11 +1318,13 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
ui_evidence_present->set_image("present_disabled.png");
}
- chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false);
+ chatlogpiece *temp =
+ new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name),
+ f_showname, ": " + m_chatmessage[MESSAGE], false);
ic_chatlog_history.append(*temp);
- while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0)
- {
+ while (ic_chatlog_history.size() > log_maximum_blocks &&
+ log_maximum_blocks > 0) {
ic_chatlog_history.removeFirst();
}
@@ -1330,11 +1336,9 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
QString f_char = m_chatmessage[CHAR_NAME];
QString f_custom_theme = ao_app->get_char_shouts(f_char);
- //if an objection is used
- if (objection_mod <= 4 && objection_mod >= 1)
- {
- switch (objection_mod)
- {
+ // if an objection is used
+ if (objection_mod <= 4 && objection_mod >= 1) {
+ switch (objection_mod) {
case 1:
ui_vp_objection->play("holdit", f_char, f_custom_theme);
objection_player->play("holdit.wav", f_char, f_custom_theme);
@@ -1347,7 +1351,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
ui_vp_objection->play("takethat", f_char, f_custom_theme);
objection_player->play("takethat.wav", f_char, f_custom_theme);
break;
- //case 4 is AO2 only
+ // case 4 is AO2 only
case 4:
ui_vp_objection->play("custom", f_char, f_custom_theme);
objection_player->play("custom.wav", f_char, f_custom_theme);
@@ -1365,27 +1369,22 @@ void Courtroom::handle_chatmessage(QStringList *p_contents)
handle_chatmessage_2();
}
-void Courtroom::objection_done()
-{
- handle_chatmessage_2();
-}
+void Courtroom::objection_done() { handle_chatmessage_2(); }
void Courtroom::handle_chatmessage_2()
{
ui_vp_speedlines->stop();
ui_vp_player_char->stop();
- if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked())
- {
- QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name;
+ if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) {
+ QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name;
- QString f_showname = ao_app->get_showname(real_name);
+ QString f_showname = ao_app->get_showname(real_name);
- ui_vp_showname->setText(f_showname);
+ ui_vp_showname->setText(f_showname);
}
- else
- {
- ui_vp_showname->setText(m_chatmessage[SHOWNAME]);
+ else {
+ ui_vp_showname->setText(m_chatmessage[SHOWNAME]);
}
ui_vp_message->clear();
@@ -1395,36 +1394,32 @@ void Courtroom::handle_chatmessage_2()
if (chatbox == "")
ui_vp_chatbox->set_image("chatmed.png");
- else
- {
- QString chatbox_path = ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png";
+ else {
+ QString chatbox_path =
+ ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png";
ui_vp_chatbox->set_image_from_path(chatbox_path);
}
- ui_vp_showname->setStyleSheet("QLabel { color : " + get_text_color("_showname").name() + "; }");
+ ui_vp_showname->setStyleSheet(
+ "QLabel { color : " + get_text_color("_showname").name() + "; }");
set_scene();
set_text_color();
// Check if the message needs to be centered.
QString f_message = m_chatmessage[MESSAGE];
- if (f_message.size() >= 2)
- {
- if (f_message.startsWith("~~"))
- {
- message_is_centered = true;
- }
- else
- {
- message_is_centered = false;
- }
+ if (f_message.size() >= 2) {
+ if (f_message.startsWith("~~")) {
+ message_is_centered = true;
+ }
+ else {
+ message_is_centered = false;
+ }
}
- else
- {
- ui_vp_message->setAlignment(Qt::AlignLeft);
+ else {
+ ui_vp_message->setAlignment(Qt::AlignLeft);
}
-
int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
if (ao_app->flipping_enabled && m_chatmessage[FLIP].toInt() == 1)
@@ -1435,98 +1430,91 @@ void Courtroom::handle_chatmessage_2()
QString side = m_chatmessage[SIDE];
// Making the second character appear.
- if (m_chatmessage[OTHER_CHARID].isEmpty())
- {
+ if (m_chatmessage[OTHER_CHARID].isEmpty()) {
// If there is no second character, hide 'em, and center the first.
ui_vp_sideplayer_char->hide();
- ui_vp_sideplayer_char->move(0,0);
+ ui_vp_sideplayer_char->move(0, 0);
- ui_vp_player_char->move(0,0);
+ ui_vp_player_char->move(0, 0);
}
- else
- {
+ else {
bool ok;
int got_other_charid = m_chatmessage[OTHER_CHARID].toInt(&ok);
- if (ok)
- {
- if (got_other_charid > -1)
- {
+ if (ok) {
+ if (got_other_charid > -1) {
// If there is, show them!
ui_vp_sideplayer_char->show();
- // Depending on where we are, we offset the characters, and reorder their stacking.
- if (side == "def")
- {
- // We also move the character down depending on how far the are to the right.
+ // Depending on where we are, we offset the characters, and reorder
+ // their stacking.
+ if (side == "def") {
+ // We also move the character down depending on how far the are to the
+ // right.
int hor_offset = m_chatmessage[SELF_OFFSET].toInt();
int vert_offset = 0;
- if (hor_offset > 0)
- {
+ if (hor_offset > 0) {
vert_offset = hor_offset / 10;
}
- ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100);
+ ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100,
+ ui_viewport->height() * vert_offset / 100);
// We do the same with the second character.
int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt();
int vert2_offset = 0;
- if (hor2_offset > 0)
- {
+ if (hor2_offset > 0) {
vert2_offset = hor2_offset / 10;
}
- ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100);
+ ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100,
+ ui_viewport->height() * vert2_offset /
+ 100);
// Finally, we reorder them based on who is more to the left.
// The person more to the left is more in the front.
- if (hor2_offset >= hor_offset)
- {
+ if (hor2_offset >= hor_offset) {
ui_vp_sideplayer_char->raise();
ui_vp_player_char->raise();
}
- else
- {
+ else {
ui_vp_player_char->raise();
ui_vp_sideplayer_char->raise();
}
ui_vp_desk->raise();
ui_vp_legacy_desk->raise();
}
- else if (side == "pro")
- {
+ else if (side == "pro") {
// Almost the same thing happens here, but in reverse.
int hor_offset = m_chatmessage[SELF_OFFSET].toInt();
int vert_offset = 0;
- if (hor_offset < 0)
- {
+ if (hor_offset < 0) {
// We don't want to RAISE the char off the floor.
vert_offset = -1 * hor_offset / 10;
}
- ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100);
+ ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100,
+ ui_viewport->height() * vert_offset / 100);
// We do the same with the second character.
int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt();
int vert2_offset = 0;
- if (hor2_offset < 0)
- {
+ if (hor2_offset < 0) {
vert2_offset = -1 * hor2_offset / 10;
}
- ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100);
+ ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100,
+ ui_viewport->height() * vert2_offset /
+ 100);
// Finally, we reorder them based on who is more to the right.
- if (hor2_offset <= hor_offset)
- {
+ if (hor2_offset <= hor_offset) {
ui_vp_sideplayer_char->raise();
ui_vp_player_char->raise();
}
- else
- {
+ else {
ui_vp_player_char->raise();
ui_vp_sideplayer_char->raise();
}
ui_vp_desk->raise();
ui_vp_legacy_desk->raise();
}
- else
- {
+ else {
// In every other case, the person more to the left is on top.
// These cases also don't move the characters down.
int hor_offset = m_chatmessage[SELF_OFFSET].toInt();
@@ -1534,17 +1522,16 @@ void Courtroom::handle_chatmessage_2()
// We do the same with the second character.
int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt();
- ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, 0);
+ ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100,
+ 0);
// Finally, we reorder them based on who is more to the left.
// The person more to the left is more in the front.
- if (hor2_offset >= hor_offset)
- {
+ if (hor2_offset >= hor_offset) {
ui_vp_sideplayer_char->raise();
ui_vp_player_char->raise();
}
- else
- {
+ else {
ui_vp_player_char->raise();
ui_vp_sideplayer_char->raise();
}
@@ -1556,26 +1543,28 @@ void Courtroom::handle_chatmessage_2()
ui_vp_sideplayer_char->set_flipped(true);
else
ui_vp_sideplayer_char->set_flipped(false);
- ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE]);
+ ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME],
+ m_chatmessage[OTHER_EMOTE]);
}
- else
- {
- // If the server understands other characters, but there
- // really is no second character, hide 'em, and center the first.
- ui_vp_sideplayer_char->hide();
- ui_vp_sideplayer_char->move(0,0);
+ else {
+ // If the server understands other characters, but there
+ // really is no second character, hide 'em, and center the first.
+ ui_vp_sideplayer_char->hide();
+ ui_vp_sideplayer_char->move(0, 0);
- ui_vp_player_char->move(0,0);
+ ui_vp_player_char->move(0, 0);
}
}
}
- switch (emote_mod)
- {
- case 1: case 2: case 6:
+ switch (emote_mod) {
+ case 1:
+ case 2:
+ case 6:
play_preanim(false);
break;
- case 0: case 5:
+ case 0:
+ case 5:
if (m_chatmessage[NONINTERRUPTING_PRE].toInt() == 0)
handle_chatmessage_3();
else
@@ -1593,51 +1582,45 @@ void Courtroom::handle_chatmessage_3()
int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt();
QString f_side = m_chatmessage[SIDE];
- if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size())
- {
- //shifted by 1 because 0 is no evidence per legacy standards
+ if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size()) {
+ // shifted by 1 because 0 is no evidence per legacy standards
QString f_image = local_evidence_list.at(f_evi_id - 1).image;
- //def jud and hlp should display the evidence icon on the RIGHT side
- bool is_left_side = !(f_side == "def" || f_side == "hlp" || f_side == "jud" || f_side == "jur");
- ui_vp_evidence_display->show_evidence(f_image, is_left_side, ui_sfx_slider->value());
+ // def jud and hlp should display the evidence icon on the RIGHT side
+ bool is_left_side = !(f_side == "def" || f_side == "hlp" ||
+ f_side == "jud" || f_side == "jur");
+ ui_vp_evidence_display->show_evidence(f_image, is_left_side,
+ ui_sfx_slider->value());
}
int emote_mod = m_chatmessage[EMOTE_MOD].toInt();
QString side = m_chatmessage[SIDE];
- if (emote_mod == 5 ||
- emote_mod == 6)
- {
+ if (emote_mod == 5 || emote_mod == 6) {
ui_vp_desk->hide();
ui_vp_legacy_desk->hide();
// Since we're zooming, hide the second character, and centre the first.
- ui_vp_sideplayer_char->hide();
- ui_vp_player_char->move(0,0);
+ ui_vp_sideplayer_char->hide();
+ ui_vp_player_char->move(0, 0);
- if (side == "pro" ||
- side == "hlp" ||
- side == "wit")
+ if (side == "pro" || side == "hlp" || side == "wit")
ui_vp_speedlines->play("prosecution_speedlines");
else
ui_vp_speedlines->play("defense_speedlines");
-
}
int f_anim_state = 0;
- //BLUE is from an enum in datatypes.h
+ // BLUE is from an enum in datatypes.h
bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE;
- if (!text_is_blue && text_state == 1)
- {
- //talking
+ if (!text_is_blue && text_state == 1) {
+ // talking
f_anim_state = 2;
entire_message_is_blue = false;
}
- else
- {
- //idle
+ else {
+ // idle
f_anim_state = 3;
entire_message_is_blue = true;
}
@@ -1653,8 +1636,7 @@ void Courtroom::handle_chatmessage_3()
ui_vp_player_char->play_talking(f_char, f_emote);
anim_state = 2;
}
- else
- {
+ else {
ui_vp_player_char->play_idle(f_char, f_emote);
anim_state = 3;
}
@@ -1662,31 +1644,27 @@ void Courtroom::handle_chatmessage_3()
QString f_message = m_chatmessage[MESSAGE];
QStringList call_words = ao_app->get_call_words();
- for (QString word : call_words)
- {
- if (f_message.contains(word, Qt::CaseInsensitive))
- {
+ for (QString word : call_words) {
+ if (f_message.contains(word, Qt::CaseInsensitive)) {
modcall_player->play(ao_app->get_sfx("word_call"));
ao_app->alert(this);
break;
}
}
-
}
QString Courtroom::filter_ic_text(QString p_text)
{
// Get rid of centering.
- if(p_text.startsWith(": ~~"))
- {
- // Don't forget, the p_text part actually everything after the name!
- // Hence why we check for ': ~~'.
+ if (p_text.startsWith(": ~~")) {
+ // Don't forget, the p_text part actually everything after the name!
+ // Hence why we check for ': ~~'.
- // Let's remove those two tildes, then.
- // : _ ~ ~
- // 0 1 2 3
- p_text.remove(2,2);
+ // Let's remove those two tildes, then.
+ // : _ ~ ~
+ // 0 1 2 3
+ p_text.remove(2, 2);
}
// Get rid of the inline-colouring.
@@ -1696,123 +1674,101 @@ QString Courtroom::filter_ic_text(QString p_text)
bool ic_next_is_not_special = false;
QString f_character = p_text.at(trick_check_pos);
std::stack<INLINE_COLOURS> ic_colour_stack;
- while (trick_check_pos < p_text.size())
- {
- f_character = p_text.at(trick_check_pos);
-
- // Escape character.
- if (f_character == "\\" and !ic_next_is_not_special)
- {
- ic_next_is_not_special = true;
- p_text.remove(trick_check_pos,1);
- }
+ while (trick_check_pos < p_text.size()) {
+ f_character = p_text.at(trick_check_pos);
- // Text speed modifier.
- else if (f_character == "{" and !ic_next_is_not_special)
- {
- p_text.remove(trick_check_pos,1);
- }
- else if (f_character == "}" and !ic_next_is_not_special)
- {
- p_text.remove(trick_check_pos,1);
- }
+ // Escape character.
+ if (f_character == "\\" and !ic_next_is_not_special) {
+ ic_next_is_not_special = true;
+ p_text.remove(trick_check_pos, 1);
+ }
- // Orange inline colourisation.
- else if (f_character == "|" and !ic_next_is_not_special)
- {
- if (!ic_colour_stack.empty())
- {
- if (ic_colour_stack.top() == INLINE_ORANGE)
- {
- ic_colour_stack.pop();
- p_text.remove(trick_check_pos,1);
- }
- else
- {
- ic_colour_stack.push(INLINE_ORANGE);
- p_text.remove(trick_check_pos,1);
- }
- }
- else
- {
- ic_colour_stack.push(INLINE_ORANGE);
- p_text.remove(trick_check_pos,1);
- }
+ // Text speed modifier.
+ else if (f_character == "{" and !ic_next_is_not_special) {
+ p_text.remove(trick_check_pos, 1);
+ }
+ else if (f_character == "}" and !ic_next_is_not_special) {
+ p_text.remove(trick_check_pos, 1);
+ }
+
+ // Orange inline colourisation.
+ else if (f_character == "|" and !ic_next_is_not_special) {
+ if (!ic_colour_stack.empty()) {
+ if (ic_colour_stack.top() == INLINE_ORANGE) {
+ ic_colour_stack.pop();
+ p_text.remove(trick_check_pos, 1);
+ }
+ else {
+ ic_colour_stack.push(INLINE_ORANGE);
+ p_text.remove(trick_check_pos, 1);
+ }
+ }
+ else {
+ ic_colour_stack.push(INLINE_ORANGE);
+ p_text.remove(trick_check_pos, 1);
}
+ }
- // Blue inline colourisation.
- else if (f_character == "(" and !ic_next_is_not_special)
- {
- ic_colour_stack.push(INLINE_BLUE);
- trick_check_pos++;
+ // Blue inline colourisation.
+ else if (f_character == "(" and !ic_next_is_not_special) {
+ ic_colour_stack.push(INLINE_BLUE);
+ trick_check_pos++;
+ }
+ else if (f_character == ")" and !ic_next_is_not_special and
+ !ic_colour_stack.empty()) {
+ if (ic_colour_stack.top() == INLINE_BLUE) {
+ ic_colour_stack.pop();
+ trick_check_pos++;
}
- else if (f_character == ")" and !ic_next_is_not_special
- and !ic_colour_stack.empty())
- {
- if (ic_colour_stack.top() == INLINE_BLUE)
- {
- ic_colour_stack.pop();
- trick_check_pos++;
- }
- else
- {
- ic_next_is_not_special = true;
- }
+ else {
+ ic_next_is_not_special = true;
}
+ }
- // Grey inline colourisation.
- else if (f_character == "[" and !ic_next_is_not_special)
- {
- ic_colour_stack.push(INLINE_GREY);
- trick_check_pos++;
+ // Grey inline colourisation.
+ else if (f_character == "[" and !ic_next_is_not_special) {
+ ic_colour_stack.push(INLINE_GREY);
+ trick_check_pos++;
+ }
+ else if (f_character == "]" and !ic_next_is_not_special and
+ !ic_colour_stack.empty()) {
+ if (ic_colour_stack.top() == INLINE_GREY) {
+ ic_colour_stack.pop();
+ trick_check_pos++;
}
- else if (f_character == "]" and !ic_next_is_not_special
- and !ic_colour_stack.empty())
- {
- if (ic_colour_stack.top() == INLINE_GREY)
- {
- ic_colour_stack.pop();
- trick_check_pos++;
- }
- else
- {
- ic_next_is_not_special = true;
- }
+ else {
+ ic_next_is_not_special = true;
}
+ }
- // Green inline colourisation.
- else if (f_character == "`" and !ic_next_is_not_special)
- {
- if (!ic_colour_stack.empty())
- {
- if (ic_colour_stack.top() == INLINE_GREEN)
- {
- ic_colour_stack.pop();
- p_text.remove(trick_check_pos,1);
- }
- else
- {
- ic_colour_stack.push(INLINE_GREEN);
- p_text.remove(trick_check_pos,1);
- }
- }
- else
- {
- ic_colour_stack.push(INLINE_GREEN);
- p_text.remove(trick_check_pos,1);
- }
+ // Green inline colourisation.
+ else if (f_character == "`" and !ic_next_is_not_special) {
+ if (!ic_colour_stack.empty()) {
+ if (ic_colour_stack.top() == INLINE_GREEN) {
+ ic_colour_stack.pop();
+ p_text.remove(trick_check_pos, 1);
+ }
+ else {
+ ic_colour_stack.push(INLINE_GREEN);
+ p_text.remove(trick_check_pos, 1);
+ }
}
- else
- {
- trick_check_pos++;
- ic_next_is_not_special = false;
+ else {
+ ic_colour_stack.push(INLINE_GREEN);
+ p_text.remove(trick_check_pos, 1);
}
+ }
+ else {
+ trick_check_pos++;
+ ic_next_is_not_special = false;
+ }
}
return p_text;
}
-void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchange)
+void Courtroom::append_ic_text(QString p_text, QString p_name,
+ bool is_songchange)
{
QTextCharFormat bold;
QTextCharFormat normal;
@@ -1826,95 +1782,94 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang
if (!is_songchange)
p_text = filter_ic_text(p_text);
- if (log_goes_downwards)
- {
- const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum();
+ if (log_goes_downwards) {
+ const bool is_scrolled_down =
+ old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum();
- ui_ic_chatlog->moveCursor(QTextCursor::End);
+ ui_ic_chatlog->moveCursor(QTextCursor::End);
- if (!first_message_sent)
- {
- ui_ic_chatlog->textCursor().insertText(p_name, bold);
- first_message_sent = true;
- }
- else
- {
- ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold);
- }
+ if (!first_message_sent) {
+ ui_ic_chatlog->textCursor().insertText(p_name, bold);
+ first_message_sent = true;
+ }
+ else {
+ ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold);
+ }
- if (is_songchange)
- {
- ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal);
- ui_ic_chatlog->textCursor().insertText(p_text + ".", italics);
- }
- else
- {
- ui_ic_chatlog->textCursor().insertText(p_text, normal);
- }
+ if (is_songchange) {
+ ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal);
+ ui_ic_chatlog->textCursor().insertText(p_text + ".", italics);
+ }
+ else {
+ ui_ic_chatlog->textCursor().insertText(p_text, normal);
+ }
- // If we got too many blocks in the current log, delete some from the top.
- while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0)
- {
- ui_ic_chatlog->moveCursor(QTextCursor::Start);
- ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor);
- ui_ic_chatlog->textCursor().removeSelectedText();
- ui_ic_chatlog->textCursor().deleteChar();
- //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks;
- }
+ // If we got too many blocks in the current log, delete some from the top.
+ while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks &&
+ log_maximum_blocks > 0) {
+ ui_ic_chatlog->moveCursor(QTextCursor::Start);
+ ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor);
+ ui_ic_chatlog->textCursor().removeSelectedText();
+ ui_ic_chatlog->textCursor().deleteChar();
+ // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " <<
+ // log_maximum_blocks;
+ }
- if (old_cursor.hasSelection() || !is_scrolled_down)
- {
- // The user has selected text or scrolled away from the bottom: maintain position.
- ui_ic_chatlog->setTextCursor(old_cursor);
- ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
- }
- else
- {
- // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom.
- ui_ic_chatlog->moveCursor(QTextCursor::End);
- ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum());
- }
+ if (old_cursor.hasSelection() || !is_scrolled_down) {
+ // The user has selected text or scrolled away from the bottom: maintain
+ // position.
+ ui_ic_chatlog->setTextCursor(old_cursor);
+ ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
+ }
+ else {
+ // The user hasn't selected any text and the scrollbar is at the bottom:
+ // scroll to the bottom.
+ ui_ic_chatlog->moveCursor(QTextCursor::End);
+ ui_ic_chatlog->verticalScrollBar()->setValue(
+ ui_ic_chatlog->verticalScrollBar()->maximum());
+ }
}
- else
- {
- const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum();
+ else {
+ const bool is_scrolled_up =
+ old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum();
- ui_ic_chatlog->moveCursor(QTextCursor::Start);
+ ui_ic_chatlog->moveCursor(QTextCursor::Start);
- ui_ic_chatlog->textCursor().insertText(p_name, bold);
+ ui_ic_chatlog->textCursor().insertText(p_name, bold);
- if (is_songchange)
- {
- ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal);
- ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics);
- }
- else
- {
- ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal);
- }
+ if (is_songchange) {
+ ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal);
+ ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics);
+ }
+ else {
+ ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal);
+ }
- // If we got too many blocks in the current log, delete some from the bottom.
- while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0)
- {
- ui_ic_chatlog->moveCursor(QTextCursor::End);
- ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor);
- ui_ic_chatlog->textCursor().removeSelectedText();
- ui_ic_chatlog->textCursor().deletePreviousChar();
- //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks;
- }
+ // If we got too many blocks in the current log, delete some from the
+ // bottom.
+ while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks &&
+ log_maximum_blocks > 0) {
+ ui_ic_chatlog->moveCursor(QTextCursor::End);
+ ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor);
+ ui_ic_chatlog->textCursor().removeSelectedText();
+ ui_ic_chatlog->textCursor().deletePreviousChar();
+ // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " <<
+ // log_maximum_blocks;
+ }
- if (old_cursor.hasSelection() || !is_scrolled_up)
- {
- // The user has selected text or scrolled away from the top: maintain position.
- ui_ic_chatlog->setTextCursor(old_cursor);
- ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
- }
- else
- {
- // The user hasn't selected any text and the scrollbar is at the top: scroll to the top.
- ui_ic_chatlog->moveCursor(QTextCursor::Start);
- ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum());
- }
+ if (old_cursor.hasSelection() || !is_scrolled_up) {
+ // The user has selected text or scrolled away from the top: maintain
+ // position.
+ ui_ic_chatlog->setTextCursor(old_cursor);
+ ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value);
+ }
+ else {
+ // The user hasn't selected any text and the scrollbar is at the top:
+ // scroll to the top.
+ ui_ic_chatlog->moveCursor(QTextCursor::Start);
+ ui_ic_chatlog->verticalScrollBar()->setValue(
+ ui_ic_chatlog->verticalScrollBar()->minimum());
+ }
}
}
@@ -1923,7 +1878,8 @@ void Courtroom::play_preanim(bool noninterrupting)
QString f_char = m_chatmessage[CHAR_NAME];
QString f_preanim = m_chatmessage[PRE_EMOTE];
- //all time values in char.inis are multiplied by a constant(time_mod) to get the actual time
+ // all time values in char.inis are multiplied by a constant(time_mod) to get
+ // the actual time
int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim);
int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod;
int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60;
@@ -1936,10 +1892,9 @@ void Courtroom::play_preanim(bool noninterrupting)
preanim_duration = ao2_duration;
sfx_delay_timer->start(sfx_delay);
- QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim));
- if (!file_exists(anim_to_find) ||
- preanim_duration < 0)
- {
+ QString anim_to_find =
+ ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim));
+ if (!file_exists(anim_to_find) || preanim_duration < 0) {
if (noninterrupting)
anim_state = 4;
else
@@ -1969,19 +1924,16 @@ void Courtroom::preanim_done()
handle_chatmessage_3();
}
-void Courtroom::realization_done()
-{
- ui_vp_realization->hide();
-}
+void Courtroom::realization_done() { ui_vp_realization->hide(); }
void Courtroom::start_chat_ticking()
{
- //we need to ensure that the text isn't already ticking because this function can be called by two logic paths
+ // we need to ensure that the text isn't already ticking because this function
+ // can be called by two logic paths
if (text_state != 0)
return;
- if (m_chatmessage[REALIZATION] == "1")
- {
+ if (m_chatmessage[REALIZATION] == "1") {
realization_timer->start(60);
ui_vp_realization->show();
sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME]));
@@ -1991,18 +1943,16 @@ void Courtroom::start_chat_ticking()
set_text_color();
rainbow_counter = 0;
- if (chatmessage_is_empty)
- {
- //since the message is empty, it's technically done ticking
+ if (chatmessage_is_empty) {
+ // since the message is empty, it's technically done ticking
text_state = 2;
return;
}
// At this point, we'd do well to clear the inline colour stack.
// This stops it from flowing into next messages.
- while (!inline_colour_stack.empty())
- {
- inline_colour_stack.pop();
+ while (!inline_colour_stack.empty()) {
+ inline_colour_stack.pop();
}
ui_vp_chatbox->show();
@@ -2010,8 +1960,8 @@ void Courtroom::start_chat_ticking()
tick_pos = 0;
blip_pos = 0;
- // Just in case we somehow got inline blue text left over from a previous message,
- // let's set it to false.
+ // Just in case we somehow got inline blue text left over from a previous
+ // message, let's set it to false.
inline_blue_depth = 0;
// At the start of every new message, we set the text speed to the default.
@@ -2022,14 +1972,14 @@ void Courtroom::start_chat_ticking()
blip_player->set_blips(ao_app->get_sfx_suffix("sfx-blip" + f_gender));
- //means text is currently ticking
+ // means text is currently ticking
text_state = 1;
}
void Courtroom::chat_tick()
{
- //note: this is called fairly often(every 60 ms when char is talking)
- //do not perform heavy operations here
+ // note: this is called fairly often(every 60 ms when char is talking)
+ // do not perform heavy operations here
QString f_message = m_chatmessage[MESSAGE];
f_message.remove(0, tick_pos);
@@ -2042,23 +1992,20 @@ void Courtroom::chat_tick()
// If previously, we have detected that the message is centered, now
// is the time to remove those two tildes at the start.
- if (message_is_centered)
- {
- f_message.remove(0,2);
+ if (message_is_centered) {
+ f_message.remove(0, 2);
}
- if (f_message.size() == 0)
- {
+ if (f_message.size() == 0) {
text_state = 2;
- if (anim_state != 4)
- {
+ if (anim_state != 4) {
anim_state = 3;
- ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]);
+ ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME],
+ m_chatmessage[EMOTE]);
}
}
- else
- {
+ else {
QTextBoundaryFinder tbf(QTextBoundaryFinder::Grapheme, f_message);
QString f_character;
int f_char_length;
@@ -2073,174 +2020,163 @@ void Courtroom::chat_tick()
f_char_length = f_character.length();
f_character = f_character.toHtmlEscaped();
-
if (f_character == " ")
ui_vp_message->insertPlainText(" ");
// Escape character.
- else if (f_character == "\\" and !next_character_is_not_special)
- {
- next_character_is_not_special = true;
- formatting_char = true;
+ else if (f_character == "\\" and !next_character_is_not_special) {
+ next_character_is_not_special = true;
+ formatting_char = true;
}
// Text speed modifier.
- else if (f_character == "{" and !next_character_is_not_special)
- {
- // ++, because it INCREASES delay!
- current_display_speed++;
- formatting_char = true;
+ else if (f_character == "{" and !next_character_is_not_special) {
+ // ++, because it INCREASES delay!
+ current_display_speed++;
+ formatting_char = true;
}
- else if (f_character == "}" and !next_character_is_not_special)
- {
- current_display_speed--;
- formatting_char = true;
+ else if (f_character == "}" and !next_character_is_not_special) {
+ current_display_speed--;
+ formatting_char = true;
}
// Orange inline colourisation.
- else if (f_character == "|" and !next_character_is_not_special)
- {
- if (!inline_colour_stack.empty())
- {
- if (inline_colour_stack.top() == INLINE_ORANGE)
- {
- inline_colour_stack.pop();
- }
- else
- {
- inline_colour_stack.push(INLINE_ORANGE);
- }
+ else if (f_character == "|" and !next_character_is_not_special) {
+ if (!inline_colour_stack.empty()) {
+ if (inline_colour_stack.top() == INLINE_ORANGE) {
+ inline_colour_stack.pop();
}
- else
- {
- inline_colour_stack.push(INLINE_ORANGE);
+ else {
+ inline_colour_stack.push(INLINE_ORANGE);
}
- formatting_char = true;
+ }
+ else {
+ inline_colour_stack.push(INLINE_ORANGE);
+ }
+ formatting_char = true;
}
// Blue inline colourisation.
- else if (f_character == "(" and !next_character_is_not_special)
- {
- inline_colour_stack.push(INLINE_BLUE);
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(BLUE)).name() +"\">" + f_character + "</font>");
-
- // Increase how deep we are in inline blues.
- inline_blue_depth++;
-
- // Here, we check if the entire message is blue.
- // If it isn't, we stop talking.
- if (!entire_message_is_blue and anim_state != 4)
- {
- QString f_char = m_chatmessage[CHAR_NAME];
- QString f_emote = m_chatmessage[EMOTE];
- ui_vp_player_char->play_idle(f_char, f_emote);
- }
+ else if (f_character == "(" and !next_character_is_not_special) {
+ inline_colour_stack.push(INLINE_BLUE);
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color(QString::number(BLUE)).name() +
+ "\">" + f_character + "</font>");
+
+ // Increase how deep we are in inline blues.
+ inline_blue_depth++;
+
+ // Here, we check if the entire message is blue.
+ // If it isn't, we stop talking.
+ if (!entire_message_is_blue and anim_state != 4) {
+ QString f_char = m_chatmessage[CHAR_NAME];
+ QString f_emote = m_chatmessage[EMOTE];
+ ui_vp_player_char->play_idle(f_char, f_emote);
+ }
}
- else if (f_character == ")" and !next_character_is_not_special
- and !inline_colour_stack.empty())
- {
- if (inline_colour_stack.top() == INLINE_BLUE)
- {
- inline_colour_stack.pop();
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(BLUE)).name() +"\">" + f_character + "</font>");
-
- // Decrease how deep we are in inline blues.
- // Just in case, we do a check if we're above zero, but we should be.
- if (inline_blue_depth > 0)
- {
- inline_blue_depth--;
- // Here, we check if the entire message is blue.
- // If it isn't, we start talking if we have completely climbed out of inline blues.
- if (!entire_message_is_blue)
- {
- // We should only go back to talking if we're out of inline blues, not during a non. int. pre, and not on the last character.
- if (inline_blue_depth == 0 and anim_state != 4 and !(tick_pos+1 >= f_message.size()))
- {
- QString f_char = m_chatmessage[CHAR_NAME];
- QString f_emote = m_chatmessage[EMOTE];
- ui_vp_player_char->play_talking(f_char, f_emote);
- }
- }
+ else if (f_character == ")" and !next_character_is_not_special and
+ !inline_colour_stack.empty()) {
+ if (inline_colour_stack.top() == INLINE_BLUE) {
+ inline_colour_stack.pop();
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color(QString::number(BLUE)).name() +
+ "\">" + f_character + "</font>");
+
+ // Decrease how deep we are in inline blues.
+ // Just in case, we do a check if we're above zero, but we should be.
+ if (inline_blue_depth > 0) {
+ inline_blue_depth--;
+ // Here, we check if the entire message is blue.
+ // If it isn't, we start talking if we have completely climbed out of
+ // inline blues.
+ if (!entire_message_is_blue) {
+ // We should only go back to talking if we're out of inline blues,
+ // not during a non. int. pre, and not on the last character.
+ if (inline_blue_depth == 0 and anim_state != 4 and
+ !(tick_pos + 1 >= f_message.size())) {
+ QString f_char = m_chatmessage[CHAR_NAME];
+ QString f_emote = m_chatmessage[EMOTE];
+ ui_vp_player_char->play_talking(f_char, f_emote);
}
+ }
}
- else
- {
- next_character_is_not_special = true;
- tick_pos -= f_char_length;
- }
+ }
+ else {
+ next_character_is_not_special = true;
+ tick_pos -= f_char_length;
+ }
}
// Grey inline colourisation.
- else if (f_character == "[" and !next_character_is_not_special)
- {
- inline_colour_stack.push(INLINE_GREY);
- ui_vp_message->insertHtml("<font color=\""+ get_text_color("_inline_grey").name() +"\">" + f_character + "</font>");
- }
- else if (f_character == "]" and !next_character_is_not_special
- and !inline_colour_stack.empty())
- {
- if (inline_colour_stack.top() == INLINE_GREY)
- {
- inline_colour_stack.pop();
- ui_vp_message->insertHtml("<font color=\""+ get_text_color("_inline_grey").name() +"\">" + f_character + "</font>");
- }
- else
- {
- next_character_is_not_special = true;
- tick_pos -= f_char_length;
- }
+ else if (f_character == "[" and !next_character_is_not_special) {
+ inline_colour_stack.push(INLINE_GREY);
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color("_inline_grey").name() + "\">" +
+ f_character + "</font>");
+ }
+ else if (f_character == "]" and !next_character_is_not_special and
+ !inline_colour_stack.empty()) {
+ if (inline_colour_stack.top() == INLINE_GREY) {
+ inline_colour_stack.pop();
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color("_inline_grey").name() +
+ "\">" + f_character + "</font>");
+ }
+ else {
+ next_character_is_not_special = true;
+ tick_pos -= f_char_length;
+ }
}
// Green inline colourisation.
- else if (f_character == "`" and !next_character_is_not_special)
- {
- if (!inline_colour_stack.empty())
- {
- if (inline_colour_stack.top() == INLINE_GREEN)
- {
- inline_colour_stack.pop();
- formatting_char = true;
- }
- else
- {
- inline_colour_stack.push(INLINE_GREEN);
- formatting_char = true;
- }
+ else if (f_character == "`" and !next_character_is_not_special) {
+ if (!inline_colour_stack.empty()) {
+ if (inline_colour_stack.top() == INLINE_GREEN) {
+ inline_colour_stack.pop();
+ formatting_char = true;
}
- else
- {
- inline_colour_stack.push(INLINE_GREEN);
- formatting_char = true;
+ else {
+ inline_colour_stack.push(INLINE_GREEN);
+ formatting_char = true;
}
+ }
+ else {
+ inline_colour_stack.push(INLINE_GREEN);
+ formatting_char = true;
+ }
}
- else
- {
+ else {
next_character_is_not_special = false;
- if (!inline_colour_stack.empty())
- {
- switch (inline_colour_stack.top()) {
- case INLINE_ORANGE:
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(ORANGE)).name() +"\">" + f_character + "</font>");
- break;
- case INLINE_BLUE:
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(BLUE)).name() +"\">" + f_character + "</font>");
- break;
- case INLINE_GREEN:
- ui_vp_message->insertHtml("<font color=\""+ get_text_color(QString::number(GREEN)).name() +"\">" + f_character + "</font>");
- break;
- case INLINE_GREY:
- ui_vp_message->insertHtml("<font color=\""+ get_text_color("_inline_grey").name() +"\">" + f_character + "</font>");
- break;
- }
+ if (!inline_colour_stack.empty()) {
+ switch (inline_colour_stack.top()) {
+ case INLINE_ORANGE:
+ ui_vp_message->insertHtml(
+ "<font color=\"" +
+ get_text_color(QString::number(ORANGE)).name() + "\">" +
+ f_character + "</font>");
+ break;
+ case INLINE_BLUE:
+ ui_vp_message->insertHtml(
+ "<font color=\"" + get_text_color(QString::number(BLUE)).name() +
+ "\">" + f_character + "</font>");
+ break;
+ case INLINE_GREEN:
+ ui_vp_message->insertHtml(
+ "<font color=\"" + get_text_color(QString::number(GREEN)).name() +
+ "\">" + f_character + "</font>");
+ break;
+ case INLINE_GREY:
+ ui_vp_message->insertHtml("<font color=\"" +
+ get_text_color("_inline_grey").name() +
+ "\">" + f_character + "</font>");
+ break;
+ }
}
- else
- {
- if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW)
- {
+ else {
+ if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW) {
QString html_color;
- switch (rainbow_counter)
- {
+ switch (rainbow_counter) {
case 0:
html_color = get_text_color(QString::number(RED)).name();
break;
@@ -2260,33 +2196,30 @@ void Courtroom::chat_tick()
++rainbow_counter;
- ui_vp_message->insertHtml("<font color=\"" + html_color + "\">" + f_character + "</font>");
+ ui_vp_message->insertHtml("<font color=\"" + html_color + "\">" +
+ f_character + "</font>");
}
else
ui_vp_message->insertHtml(f_character);
}
- if (message_is_centered)
- {
- ui_vp_message->setAlignment(Qt::AlignCenter);
+ if (message_is_centered) {
+ ui_vp_message->setAlignment(Qt::AlignCenter);
}
- else
- {
- ui_vp_message->setAlignment(Qt::AlignLeft);
+ else {
+ ui_vp_message->setAlignment(Qt::AlignLeft);
}
}
QScrollBar *scroll = ui_vp_message->verticalScrollBar();
scroll->setValue(scroll->maximum());
- if(blank_blip)
+ if (blank_blip)
qDebug() << "blank_blip found true";
- if (f_character != ' ' || blank_blip)
- {
+ if (f_character != ' ' || blank_blip) {
- if (blip_pos % blip_rate == 0 && !formatting_char)
- {
+ if (blip_pos % blip_rate == 0 && !formatting_char) {
blip_pos = 0;
blip_player->blip_tick();
}
@@ -2296,32 +2229,27 @@ void Courtroom::chat_tick()
tick_pos += f_char_length;
- // Restart the timer, but according to the newly set speeds, if there were any.
- // Keep the speed at bay.
- if (current_display_speed < 0)
- {
- current_display_speed = 0;
+ // Restart the timer, but according to the newly set speeds, if there were
+ // any. Keep the speed at bay.
+ if (current_display_speed < 0) {
+ current_display_speed = 0;
}
- if (current_display_speed > 6)
- {
- current_display_speed = 6;
+ if (current_display_speed > 6) {
+ current_display_speed = 6;
}
- // If we had a formatting char, we shouldn't wait so long again, as it won't appear!
- if (formatting_char)
- {
- chat_tick_timer->start(1);
+ // If we had a formatting char, we shouldn't wait so long again, as it won't
+ // appear!
+ if (formatting_char) {
+ chat_tick_timer->start(1);
}
- else
- {
- chat_tick_timer->start(message_display_speed[current_display_speed]);
+ else {
+ chat_tick_timer->start(message_display_speed[current_display_speed]);
}
-
}
}
-
void Courtroom::show_testimony()
{
if (!testimony_in_progress || m_chatmessage[SIDE] != "wit")
@@ -2357,57 +2285,51 @@ void Courtroom::set_scene()
if (testimony_in_progress)
show_testimony();
- //witness is default if pos is invalid
+ // witness is default if pos is invalid
QString f_background = "witnessempty";
QString f_desk_image = "stand";
QString f_desk_mod = m_chatmessage[DESK_MOD];
QString f_side = m_chatmessage[SIDE];
- if (f_side == "def")
- {
+ if (f_side == "def") {
f_background = "defenseempty";
if (is_ao2_bg)
f_desk_image = "defensedesk";
else
f_desk_image = "bancodefensa";
}
- else if (f_side == "pro")
- {
+ else if (f_side == "pro") {
f_background = "prosecutorempty";
if (is_ao2_bg)
f_desk_image = "prosecutiondesk";
else
f_desk_image = "bancoacusacion";
}
- else if (f_side == "jud")
- {
+ else if (f_side == "jud") {
f_background = "judgestand";
f_desk_image = "judgedesk";
}
- else if (f_side == "hld")
- {
+ else if (f_side == "hld") {
f_background = "helperstand";
f_desk_image = "helperdesk";
}
- else if (f_side == "hlp")
- {
+ else if (f_side == "hlp") {
f_background = "prohelperstand";
f_desk_image = "prohelperdesk";
}
- else if (f_side == "jur" && (file_exists(ao_app->get_background_path("jurystand.png")) ||
- file_exists(ao_app->get_background_path("jurystand.gif"))))
- {
+ else if (f_side == "jur" &&
+ (file_exists(ao_app->get_background_path("jurystand.png")) ||
+ file_exists(ao_app->get_background_path("jurystand.gif")))) {
f_background = "jurystand";
f_desk_image = "jurydesk";
}
- else if (f_side == "sea" && (file_exists(ao_app->get_background_path("seancestand.png")) ||
- file_exists(ao_app->get_background_path("seancestand.gif"))))
- {
+ else if (f_side == "sea" &&
+ (file_exists(ao_app->get_background_path("seancestand.png")) ||
+ file_exists(ao_app->get_background_path("seancestand.gif")))) {
f_background = "seancestand";
f_desk_image = "seancedesk";
}
- else
- {
+ else {
if (is_ao2_bg)
f_desk_image = "stand";
else
@@ -2418,30 +2340,23 @@ void Courtroom::set_scene()
ui_vp_desk->set_image(f_desk_image);
ui_vp_legacy_desk->set_legacy_desk(f_desk_image);
- if (f_desk_mod == "0" || (f_desk_mod != "1" &&
- (f_side == "jud" ||
- f_side == "hld" ||
- f_side == "hlp")))
- {
+ if (f_desk_mod == "0" ||
+ (f_desk_mod != "1" &&
+ (f_side == "jud" || f_side == "hld" || f_side == "hlp"))) {
ui_vp_desk->hide();
ui_vp_legacy_desk->hide();
}
- else if (is_ao2_bg || (f_side == "jud" ||
- f_side == "hld" ||
- f_side == "hlp"))
- {
+ else if (is_ao2_bg ||
+ (f_side == "jud" || f_side == "hld" || f_side == "hlp")) {
ui_vp_legacy_desk->hide();
ui_vp_desk->show();
}
- else
- {
- if (f_side == "wit")
- {
+ else {
+ if (f_side == "wit") {
ui_vp_desk->show();
ui_vp_legacy_desk->hide();
}
- else
- {
+ else {
ui_vp_desk->hide();
ui_vp_legacy_desk->show();
}
@@ -2450,9 +2365,10 @@ void Courtroom::set_scene()
void Courtroom::set_text_color()
{
- QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME]));
+ QColor textcolor = ao_app->get_chat_color(
+ m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME]));
- ui_vp_message->setTextBackgroundColor(QColor(0,0,0,0));
+ ui_vp_message->setTextBackgroundColor(QColor(0, 0, 0, 0));
ui_vp_message->setTextColor(textcolor);
QString style = "background-color: rgba(0, 0, 0, 0);";
@@ -2469,7 +2385,8 @@ void Courtroom::set_text_color()
QColor Courtroom::get_text_color(QString color)
{
- return ao_app->get_chat_color(color, ao_app->get_chat(m_chatmessage[CHAR_NAME]));
+ return ao_app->get_chat_color(color,
+ ao_app->get_chat(m_chatmessage[CHAR_NAME]));
}
void Courtroom::set_ip_list(QString p_list)
@@ -2486,8 +2403,7 @@ void Courtroom::set_mute(bool p_muted, int p_cid)
if (p_muted)
ui_muted->show();
- else
- {
+ else {
ui_muted->hide();
ui_ic_chat_message->setFocus();
}
@@ -2522,27 +2438,23 @@ void Courtroom::handle_song(QStringList *p_contents)
f_song_clear = f_song_clear.left(f_song_clear.lastIndexOf("."));
int n_char = f_contents.at(1).toInt();
- if (n_char < 0 || n_char >= char_list.size())
- {
+ if (n_char < 0 || n_char >= char_list.size()) {
music_player->play(f_song);
}
- else
- {
+ else {
QString str_char = char_list.at(n_char).name;
QString str_show = char_list.at(n_char).name;
- if (p_contents->length() > 2)
- {
- str_show = p_contents->at(2);
+ if (p_contents->length() > 2) {
+ str_show = p_contents->at(2);
}
- if (!mute_map.value(n_char))
- {
- chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true);
+ if (!mute_map.value(n_char)) {
+ chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true);
ic_chatlog_history.append(*temp);
- while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0)
- {
+ while (ic_chatlog_history.size() > log_maximum_blocks &&
+ log_maximum_blocks > 0) {
ic_chatlog_history.removeFirst();
}
@@ -2556,33 +2468,29 @@ void Courtroom::handle_wtce(QString p_wtce, int variant)
{
QString sfx_file = "courtroom_sounds.ini";
- //witness testimony
- if (p_wtce == "testimony1")
- {
+ // witness testimony
+ if (p_wtce == "testimony1") {
sfx_player->play(ao_app->get_sfx("witness_testimony"));
ui_vp_wtce->play("witnesstestimony");
testimony_in_progress = true;
show_testimony();
}
- //cross examination
- else if (p_wtce == "testimony2")
- {
+ // cross examination
+ else if (p_wtce == "testimony2") {
sfx_player->play(ao_app->get_sfx("cross_examination"));
ui_vp_wtce->play("crossexamination");
testimony_in_progress = false;
}
- else if (p_wtce == "judgeruling")
- {
- if (variant == 0)
- {
- sfx_player->play(ao_app->get_sfx("not_guilty"));
- ui_vp_wtce->play("notguilty");
- testimony_in_progress = false;
+ else if (p_wtce == "judgeruling") {
+ if (variant == 0) {
+ sfx_player->play(ao_app->get_sfx("not_guilty"));
+ ui_vp_wtce->play("notguilty");
+ testimony_in_progress = false;
}
else if (variant == 1) {
- sfx_player->play(ao_app->get_sfx("guilty"));
- ui_vp_wtce->play("guilty");
- testimony_in_progress = false;
+ sfx_player->play(ao_app->get_sfx("guilty"));
+ ui_vp_wtce->play("guilty");
+ testimony_in_progress = false;
}
}
}
@@ -2592,22 +2500,20 @@ void Courtroom::set_hp_bar(int p_bar, int p_state)
if (p_state < 0 || p_state > 10)
return;
- if (p_bar == 1)
- {
+ if (p_bar == 1) {
ui_defense_bar->set_image("defensebar" + QString::number(p_state) + ".png");
defense_bar_state = p_state;
}
- else if (p_bar == 2)
- {
- ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) + ".png");
+ else if (p_bar == 2) {
+ ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) +
+ ".png");
prosecution_bar_state = p_state;
}
}
void Courtroom::toggle_judge_buttons(bool is_on)
{
- if (is_on)
- {
+ if (is_on) {
ui_witness_testimony->show();
ui_cross_examination->show();
ui_guilty->show();
@@ -2617,8 +2523,7 @@ void Courtroom::toggle_judge_buttons(bool is_on)
ui_prosecution_minus->show();
ui_prosecution_plus->show();
}
- else
- {
+ else {
ui_witness_testimony->hide();
ui_cross_examination->hide();
ui_guilty->hide();
@@ -2633,26 +2538,24 @@ void Courtroom::toggle_judge_buttons(bool is_on)
void Courtroom::mod_called(QString p_ip)
{
ui_server_chatlog->append(p_ip);
- if (ui_guard->isChecked())
- {
+ if (ui_guard->isChecked()) {
modcall_player->play(ao_app->get_sfx("mod_call"));
ao_app->alert(this);
}
}
-void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno)
+void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur,
+ bool steno)
{
- if (ui_casing->isChecked())
- {
+ if (ui_casing->isChecked()) {
ui_server_chatlog->append(msg);
if ((ao_app->get_casing_defence_enabled() && def) ||
(ao_app->get_casing_prosecution_enabled() && pro) ||
(ao_app->get_casing_judge_enabled() && jud) ||
(ao_app->get_casing_juror_enabled() && jur) ||
- (ao_app->get_casing_steno_enabled() && steno))
- {
- modcall_player->play(ao_app->get_sfx("case_call"));
- ao_app->alert(this);
+ (ao_app->get_casing_steno_enabled() && steno)) {
+ modcall_player->play(ao_app->get_sfx("case_call"));
+ ao_app->alert(this);
}
}
}
@@ -2664,104 +2567,100 @@ void Courtroom::on_ooc_return_pressed()
if (ooc_message == "" || ui_ooc_chat_name->text() == "")
return;
- if (ooc_message.startsWith("/pos"))
- {
- if (ooc_message == "/pos jud")
- {
+ if (ooc_message.startsWith("/pos")) {
+ if (ooc_message == "/pos jud") {
toggle_judge_buttons(true);
}
- else
- {
+ else {
toggle_judge_buttons(false);
}
}
- else if (ooc_message.startsWith("/login"))
- {
+ else if (ooc_message.startsWith("/login")) {
ui_guard->show();
- append_server_chatmessage("CLIENT", "You were granted the Guard button.", "1");
+ append_server_chatmessage("CLIENT", "You were granted the Guard button.",
+ "1");
}
- else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended)
- {
- //ui_text_color->addItem("Rainbow");
+ else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled &&
+ !rainbow_appended) {
+ // ui_text_color->addItem("Rainbow");
ui_ooc_chat_message->clear();
- //rainbow_appended = true;
- append_server_chatmessage("CLIENT", "This does nohing, but there you go.", "1");
+ // rainbow_appended = true;
+ append_server_chatmessage("CLIENT", "This does nohing, but there you go.",
+ "1");
return;
}
- else if (ooc_message.startsWith("/settings"))
- {
+ else if (ooc_message.startsWith("/settings")) {
ui_ooc_chat_message->clear();
ao_app->call_settings_menu();
append_server_chatmessage("CLIENT", "You opened the settings menu.", "1");
return;
}
- else if (ooc_message.startsWith("/pair"))
- {
+ else if (ooc_message.startsWith("/pair")) {
ui_ooc_chat_message->clear();
- ooc_message.remove(0,6);
-
+ ooc_message.remove(0, 6);
+
bool ok;
int whom = ooc_message.toInt(&ok);
- if (ok)
- {
- if (whom > -1)
- {
+ if (ok) {
+ if (whom > -1) {
other_charid = whom;
QString msg = "You will now pair up with ";
msg.append(char_list.at(whom).name);
msg.append(" if they also choose your character in return.");
append_server_chatmessage("CLIENT", msg, "1");
}
- else
- {
+ else {
other_charid = -1;
- append_server_chatmessage("CLIENT", "You are no longer paired with anyone.", "1");
+ append_server_chatmessage("CLIENT",
+ "You are no longer paired with anyone.", "1");
}
}
- else
- {
- append_server_chatmessage("CLIENT", "Are you sure you typed that well? The char ID could not be recognised.", "1");
+ else {
+ append_server_chatmessage("CLIENT",
+ "Are you sure you typed that well? The char ID "
+ "could not be recognised.",
+ "1");
}
return;
}
- else if (ooc_message.startsWith("/offset"))
- {
+ else if (ooc_message.startsWith("/offset")) {
ui_ooc_chat_message->clear();
- ooc_message.remove(0,8);
-
+ ooc_message.remove(0, 8);
+
bool ok;
int off = ooc_message.toInt(&ok);
- if (ok)
- {
- if (off >= -100 && off <= 100)
- {
+ if (ok) {
+ if (off >= -100 && off <= 100) {
offset_with_pair = off;
QString msg = "You have set your offset to ";
msg.append(QString::number(off));
msg.append("%.");
append_server_chatmessage("CLIENT", msg, "1");
}
- else
- {
- append_server_chatmessage("CLIENT", "Your offset must be between -100% and 100%!", "1");
+ else {
+ append_server_chatmessage(
+ "CLIENT", "Your offset must be between -100% and 100%!", "1");
}
}
- else
- {
- append_server_chatmessage("CLIENT", "That offset does not look like one.", "1");
+ else {
+ append_server_chatmessage("CLIENT", "That offset does not look like one.",
+ "1");
}
return;
}
- else if (ooc_message.startsWith("/switch_am"))
- {
- append_server_chatmessage("CLIENT", "You switched your music and area list.", "1");
- on_switch_area_music_clicked();
- ui_ooc_chat_message->clear();
- return;
+ else if (ooc_message.startsWith("/switch_am")) {
+ append_server_chatmessage("CLIENT",
+ "You switched your music and area list.", "1");
+ on_switch_area_music_clicked();
+ ui_ooc_chat_message->clear();
+ return;
}
- else if (ooc_message.startsWith("/enable_blocks"))
- {
- append_server_chatmessage("CLIENT", "You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this.", "1");
+ else if (ooc_message.startsWith("/enable_blocks")) {
+ append_server_chatmessage(
+ "CLIENT",
+ "You have forcefully enabled features that the server may not support. "
+ "You may not be able to talk IC, or worse, because of this.",
+ "1");
ao_app->cccc_ic_support_enabled = true;
ao_app->arup_enabled = true;
ao_app->modcall_reason_enabled = true;
@@ -2769,23 +2668,24 @@ void Courtroom::on_ooc_return_pressed()
ui_ooc_chat_message->clear();
return;
}
- else if (ooc_message.startsWith("/non_int_pre"))
- {
+ else if (ooc_message.startsWith("/non_int_pre")) {
if (ui_pre_non_interrupt->isChecked())
- append_server_chatmessage("CLIENT", "Your pre-animations interrupt again.", "1");
+ append_server_chatmessage("CLIENT",
+ "Your pre-animations interrupt again.", "1");
else
- append_server_chatmessage("CLIENT", "Your pre-animations will not interrupt text.", "1");
+ append_server_chatmessage(
+ "CLIENT", "Your pre-animations will not interrupt text.", "1");
ui_pre_non_interrupt->setChecked(!ui_pre_non_interrupt->isChecked());
ui_ooc_chat_message->clear();
return;
}
- else if (ooc_message.startsWith("/save_chatlog"))
- {
+ else if (ooc_message.startsWith("/save_chatlog")) {
QFile file("chatlog.txt");
- if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate))
- {
- append_server_chatmessage("CLIENT", "Couldn't open chatlog.txt to write into.", "1");
+ if (!file.open(QIODevice::WriteOnly | QIODevice::Text |
+ QIODevice::Truncate)) {
+ append_server_chatmessage(
+ "CLIENT", "Couldn't open chatlog.txt to write into.", "1");
ui_ooc_chat_message->clear();
return;
}
@@ -2793,8 +2693,8 @@ void Courtroom::on_ooc_return_pressed()
QTextStream out(&file);
foreach (chatlogpiece item, ic_chatlog_history) {
- out << item.get_full() << '\n';
- }
+ out << item.get_full() << '\n';
+ }
file.close();
@@ -2802,39 +2702,49 @@ void Courtroom::on_ooc_return_pressed()
ui_ooc_chat_message->clear();
return;
}
- else if (ooc_message.startsWith("/load_case"))
- {
+ else if (ooc_message.startsWith("/load_case")) {
QStringList command = ooc_message.split(" ", QString::SkipEmptyParts);
QDir casefolder("base/cases");
- if (!casefolder.exists())
- {
- QDir::current().mkdir("base/" + casefolder.dirName());
- append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there.", "1");
- ui_ooc_chat_message->clear();
- return;
+ if (!casefolder.exists()) {
+ QDir::current().mkdir("base/" + casefolder.dirName());
+ append_server_chatmessage(
+ "CLIENT",
+ "You don't have a `base/cases/` folder! It was just made for you, "
+ "but seeing as it WAS just made for you, it's likely the case file "
+ "you're looking for can't be found in there.",
+ "1");
+ ui_ooc_chat_message->clear();
+ return;
}
QStringList caseslist = casefolder.entryList();
caseslist.removeOne(".");
caseslist.removeOne("..");
- caseslist.replaceInStrings(".ini","");
-
- if (command.size() < 2)
- {
- append_server_chatmessage("CLIENT", "You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini.\nCases you can load: " + caseslist.join(", "), "1");
+ caseslist.replaceInStrings(".ini", "");
+
+ if (command.size() < 2) {
+ append_server_chatmessage(
+ "CLIENT",
+ "You need to give a filename to load (extension not needed)! Make "
+ "sure that it is in the `base/cases/` folder, and that it is a "
+ "correctly formatted ini.\nCases you can load: " +
+ caseslist.join(", "),
+ "1");
ui_ooc_chat_message->clear();
return;
}
-
- if (command.size() > 2)
- {
- append_server_chatmessage("CLIENT", "Too many arguments to load a case! You only need one filename, without extension.", "1");
+ if (command.size() > 2) {
+ append_server_chatmessage("CLIENT",
+ "Too many arguments to load a case! You only "
+ "need one filename, without extension.",
+ "1");
ui_ooc_chat_message->clear();
return;
}
- QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat);
+ QSettings casefile("base/cases/" + command[1] + ".ini",
+ QSettings::IniFormat);
QString caseauth = casefile.value("author", "").value<QString>();
QString casedoc = casefile.value("doc", "").value<QString>();
@@ -2842,88 +2752,108 @@ void Courtroom::on_ooc_return_pressed()
QString casestatus = casefile.value("status", "").value<QString>();
if (!caseauth.isEmpty())
- append_server_chatmessage("CLIENT", "Case made by " + caseauth + ".", "1");
+ append_server_chatmessage("CLIENT", "Case made by " + caseauth + ".",
+ "1");
if (!casedoc.isEmpty())
- ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/doc " + casedoc + "#%"));
+ ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() +
+ "#/doc " + casedoc + "#%"));
if (!casestatus.isEmpty())
- ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/status " + casestatus + "#%"));
+ ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() +
+ "#/status " + casestatus + "#%"));
if (!cmdoc.isEmpty())
- append_server_chatmessage("CLIENT", "Navigate to " + cmdoc + " for the CM doc.", "1");
+ append_server_chatmessage(
+ "CLIENT", "Navigate to " + cmdoc + " for the CM doc.", "1");
for (int i = local_evidence_list.size() - 1; i >= 0; i--) {
- ao_app->send_server_packet(new AOPacket("DE#" + QString::number(i) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("DE#" + QString::number(i) + "#%"));
}
foreach (QString evi, casefile.childGroups()) {
- if (evi == "General")
- continue;
+ if (evi == "General")
+ continue;
- QStringList f_contents;
+ QStringList f_contents;
- f_contents.append(casefile.value(evi + "/name", "UNKNOWN").value<QString>());
- f_contents.append(casefile.value(evi + "/description", "UNKNOWN").value<QString>());
- f_contents.append(casefile.value(evi + "/image", "UNKNOWN.png").value<QString>());
+ f_contents.append(
+ casefile.value(evi + "/name", "UNKNOWN").value<QString>());
+ f_contents.append(
+ casefile.value(evi + "/description", "UNKNOWN").value<QString>());
+ f_contents.append(
+ casefile.value(evi + "/image", "UNKNOWN.png").value<QString>());
- ao_app->send_server_packet(new AOPacket("PE", f_contents));
- }
+ ao_app->send_server_packet(new AOPacket("PE", f_contents));
+ }
- append_server_chatmessage("CLIENT", "Your case \"" + command[1] + "\" was loaded!", "1");
+ append_server_chatmessage(
+ "CLIENT", "Your case \"" + command[1] + "\" was loaded!", "1");
ui_ooc_chat_message->clear();
return;
}
- else if(ooc_message.startsWith("/save_case"))
- {
- QStringList command = ooc_message.split(" ", QString::SkipEmptyParts);
-
- QDir casefolder("base/cases");
- if (!casefolder.exists())
- {
- QDir::current().mkdir("base/" + casefolder.dirName());
- append_server_chatmessage("CLIENT", "You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it.", "1");
- ui_ooc_chat_message->clear();
- return;
- }
- QStringList caseslist = casefolder.entryList();
- caseslist.removeOne(".");
- caseslist.removeOne("..");
- caseslist.replaceInStrings(".ini","");
-
- if (command.size() < 3)
- {
- append_server_chatmessage("CLIENT", "You need to give a filename to save (extension not needed) and the courtroom status!", "1");
- ui_ooc_chat_message->clear();
- return;
- }
-
+ else if (ooc_message.startsWith("/save_case")) {
+ QStringList command = ooc_message.split(" ", QString::SkipEmptyParts);
- if (command.size() > 3)
- {
- append_server_chatmessage("CLIENT", "Too many arguments to save a case! You only need a filename without extension and the courtroom status!", "1");
- ui_ooc_chat_message->clear();
- return;
- }
- QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat);
- casefile.setValue("author",ui_ooc_chat_name->text());
- casefile.setValue("cmdoc","");
- casefile.setValue("doc", "");
- casefile.setValue("status",command[2]);
- casefile.sync();
- for(int i = local_evidence_list.size() - 1; i >= 0; i--)
- {
- QString clean_evidence_dsc = local_evidence_list[i].description.replace(QRegularExpression("<owner = ...>..."), "");
- clean_evidence_dsc = clean_evidence_dsc.replace(clean_evidence_dsc.lastIndexOf(">"), 1, "");
- casefile.beginGroup(QString::number(i));
- casefile.sync();
- casefile.setValue("name",local_evidence_list[i].name);
- casefile.setValue("description",local_evidence_list[i].description);
- casefile.setValue("image",local_evidence_list[i].image);
- casefile.endGroup();
- }
- casefile.sync();
- append_server_chatmessage("CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!", "1");
+ QDir casefolder("base/cases");
+ if (!casefolder.exists()) {
+ QDir::current().mkdir("base/" + casefolder.dirName());
+ append_server_chatmessage(
+ "CLIENT",
+ "You don't have a `base/cases/` folder! It was just made for you, "
+ "but seeing as it WAS just made for you, it's likely that you "
+ "somehow deleted it.",
+ "1");
+ ui_ooc_chat_message->clear();
+ return;
+ }
+ QStringList caseslist = casefolder.entryList();
+ caseslist.removeOne(".");
+ caseslist.removeOne("..");
+ caseslist.replaceInStrings(".ini", "");
+
+ if (command.size() < 3) {
+ append_server_chatmessage(
+ "CLIENT",
+ "You need to give a filename to save (extension not needed) and the "
+ "courtroom status!",
+ "1");
ui_ooc_chat_message->clear();
return;
+ }
+ if (command.size() > 3) {
+ append_server_chatmessage(
+ "CLIENT",
+ "Too many arguments to save a case! You only need a filename without "
+ "extension and the courtroom status!",
+ "1");
+ ui_ooc_chat_message->clear();
+ return;
+ }
+ QSettings casefile("base/cases/" + command[1] + ".ini",
+ QSettings::IniFormat);
+ casefile.setValue("author", ui_ooc_chat_name->text());
+ casefile.setValue("cmdoc", "");
+ casefile.setValue("doc", "");
+ casefile.setValue("status", command[2]);
+ casefile.sync();
+ for (int i = local_evidence_list.size() - 1; i >= 0; i--) {
+ QString clean_evidence_dsc = local_evidence_list[i].description.replace(
+ QRegularExpression("<owner = ...>..."), "");
+ clean_evidence_dsc = clean_evidence_dsc.replace(
+ clean_evidence_dsc.lastIndexOf(">"), 1, "");
+ casefile.beginGroup(QString::number(i));
+ casefile.sync();
+ casefile.setValue("name", local_evidence_list[i].name);
+ casefile.setValue("description", local_evidence_list[i].description);
+ casefile.setValue("image", local_evidence_list[i].image);
+ casefile.endGroup();
+ }
+ casefile.sync();
+ append_server_chatmessage(
+ "CLIENT", "Succesfully saved, edit doc and cmdoc link on the ini!",
+ "1");
+ ui_ooc_chat_message->clear();
+ return;
}
QStringList packet_contents;
@@ -2944,16 +2874,14 @@ void Courtroom::on_ooc_return_pressed()
void Courtroom::on_ooc_toggle_clicked()
{
- if (server_ooc)
- {
+ if (server_ooc) {
ui_ms_chatlog->show();
ui_server_chatlog->hide();
ui_ooc_toggle->setText("Master");
server_ooc = false;
}
- else
- {
+ else {
ui_ms_chatlog->hide();
ui_server_chatlog->show();
ui_ooc_toggle->setText("Server");
@@ -2964,7 +2892,7 @@ void Courtroom::on_ooc_toggle_clicked()
void Courtroom::on_music_search_edited(QString p_text)
{
- //preventing compiler warnings
+ // preventing compiler warnings
p_text += "a";
list_music();
list_areas();
@@ -2981,8 +2909,7 @@ void Courtroom::on_pos_dropdown_changed(int p_index)
QString f_pos;
- switch (p_index)
- {
+ switch (p_index) {
case 0:
f_pos = "wit";
break;
@@ -3009,7 +2936,8 @@ void Courtroom::on_pos_dropdown_changed(int p_index)
if (f_pos == "" || ui_ooc_chat_name->text() == "")
return;
- ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%"));
}
void Courtroom::on_mute_list_clicked(QModelIndex p_index)
@@ -3025,25 +2953,21 @@ void Courtroom::on_mute_list_clicked(QModelIndex p_index)
int f_cid = -1;
- for (int n_char = 0 ; n_char < char_list.size() ; n_char++)
- {
+ for (int n_char = 0; n_char < char_list.size(); n_char++) {
if (char_list.at(n_char).name == real_char)
f_cid = n_char;
}
- if (f_cid < 0 || f_cid >= char_list.size())
- {
+ if (f_cid < 0 || f_cid >= char_list.size()) {
qDebug() << "W: " << real_char << " not present in char_list";
return;
}
- if (mute_map.value(f_cid))
- {
+ if (mute_map.value(f_cid)) {
mute_map.insert(f_cid, false);
f_item->setText(real_char);
}
- else
- {
+ else {
mute_map.insert(f_cid, true);
f_item->setText(real_char + " [x]");
}
@@ -3056,26 +2980,19 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index)
QString real_char;
int f_cid = -1;
- if (f_char.endsWith(" [x]"))
- {
+ if (f_char.endsWith(" [x]")) {
real_char = f_char.left(f_char.size() - 4);
f_item->setText(real_char);
}
- else
- {
- real_char = f_char;
- for (int n_char = 0 ; n_char < char_list.size() ; n_char++)
- {
- if (char_list.at(n_char).name == real_char)
- f_cid = n_char;
- }
+ else {
+ real_char = f_char;
+ for (int n_char = 0; n_char < char_list.size(); n_char++) {
+ if (char_list.at(n_char).name == real_char)
+ f_cid = n_char;
+ }
}
-
-
-
- if (f_cid < -2 || f_cid >= char_list.size())
- {
+ if (f_cid < -2 || f_cid >= char_list.size()) {
qDebug() << "W: " << real_char << " not present in char_list";
return;
}
@@ -3093,9 +3010,8 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index)
for (int i = 0; i < ui_pair_list->count(); i++) {
ui_pair_list->item(i)->setText(sorted_pair_list.at(i));
}
- if(other_charid != -1)
- {
- f_item->setText(real_char + " [x]");
+ if (other_charid != -1) {
+ f_item->setText(real_char + " [x]");
}
}
@@ -3106,31 +3022,34 @@ void Courtroom::on_music_list_double_clicked(QModelIndex p_model)
QString p_song = music_list.at(music_row_to_number.at(p_model.row()));
- if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled)
- {
- ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#" + ui_ic_chat_name->text() + "#%"), false);
+ if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) {
+ ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" +
+ QString::number(m_cid) + "#" +
+ ui_ic_chat_name->text() + "#%"),
+ false);
}
- else
- {
- ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false);
+ else {
+ ao_app->send_server_packet(
+ new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"),
+ false);
}
}
void Courtroom::on_area_list_double_clicked(QModelIndex p_model)
{
- QString p_area = area_list.at(area_row_to_number.at(p_model.row()));
- ao_app->send_server_packet(new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"), false);
+ QString p_area = area_list.at(area_row_to_number.at(p_model.row()));
+ ao_app->send_server_packet(
+ new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"),
+ false);
}
void Courtroom::on_hold_it_clicked()
{
- if (objection_state == 1)
- {
+ if (objection_state == 1) {
ui_hold_it->set_image("holdit.png");
objection_state = 0;
}
- else
- {
+ else {
ui_objection->set_image("objection.png");
ui_take_that->set_image("takethat.png");
ui_custom_objection->set_image("custom.png");
@@ -3144,13 +3063,11 @@ void Courtroom::on_hold_it_clicked()
void Courtroom::on_objection_clicked()
{
- if (objection_state == 2)
- {
+ if (objection_state == 2) {
ui_objection->set_image("objection.png");
objection_state = 0;
}
- else
- {
+ else {
ui_hold_it->set_image("holdit.png");
ui_take_that->set_image("takethat.png");
ui_custom_objection->set_image("custom.png");
@@ -3164,13 +3081,11 @@ void Courtroom::on_objection_clicked()
void Courtroom::on_take_that_clicked()
{
- if (objection_state == 3)
- {
+ if (objection_state == 3) {
ui_take_that->set_image("takethat.png");
objection_state = 0;
}
- else
- {
+ else {
ui_objection->set_image("objection.png");
ui_hold_it->set_image("holdit.png");
ui_custom_objection->set_image("custom.png");
@@ -3184,13 +3099,11 @@ void Courtroom::on_take_that_clicked()
void Courtroom::on_custom_objection_clicked()
{
- if (objection_state == 4)
- {
+ if (objection_state == 4) {
ui_custom_objection->set_image("custom.png");
objection_state = 0;
}
- else
- {
+ else {
ui_objection->set_image("objection.png");
ui_take_that->set_image("takethat.png");
ui_hold_it->set_image("holdit.png");
@@ -3204,13 +3117,11 @@ void Courtroom::on_custom_objection_clicked()
void Courtroom::on_realization_clicked()
{
- if (realization_state == 0)
- {
+ if (realization_state == 0) {
realization_state = 1;
ui_realization->set_image("realization_pressed.png");
}
- else
- {
+ else {
realization_state = 0;
ui_realization->set_image("realization.png");
}
@@ -3220,16 +3131,14 @@ void Courtroom::on_realization_clicked()
void Courtroom::on_mute_clicked()
{
- if (ui_mute_list->isHidden())
- {
+ if (ui_mute_list->isHidden()) {
ui_mute_list->show();
ui_pair_list->hide();
ui_pair_offset_spinbox->hide();
ui_pair_button->set_image("pair_button.png");
ui_mute->set_image("mute_pressed.png");
}
- else
- {
+ else {
ui_mute_list->hide();
ui_mute->set_image("mute.png");
}
@@ -3237,16 +3146,14 @@ void Courtroom::on_mute_clicked()
void Courtroom::on_pair_clicked()
{
- if (ui_pair_list->isHidden())
- {
+ if (ui_pair_list->isHidden()) {
ui_pair_list->show();
ui_pair_offset_spinbox->show();
ui_mute_list->hide();
ui_mute->set_image("mute.png");
ui_pair_button->set_image("pair_button_pressed.png");
}
- else
- {
+ else {
ui_pair_list->hide();
ui_pair_offset_spinbox->hide();
ui_pair_button->set_image("pair_button.png");
@@ -3258,7 +3165,8 @@ void Courtroom::on_defense_minus_clicked()
int f_state = defense_bar_state - 1;
if (f_state >= 0)
- ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
}
void Courtroom::on_defense_plus_clicked()
@@ -3266,7 +3174,8 @@ void Courtroom::on_defense_plus_clicked()
int f_state = defense_bar_state + 1;
if (f_state <= 10)
- ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("HP#1#" + QString::number(f_state) + "#%"));
}
void Courtroom::on_prosecution_minus_clicked()
@@ -3274,7 +3183,8 @@ void Courtroom::on_prosecution_minus_clicked()
int f_state = prosecution_bar_state - 1;
if (f_state >= 0)
- ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
}
void Courtroom::on_prosecution_plus_clicked()
@@ -3282,7 +3192,8 @@ void Courtroom::on_prosecution_plus_clicked()
int f_state = prosecution_bar_state + 1;
if (f_state <= 10)
- ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("HP#2#" + QString::number(f_state) + "#%"));
}
void Courtroom::on_text_color_changed(int p_color)
@@ -3310,15 +3221,9 @@ void Courtroom::on_blip_slider_moved(int p_value)
ui_ic_chat_message->setFocus();
}
-void Courtroom::on_log_limit_changed(int value)
-{
- log_maximum_blocks = value;
-}
+void Courtroom::on_log_limit_changed(int value) { log_maximum_blocks = value; }
-void Courtroom::on_pair_offset_changed(int value)
-{
- offset_with_pair = value;
-}
+void Courtroom::on_pair_offset_changed(int value) { offset_with_pair = value; }
void Courtroom::on_witness_testimony_clicked()
{
@@ -3374,10 +3279,10 @@ void Courtroom::on_change_character_clicked()
}
void Courtroom::on_reload_theme_clicked()
-{
+{
ao_app->reload_theme();
- //to update status on the background
+ // to update status on the background
set_background(current_background);
enter_courtroom(m_cid);
@@ -3430,7 +3335,8 @@ void Courtroom::on_call_mod_clicked()
if (text.isEmpty()) {
errorBox.critical(nullptr, "Error", "You must provide a reason.");
return;
- } else if (text.length() > 256) {
+ }
+ else if (text.length() > 256) {
errorBox.critical(nullptr, "Error", "The message is too long.");
return;
}
@@ -3439,37 +3345,26 @@ void Courtroom::on_call_mod_clicked()
mod_reason.append(text);
ao_app->send_server_packet(new AOPacket("ZZ", mod_reason));
- } else {
+ }
+ else {
ao_app->send_server_packet(new AOPacket("ZZ#%"));
}
ui_ic_chat_message->setFocus();
}
-void Courtroom::on_settings_clicked()
-{
- ao_app->call_settings_menu();
-}
+void Courtroom::on_settings_clicked() { ao_app->call_settings_menu(); }
void Courtroom::on_announce_casing_clicked()
{
- ao_app->call_announce_menu(this);
+ ao_app->call_announce_menu(this);
}
-void Courtroom::on_pre_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
+void Courtroom::on_pre_clicked() { ui_ic_chat_message->setFocus(); }
-void Courtroom::on_flip_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
+void Courtroom::on_flip_clicked() { ui_ic_chat_message->setFocus(); }
-void Courtroom::on_guard_clicked()
-{
- ui_ic_chat_message->setFocus();
-}
+void Courtroom::on_guard_clicked() { ui_ic_chat_message->setFocus(); }
void Courtroom::on_showname_enable_clicked()
{
@@ -3477,69 +3372,63 @@ void Courtroom::on_showname_enable_clicked()
first_message_sent = false;
foreach (chatlogpiece item, ic_chatlog_history) {
- if (ui_showname_enable->isChecked())
- {
- if (item.get_is_song())
- append_ic_text(item.get_message(), item.get_showname(), true);
- else
- append_ic_text(item.get_message(), item.get_showname());
- }
+ if (ui_showname_enable->isChecked()) {
+ if (item.get_is_song())
+ append_ic_text(item.get_message(), item.get_showname(), true);
else
- {
- if (item.get_is_song())
- append_ic_text(item.get_message(), item.get_name(), true);
- else
- append_ic_text(item.get_message(), item.get_name());
- }
+ append_ic_text(item.get_message(), item.get_showname());
}
+ else {
+ if (item.get_is_song())
+ append_ic_text(item.get_message(), item.get_name(), true);
+ else
+ append_ic_text(item.get_message(), item.get_name());
+ }
+ }
ui_ic_chat_message->setFocus();
}
void Courtroom::on_evidence_button_clicked()
{
- if (ui_evidence->isHidden())
- {
+ if (ui_evidence->isHidden()) {
ui_evidence->show();
ui_evidence_overlay->hide();
}
- else
- {
+ else {
ui_evidence->hide();
}
}
void Courtroom::on_switch_area_music_clicked()
{
- if (ui_area_list->isHidden())
- {
- ui_area_list->show();
- ui_music_list->hide();
- }
- else
- {
- ui_area_list->hide();
- ui_music_list->show();
- }
+ if (ui_area_list->isHidden()) {
+ ui_area_list->show();
+ ui_music_list->hide();
+ }
+ else {
+ ui_area_list->hide();
+ ui_music_list->show();
+ }
}
void Courtroom::ping_server()
{
- ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("CH#" + QString::number(m_cid) + "#%"));
}
void Courtroom::on_casing_clicked()
{
- if (ao_app->casing_alerts_enabled)
- {
- if (ui_casing->isChecked())
- {
+ if (ao_app->casing_alerts_enabled) {
+ if (ui_casing->isChecked()) {
QStringList f_packet;
f_packet.append(ao_app->get_casing_can_host_cases());
f_packet.append(QString::number(ao_app->get_casing_cm_enabled()));
f_packet.append(QString::number(ao_app->get_casing_defence_enabled()));
- f_packet.append(QString::number(ao_app->get_casing_prosecution_enabled()));
+ f_packet.append(
+ QString::number(ao_app->get_casing_prosecution_enabled()));
f_packet.append(QString::number(ao_app->get_casing_judge_enabled()));
f_packet.append(QString::number(ao_app->get_casing_juror_enabled()));
f_packet.append(QString::number(ao_app->get_casing_steno_enabled()));
@@ -3551,10 +3440,10 @@ void Courtroom::on_casing_clicked()
}
}
-void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno)
+void Courtroom::announce_case(QString title, bool def, bool pro, bool jud,
+ bool jur, bool steno)
{
- if (ao_app->casing_alerts_enabled)
- {
+ if (ao_app->casing_alerts_enabled) {
QStringList f_packet;
f_packet.append(title);
@@ -3565,7 +3454,7 @@ void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool
f_packet.append(QString::number(steno));
ao_app->send_server_packet(new AOPacket("CASEA", f_packet));
- }
+ }
}
Courtroom::~Courtroom()
@@ -3576,29 +3465,29 @@ Courtroom::~Courtroom()
delete blip_player;
}
-
-#if (defined (_WIN32) || defined (_WIN64))
+#if (defined(_WIN32) || defined(_WIN64))
void Courtroom::load_bass_opus_plugin()
{
- #ifdef BASSAUDIO
+#ifdef BASSAUDIO
BASS_PluginLoad("bassopus.dll", 0);
- #endif
+#endif
}
-#elif (defined (LINUX) || defined (__linux__))
+#elif (defined(LINUX) || defined(__linux__))
void Courtroom::load_bass_opus_plugin()
{
- #ifdef BASSAUDIO
+#ifdef BASSAUDIO
BASS_PluginLoad("libbassopus.so", 0);
- #endif
+#endif
}
#elif defined __APPLE__
void Courtroom::load_bass_opus_plugin()
{
- QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib";
+ QString libpath =
+ ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib";
QByteArray ba = libpath.toLocal8Bit();
- #ifdef BASSAUDIO
+#ifdef BASSAUDIO
BASS_PluginLoad(ba.data(), 0);
- #endif
+#endif
}
#else
#error This operating system is unsupported for bass plugins.
diff --git a/src/debug_functions.cpp b/src/debug_functions.cpp
index 77f2f35a..f33a2c65 100644
--- a/src/debug_functions.cpp
+++ b/src/debug_functions.cpp
@@ -7,8 +7,7 @@ void call_error(QString p_message)
msgBox->setText("Error: " + p_message);
msgBox->setWindowTitle("Error");
-
- //msgBox->setWindowModality(Qt::NonModal);
+ // msgBox->setWindowModality(Qt::NonModal);
msgBox->exec();
}
@@ -19,7 +18,6 @@ void call_notice(QString p_message)
msgBox->setText(p_message);
msgBox->setWindowTitle("Notice");
-
- //msgBox->setWindowModality(Qt::NonModal);
+ // msgBox->setWindowModality(Qt::NonModal);
msgBox->exec();
}
diff --git a/src/discord_rich_presence.cpp b/src/discord_rich_presence.cpp
index 95a824a1..aea07e5e 100644
--- a/src/discord_rich_presence.cpp
+++ b/src/discord_rich_presence.cpp
@@ -8,23 +8,18 @@ Discord::Discord()
DiscordEventHandlers handlers;
std::memset(&handlers, 0, sizeof(handlers));
handlers = {};
- handlers.ready = [] {
- qInfo() << "Discord RPC ready";
- };
- handlers.disconnected = [](int errorCode, const char* message) {
+ handlers.ready = [] { qInfo() << "Discord RPC ready"; };
+ handlers.disconnected = [](int errorCode, const char *message) {
qInfo() << "Discord RPC disconnected! " << message << errorCode;
};
- handlers.errored = [](int errorCode, const char* message) {
+ handlers.errored = [](int errorCode, const char *message) {
qWarning() << "Discord RPC errored out! " << message << errorCode;
};
qInfo() << "Initializing Discord RPC";
Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr);
}
-Discord::~Discord()
-{
- Discord_Shutdown();
-}
+Discord::~Discord() { Discord_Shutdown(); }
void Discord::state_lobby()
{
@@ -64,10 +59,12 @@ void Discord::state_server(std::string name, std::string server_id)
void Discord::state_character(std::string name)
{
- auto name_internal = QString(name.c_str()).toLower().replace(' ', '_').toStdString();
+ auto name_internal =
+ QString(name.c_str()).toLower().replace(' ', '_').toStdString();
auto name_friendly = QString(name.c_str()).replace('_', ' ').toStdString();
const std::string playing_as = "Playing as " + name_friendly;
- qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str() << ")";
+ qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str()
+ << ")";
DiscordRichPresence presence;
std::memset(&presence, 0, sizeof(presence));
@@ -101,20 +98,11 @@ void Discord::state_spectate()
Discord_UpdatePresence(&presence);
}
#else
-Discord::Discord()
-{
-
-}
-
-Discord::~Discord()
-{
-
-}
+Discord::Discord() {}
-void Discord::state_lobby()
-{
+Discord::~Discord() {}
-}
+void Discord::state_lobby() {}
void Discord::state_server(std::string name, std::string server_id)
{
@@ -129,7 +117,6 @@ void Discord::state_character(std::string name)
void Discord::state_spectate()
{
qDebug() << "Discord RPC: Setting specator state";
-
}
#endif
-}
+} // namespace AttorneyOnline
diff --git a/src/emotes.cpp b/src/emotes.cpp
index b6a217e6..bbe2f5c9 100644
--- a/src/emotes.cpp
+++ b/src/emotes.cpp
@@ -8,7 +8,8 @@ void Courtroom::construct_emotes()
set_size_and_pos(ui_emotes, "emotes");
- QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini");
+ QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing",
+ "courtroom_design.ini");
const int button_width = 40;
int x_spacing = f_spacing.x();
@@ -18,13 +19,14 @@ void Courtroom::construct_emotes()
int y_spacing = f_spacing.y();
int y_mod_count = 0;
- emote_columns = ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1;
- emote_rows = ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1;
+ emote_columns =
+ ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1;
+ emote_rows =
+ ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1;
max_emotes_on_page = emote_columns * emote_rows;
- for (int n = 0 ; n < max_emotes_on_page ; ++n)
- {
+ for (int n = 0; n < max_emotes_on_page; ++n) {
int x_pos = (button_width + x_spacing) * x_mod_count;
int y_pos = (button_height + y_spacing) * y_mod_count;
@@ -34,12 +36,12 @@ void Courtroom::construct_emotes()
f_emote->set_id(n);
- connect(f_emote, SIGNAL(emote_clicked(int)), this, SLOT(on_emote_clicked(int)));
+ connect(f_emote, SIGNAL(emote_clicked(int)), this,
+ SLOT(on_emote_clicked(int)));
++x_mod_count;
- if (x_mod_count == emote_columns)
- {
+ if (x_mod_count == emote_columns) {
++y_mod_count;
x_mod_count = 0;
}
@@ -56,23 +58,20 @@ void Courtroom::set_emote_page()
ui_emote_left->hide();
ui_emote_right->hide();
- for (AOEmoteButton *i_button : ui_emote_list)
- {
+ for (AOEmoteButton *i_button : ui_emote_list) {
i_button->hide();
}
int total_pages = total_emotes / max_emotes_on_page;
int emotes_on_page = 0;
- if (total_emotes % max_emotes_on_page != 0)
- {
+ if (total_emotes % max_emotes_on_page != 0) {
++total_pages;
- //i. e. not on the last page
+ // i. e. not on the last page
if (total_pages > current_emote_page + 1)
emotes_on_page = max_emotes_on_page;
else
emotes_on_page = total_emotes % max_emotes_on_page;
-
}
else
emotes_on_page = max_emotes_on_page;
@@ -83,8 +82,7 @@ void Courtroom::set_emote_page()
if (current_emote_page > 0)
ui_emote_left->show();
- for (int n_emote = 0 ; n_emote < emotes_on_page ; ++n_emote)
- {
+ for (int n_emote = 0; n_emote < emotes_on_page; ++n_emote) {
int n_real_emote = n_emote + current_emote_page * max_emotes_on_page;
AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
@@ -95,7 +93,6 @@ void Courtroom::set_emote_page()
f_emote->show();
}
-
}
void Courtroom::set_emote_dropdown()
@@ -105,8 +102,7 @@ void Courtroom::set_emote_dropdown()
int total_emotes = ao_app->get_emote_number(current_char);
QStringList emote_list;
- for (int n = 0 ; n < total_emotes ; ++n)
- {
+ for (int n = 0; n < total_emotes; ++n) {
emote_list.append(ao_app->get_emote_comment(current_char, n));
}
@@ -119,19 +115,20 @@ void Courtroom::select_emote(int p_id)
int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page;
if (current_emote >= min && current_emote <= max)
- ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_off.png");
+ ui_emote_list.at(current_emote % max_emotes_on_page)
+ ->set_image(current_char, current_emote, "_off.png");
int old_emote = current_emote;
current_emote = p_id;
if (current_emote >= min && current_emote <= max)
- ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png");
+ ui_emote_list.at(current_emote % max_emotes_on_page)
+ ->set_image(current_char, current_emote, "_on.png");
int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
- if (old_emote == current_emote)
- {
+ if (old_emote == current_emote) {
ui_pre->setChecked(!ui_pre->isChecked());
}
else if (emote_mod == 1)
diff --git a/src/encryption_functions.cpp b/src/encryption_functions.cpp
index ffbe0cdb..6669fe15 100644
--- a/src/encryption_functions.cpp
+++ b/src/encryption_functions.cpp
@@ -4,8 +4,8 @@
QString fanta_encrypt(QString temp_input, unsigned int p_key)
{
- //using standard stdlib types is actually easier here because of implicit char<->int conversion
- //which in turn makes encryption arithmetic easier
+ // using standard stdlib types is actually easier here because of implicit
+ // char<->int conversion which in turn makes encryption arithmetic easier
unsigned int key = p_key;
unsigned int C1 = 53761;
@@ -14,8 +14,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key)
QVector<uint_fast8_t> temp_result;
std::string input = temp_input.toUtf8().constData();
- for (unsigned int pos = 0 ; pos < input.size() ; ++pos)
- {
+ for (unsigned int pos = 0; pos < input.size(); ++pos) {
uint_fast8_t output = input.at(pos) ^ (key >> 8) % 256;
temp_result.append(output);
key = (temp_result.at(pos) + key) * C1 + C2;
@@ -23,8 +22,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key)
std::string result = "";
- for (uint_fast8_t i_int : temp_result)
- {
+ for (uint_fast8_t i_int : temp_result) {
result += omni::int_to_hex(i_int);
}
@@ -39,9 +37,8 @@ QString fanta_decrypt(QString temp_input, unsigned int key)
QVector<unsigned int> unhexed_vector;
- for(unsigned int i=0; i< input.length(); i+=2)
- {
- std::string byte = input.substr(i,2);
+ for (unsigned int i = 0; i < input.length(); i += 2) {
+ std::string byte = input.substr(i, 2);
unsigned int hex_int = strtoul(byte.c_str(), nullptr, 16);
unhexed_vector.append(hex_int);
}
@@ -51,13 +48,11 @@ QString fanta_decrypt(QString temp_input, unsigned int key)
std::string result = "";
- for (int pos = 0 ; pos < unhexed_vector.size() ; ++pos)
- {
+ for (int pos = 0; pos < unhexed_vector.size(); ++pos) {
unsigned char output = unhexed_vector.at(pos) ^ (key >> 8) % 256;
result += output;
key = (unhexed_vector.at(pos) + key) * C1 + C2;
}
return QString::fromStdString(result);
-
}
diff --git a/src/evidence.cpp b/src/evidence.cpp
index ebef7490..128156cb 100644
--- a/src/evidence.cpp
+++ b/src/evidence.cpp
@@ -4,7 +4,7 @@ void Courtroom::construct_evidence()
{
ui_evidence = new AOImage(this, ao_app);
- //ui_evidence_name = new QLabel(ui_evidence);
+ // ui_evidence_name = new QLabel(ui_evidence);
ui_evidence_name = new AOLineEdit(ui_evidence);
ui_evidence_name->setAlignment(Qt::AlignCenter);
ui_evidence_name->setFont(QFont("Arial", 14, QFont::Bold));
@@ -32,7 +32,8 @@ void Courtroom::construct_evidence()
set_size_and_pos(ui_evidence, "evidence_background");
set_size_and_pos(ui_evidence_buttons, "evidence_buttons");
- QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini");
+ QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing",
+ "courtroom_design.ini");
const int button_width = 70;
int x_spacing = f_spacing.x();
@@ -42,43 +43,57 @@ void Courtroom::construct_evidence()
int y_spacing = f_spacing.y();
int y_mod_count = 0;
- evidence_columns = ((ui_evidence_buttons->width() - button_width) / (x_spacing + button_width)) + 1;
- evidence_rows = ((ui_evidence_buttons->height() - button_height) / (y_spacing + button_height)) + 1;
+ evidence_columns = ((ui_evidence_buttons->width() - button_width) /
+ (x_spacing + button_width)) +
+ 1;
+ evidence_rows = ((ui_evidence_buttons->height() - button_height) /
+ (y_spacing + button_height)) +
+ 1;
max_evidence_on_page = evidence_columns * evidence_rows;
- for (int n = 0 ; n < max_evidence_on_page ; ++n)
- {
+ for (int n = 0; n < max_evidence_on_page; ++n) {
int x_pos = (button_width + x_spacing) * x_mod_count;
int y_pos = (button_height + y_spacing) * y_mod_count;
- AOEvidenceButton *f_evidence = new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos);
+ AOEvidenceButton *f_evidence =
+ new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos);
ui_evidence_list.append(f_evidence);
f_evidence->set_id(n);
- connect(f_evidence, SIGNAL(evidence_clicked(int)), this, SLOT(on_evidence_clicked(int)));
- connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this, SLOT(on_evidence_double_clicked(int)));
- connect(f_evidence, SIGNAL(on_hover(int, bool)), this, SLOT(on_evidence_hover(int, bool)));
+ connect(f_evidence, SIGNAL(evidence_clicked(int)), this,
+ SLOT(on_evidence_clicked(int)));
+ connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this,
+ SLOT(on_evidence_double_clicked(int)));
+ connect(f_evidence, SIGNAL(on_hover(int, bool)), this,
+ SLOT(on_evidence_hover(int, bool)));
++x_mod_count;
- if (x_mod_count == evidence_columns)
- {
+ if (x_mod_count == evidence_columns) {
++y_mod_count;
x_mod_count = 0;
}
}
- connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited()));
- connect(ui_evidence_left, SIGNAL(clicked()), this, SLOT(on_evidence_left_clicked()));
- connect(ui_evidence_right, SIGNAL(clicked()), this, SLOT(on_evidence_right_clicked()));
- connect(ui_evidence_present, SIGNAL(clicked()), this, SLOT(on_evidence_present_clicked()));
- connect(ui_evidence_delete, SIGNAL(clicked()), this, SLOT(on_evidence_delete_clicked()));
- connect(ui_evidence_image_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_image_name_edited()));
- connect(ui_evidence_image_button, SIGNAL(clicked()), this, SLOT(on_evidence_image_button_clicked()));
- connect(ui_evidence_x, SIGNAL(clicked()), this, SLOT(on_evidence_x_clicked()));
+ connect(ui_evidence_name, SIGNAL(returnPressed()), this,
+ SLOT(on_evidence_name_edited()));
+ connect(ui_evidence_left, SIGNAL(clicked()), this,
+ SLOT(on_evidence_left_clicked()));
+ connect(ui_evidence_right, SIGNAL(clicked()), this,
+ SLOT(on_evidence_right_clicked()));
+ connect(ui_evidence_present, SIGNAL(clicked()), this,
+ SLOT(on_evidence_present_clicked()));
+ connect(ui_evidence_delete, SIGNAL(clicked()), this,
+ SLOT(on_evidence_delete_clicked()));
+ connect(ui_evidence_image_name, SIGNAL(returnPressed()), this,
+ SLOT(on_evidence_image_name_edited()));
+ connect(ui_evidence_image_button, SIGNAL(clicked()), this,
+ SLOT(on_evidence_image_button_clicked()));
+ connect(ui_evidence_x, SIGNAL(clicked()), this,
+ SLOT(on_evidence_x_clicked()));
ui_evidence->hide();
}
@@ -98,26 +113,23 @@ void Courtroom::set_evidence_page()
ui_evidence_left->hide();
ui_evidence_right->hide();
- for (AOEvidenceButton *i_button : ui_evidence_list)
- {
+ for (AOEvidenceButton *i_button : ui_evidence_list) {
i_button->reset();
}
- //to account for the "add evidence" button
+ // to account for the "add evidence" button
++total_evidence;
int total_pages = total_evidence / max_evidence_on_page;
int evidence_on_page = 0;
- if ((total_evidence % max_evidence_on_page) != 0)
- {
+ if ((total_evidence % max_evidence_on_page) != 0) {
++total_pages;
- //i. e. not on the last page
+ // i. e. not on the last page
if (total_pages > current_evidence_page + 1)
evidence_on_page = max_evidence_on_page;
else
evidence_on_page = total_evidence % max_evidence_on_page;
-
}
else
evidence_on_page = max_evidence_on_page;
@@ -128,17 +140,19 @@ void Courtroom::set_evidence_page()
if (current_evidence_page > 0)
ui_evidence_left->show();
- for (int n_evidence_button = 0 ; n_evidence_button < evidence_on_page ; ++n_evidence_button)
- {
- int n_real_evidence = n_evidence_button + current_evidence_page * max_evidence_on_page;
- AOEvidenceButton *f_evidence_button = ui_evidence_list.at(n_evidence_button);
+ for (int n_evidence_button = 0; n_evidence_button < evidence_on_page;
+ ++n_evidence_button) {
+ int n_real_evidence =
+ n_evidence_button + current_evidence_page * max_evidence_on_page;
+ AOEvidenceButton *f_evidence_button =
+ ui_evidence_list.at(n_evidence_button);
- //ie. the add evidence button
+ // ie. the add evidence button
if (n_real_evidence == (total_evidence - 1))
f_evidence_button->set_theme_image("addevidence.png");
- else if (n_real_evidence < (total_evidence - 1))
- {
- f_evidence_button->set_image(local_evidence_list.at(n_real_evidence).image);
+ else if (n_real_evidence < (total_evidence - 1)) {
+ f_evidence_button->set_image(
+ local_evidence_list.at(n_real_evidence).image);
if (n_real_evidence == current_evidence)
f_evidence_button->set_selected(true);
@@ -198,7 +212,7 @@ void Courtroom::on_evidence_image_button_clicked()
QStringList filenames;
if (dialog.exec())
- filenames = dialog.selectedFiles();
+ filenames = dialog.selectedFiles();
if (filenames.size() != 1)
return;
@@ -215,9 +229,9 @@ void Courtroom::on_evidence_clicked(int p_id)
int f_real_id = p_id + max_evidence_on_page * current_evidence_page;
- if (f_real_id == local_evidence_list.size())
- {
- ao_app->send_server_packet(new AOPacket("PE#<name>#<description>#empty.png#%"));
+ if (f_real_id == local_evidence_list.size()) {
+ ao_app->send_server_packet(
+ new AOPacket("PE#<name>#<description>#empty.png#%"));
return;
}
else if (f_real_id > local_evidence_list.size())
@@ -233,7 +247,6 @@ void Courtroom::on_evidence_clicked(int p_id)
current_evidence = f_real_id;
ui_ic_chat_message->setFocus();
-
}
void Courtroom::on_evidence_double_clicked(int p_id)
@@ -262,8 +275,7 @@ void Courtroom::on_evidence_hover(int p_id, bool p_state)
ui_evidence_name->setReadOnly(true);
int final_id = p_id + max_evidence_on_page * current_evidence_page;
- if (p_state)
- {
+ if (p_state) {
if (final_id == local_evidence_list.size())
ui_evidence_name->setText("Add new evidence...");
else if (final_id < local_evidence_list.size())
@@ -310,7 +322,8 @@ void Courtroom::on_evidence_delete_clicked()
ui_evidence_description->setReadOnly(true);
ui_evidence_overlay->hide();
- ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
+ ao_app->send_server_packet(
+ new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
current_evidence = 0;
@@ -338,4 +351,3 @@ void Courtroom::on_evidence_x_clicked()
ui_ic_chat_message->setFocus();
}
-
diff --git a/src/file_functions.cpp b/src/file_functions.cpp
index f93ee15d..e64a46bf 100644
--- a/src/file_functions.cpp
+++ b/src/file_functions.cpp
@@ -14,7 +14,8 @@ bool dir_exists(QString dir_path)
return check_dir.exists();
}
-bool exists(QString p_path) {
+bool exists(QString p_path)
+{
QFile file(p_path);
return file.exists();
diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp
index 5d6b6ffa..4dbc4380 100644
--- a/src/hardware_functions.cpp
+++ b/src/hardware_functions.cpp
@@ -2,7 +2,7 @@
#include <QDebug>
-#if (defined (_WIN32) || defined (_WIN64))
+#if (defined(_WIN32) || defined(_WIN64))
#include <windows.h>
static DWORD dwVolSerial;
@@ -10,17 +10,18 @@ static BOOL bIsRetrieved;
QString get_hdid()
{
- bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial, nullptr, nullptr, nullptr, 0);
+ bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial,
+ nullptr, nullptr, nullptr, 0);
if (bIsRetrieved)
return QString::number(dwVolSerial, 16);
else
- //a totally random string
- //what could possibly go wrong
+ // a totally random string
+ // what could possibly go wrong
return "gxsps32sa9fnwic92mfbs0";
}
-#elif (defined (LINUX) || defined (__linux__))
+#elif (defined(LINUX) || defined(__linux__))
#include <QFile>
#include <QTextStream>
@@ -33,12 +34,10 @@ QString get_hdid()
QTextStream in(&fstab_file);
- while(!in.atEnd())
- {
+ while (!in.atEnd()) {
QString line = in.readLine();
- if (line.startsWith("UUID"))
- {
+ if (line.startsWith("UUID")) {
QStringList line_elements = line.split("=");
if (line_elements.size() > 1)
@@ -52,7 +51,7 @@ QString get_hdid()
#elif defined __APPLE__
QString get_hdid()
{
- //hdids are broken at this point anyways
+ // hdids are broken at this point anyways
return "just a mac passing by";
}
diff --git a/src/hex_functions.cpp b/src/hex_functions.cpp
index 4a58d2b4..1e35718f 100644
--- a/src/hex_functions.cpp
+++ b/src/hex_functions.cpp
@@ -1,18 +1,17 @@
#include "hex_functions.h"
-namespace omni
+namespace omni {
+std::string int_to_hex(unsigned int input)
{
- std::string int_to_hex(unsigned int input)
- {
- if (input > 255)
- return "FF";
+ if (input > 255)
+ return "FF";
- std::stringstream stream;
- stream << std::setfill('0') << std::setw(sizeof(char)*2)
- << std::hex << input;
- std::string result(stream.str());
- std::transform(result.begin(), result.end(), result.begin(), ::toupper);
+ std::stringstream stream;
+ stream << std::setfill('0') << std::setw(sizeof(char) * 2) << std::hex
+ << input;
+ std::string result(stream.str());
+ std::transform(result.begin(), result.end(), result.begin(), ::toupper);
- return result;
- }
+ return result;
}
+} // namespace omni
diff --git a/src/lobby.cpp b/src/lobby.cpp
index 4a96e567..79a37bea 100644
--- a/src/lobby.cpp
+++ b/src/lobby.cpp
@@ -1,9 +1,9 @@
#include "lobby.h"
-#include "debug_functions.h"
#include "aoapplication.h"
-#include "networkmanager.h"
#include "aosfxplayer.h"
+#include "debug_functions.h"
+#include "networkmanager.h"
Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
{
@@ -37,17 +37,22 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
ui_progress_bar->setStyleSheet("QProgressBar{ color: white; }");
ui_cancel = new AOButton(ui_loading_background, ao_app);
- connect(ui_public_servers, SIGNAL(clicked()), this, SLOT(on_public_servers_clicked()));
+ connect(ui_public_servers, SIGNAL(clicked()), this,
+ SLOT(on_public_servers_clicked()));
connect(ui_favorites, SIGNAL(clicked()), this, SLOT(on_favorites_clicked()));
connect(ui_refresh, SIGNAL(pressed()), this, SLOT(on_refresh_pressed()));
connect(ui_refresh, SIGNAL(released()), this, SLOT(on_refresh_released()));
- connect(ui_add_to_fav, SIGNAL(pressed()), this, SLOT(on_add_to_fav_pressed()));
- connect(ui_add_to_fav, SIGNAL(released()), this, SLOT(on_add_to_fav_released()));
+ connect(ui_add_to_fav, SIGNAL(pressed()), this,
+ SLOT(on_add_to_fav_pressed()));
+ connect(ui_add_to_fav, SIGNAL(released()), this,
+ SLOT(on_add_to_fav_released()));
connect(ui_connect, SIGNAL(pressed()), this, SLOT(on_connect_pressed()));
connect(ui_connect, SIGNAL(released()), this, SLOT(on_connect_released()));
connect(ui_about, SIGNAL(clicked()), this, SLOT(on_about_clicked()));
- connect(ui_server_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_server_list_clicked(QModelIndex)));
- connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed()));
+ connect(ui_server_list, SIGNAL(clicked(QModelIndex)), this,
+ SLOT(on_server_list_clicked(QModelIndex)));
+ connect(ui_chatmessage, SIGNAL(returnPressed()), this,
+ SLOT(on_chatfield_return_pressed()));
connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
ui_connect->setEnabled(false);
@@ -57,7 +62,7 @@ Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow()
set_widgets();
}
-//sets images, position and size
+// sets images, position and size
void Lobby::set_widgets()
{
ao_app->reload_theme();
@@ -66,8 +71,7 @@ void Lobby::set_widgets()
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 " << filename;
// Most common symptom of bad config files and missing assets.
@@ -77,8 +81,7 @@ void Lobby::set_widgets()
this->resize(517, 666);
}
- else
- {
+ else {
this->resize(f_lobby.width, f_lobby.height);
}
@@ -108,7 +111,7 @@ void Lobby::set_widgets()
set_size_and_pos(ui_server_list, "server_list");
ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "font: bold;");
+ "font: bold;");
set_size_and_pos(ui_player_count, "player_count");
ui_player_count->setText("Offline");
@@ -123,20 +126,21 @@ void Lobby::set_widgets()
set_size_and_pos(ui_chatbox, "chatbox");
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");
ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
"selection-background-color: rgba(0, 0, 0, 0);");
set_size_and_pos(ui_chatmessage, "chatmessage");
- ui_chatmessage->setStyleSheet("background-color: rgba(0, 0, 0, 0);"
- "selection-background-color: rgba(0, 0, 0, 0);");
+ ui_chatmessage->setStyleSheet(
+ "background-color: rgba(0, 0, 0, 0);"
+ "selection-background-color: rgba(0, 0, 0, 0);");
ui_loading_background->resize(this->width(), this->height());
ui_loading_background->set_image("loadingbackground.png");
-
set_size_and_pos(ui_loading_text, "loading_label");
ui_loading_text->setFont(QFont("Arial", 20, QFont::Bold));
ui_loading_text->setReadOnly(true);
@@ -151,22 +155,20 @@ void Lobby::set_widgets()
ui_cancel->setText("Cancel");
ui_loading_background->hide();
-
}
void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
{
QString filename = "lobby_design.ini";
- pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename);
+ 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;
p_widget->hide();
}
- else
- {
+ else {
p_widget->move(design_ini_result.x, design_ini_result.y);
p_widget->resize(design_ini_result.width, design_ini_result.height);
}
@@ -186,10 +188,7 @@ QString Lobby::get_chatlog()
return return_value;
}
-int Lobby::get_selected_server()
-{
- return ui_server_list->currentRow();
-}
+int Lobby::get_selected_server() { return ui_server_list->currentRow(); }
void Lobby::set_loading_value(int p_value)
{
@@ -212,7 +211,7 @@ void Lobby::on_favorites_clicked()
ui_public_servers->set_image("publicservers.png");
ao_app->set_favorite_list();
- //ao_app->favorite_list = read_serverlist_txt();
+ // ao_app->favorite_list = read_serverlist_txt();
list_favorites();
@@ -242,7 +241,7 @@ void Lobby::on_add_to_fav_released()
{
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)
return;
@@ -267,17 +266,18 @@ void Lobby::on_connect_released()
void Lobby::on_about_clicked()
{
- QString msg = tr("<h2>Attorney Online %1</h2>"
- "The courtroom drama simulator"
- "<p><b>Source code:</b> "
- "<a href='https://github.com/AttorneyOnline/AO2-Client'>"
- "https://github.com/AttorneyOnline/AO2-Client</a>"
- "<p><b>Major development:</b><br>"
- "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter"
- "<p><b>Special thanks:</b><br>"
- "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), "
- "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, "
- "Noevain, Cronnicossy")
+ QString msg =
+ tr("<h2>Attorney Online %1</h2>"
+ "The courtroom drama simulator"
+ "<p><b>Source code:</b> "
+ "<a href='https://github.com/AttorneyOnline/AO2-Client'>"
+ "https://github.com/AttorneyOnline/AO2-Client</a>"
+ "<p><b>Major development:</b><br>"
+ "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter"
+ "<p><b>Special thanks:</b><br>"
+ "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), "
+ "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, "
+ "Noevain, Cronnicossy")
.arg(ao_app->get_version_string());
QMessageBox::about(this, "About", msg);
}
@@ -290,8 +290,7 @@ void Lobby::on_server_list_clicked(QModelIndex p_model)
if (n_server < 0)
return;
- if (public_servers_selected)
- {
+ if (public_servers_selected) {
QVector<server_type> f_server_list = ao_app->get_server_list();
if (n_server >= f_server_list.size())
@@ -299,8 +298,7 @@ void Lobby::on_server_list_clicked(QModelIndex p_model)
f_server = f_server_list.at(p_model.row());
}
- else
- {
+ else {
if (n_server >= ao_app->get_favorite_list().size())
return;
@@ -322,11 +320,10 @@ void Lobby::on_server_list_clicked(QModelIndex p_model)
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() == "")
return;
-
QString f_header = "CT";
QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()};
@@ -345,8 +342,7 @@ void Lobby::list_servers()
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);
}
}
@@ -355,15 +351,16 @@ void Lobby::list_favorites()
{
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);
}
}
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());
}
void Lobby::append_error(QString f_message)
@@ -373,16 +370,11 @@ void Lobby::append_error(QString f_message)
void Lobby::set_player_count(int players_online, int max_players)
{
- QString f_string = "Online: " + QString::number(players_online) + "/" + QString::number(max_players);
+ QString f_string = "Online: " + QString::number(players_online) + "/" +
+ QString::number(max_players);
ui_player_count->setText(f_string);
}
-void Lobby::enable_connect_button()
-{
- ui_connect->setEnabled(true);
-}
+void Lobby::enable_connect_button() { ui_connect->setEnabled(true); }
-Lobby::~Lobby()
-{
-
-}
+Lobby::~Lobby() {}
diff --git a/src/main.cpp b/src/main.cpp
index 80ea93bb..1caa3945 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,24 +1,24 @@
#include "aoapplication.h"
+#include "courtroom.h"
#include "datatypes.h"
-#include "networkmanager.h"
#include "lobby.h"
-#include "courtroom.h"
-#include <QPluginLoader>
+#include "networkmanager.h"
#include <QDebug>
+#include <QPluginLoader>
int main(int argc, char *argv[])
{
#if QT_VERSION > QT_VERSION_CHECK(5, 6, 0)
- // High-DPI support is for Qt version >=5.6.
- // However, many Linux distros still haven't brought their stable/LTS
- // packages up to Qt 5.6, so this is conditional.
- AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ // High-DPI support is for Qt version >=5.6.
+ // However, many Linux distros still haven't brought their stable/LTS
+ // packages up to Qt 5.6, so this is conditional.
+ AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
- AOApplication main_app(argc, argv);
- main_app.construct_lobby();
- main_app.net_manager->connect_to_master();
- main_app.w_lobby->show();
- return main_app.exec();
+ AOApplication main_app(argc, argv);
+ main_app.construct_lobby();
+ main_app.net_manager->connect_to_master();
+ main_app.w_lobby->show();
+ return main_app.exec();
}
diff --git a/src/misc_functions.cpp b/src/misc_functions.cpp
index 23520551..cc144153 100644
--- a/src/misc_functions.cpp
+++ b/src/misc_functions.cpp
@@ -4,6 +4,6 @@ void delay(int p_milliseconds)
{
QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds);
- while(QTime::currentTime() < dieTime)
+ while (QTime::currentTime() < dieTime)
QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}
diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp
index a9810d49..cf89d0ab 100644
--- a/src/networkmanager.cpp
+++ b/src/networkmanager.cpp
@@ -13,21 +13,23 @@ NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent)
ms_reconnect_timer = new QTimer(this);
ms_reconnect_timer->setSingleShot(true);
- QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect()));
-
- QObject::connect(ms_socket, SIGNAL(readyRead()), this, SLOT(handle_ms_packet()));
- QObject::connect(server_socket, SIGNAL(readyRead()), this, SLOT(handle_server_packet()));
- QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, SLOT(server_disconnected()));
-
- QString master_config = ao_app->configini->value("master", "").value<QString>();
+ QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this,
+ SLOT(retry_ms_connect()));
+
+ QObject::connect(ms_socket, SIGNAL(readyRead()), this,
+ SLOT(handle_ms_packet()));
+ QObject::connect(server_socket, SIGNAL(readyRead()), this,
+ SLOT(handle_server_packet()));
+ QObject::connect(server_socket, SIGNAL(disconnected()), ao_app,
+ SLOT(server_disconnected()));
+
+ QString master_config =
+ ao_app->configini->value("master", "").value<QString>();
if (master_config != "")
ms_nosrv_hostname = master_config;
}
-NetworkManager::~NetworkManager()
-{
-
-}
+NetworkManager::~NetworkManager() {}
void NetworkManager::connect_to_master()
{
@@ -43,11 +45,11 @@ void NetworkManager::connect_to_master()
void NetworkManager::connect_to_master_nosrv()
{
- QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
+ QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
+ SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
- QObject::connect(ms_socket, SIGNAL(connected()),
- this, SLOT(on_ms_nosrv_connect_success()));
+ QObject::connect(ms_socket, SIGNAL(connected()), this,
+ SLOT(on_ms_nosrv_connect_success()));
ms_socket->connectToHost(ms_nosrv_hostname, ms_port);
}
@@ -61,12 +63,10 @@ void NetworkManager::connect_to_server(server_type p_server)
void NetworkManager::ship_ms_packet(QString p_packet)
{
- if (!ms_socket->isOpen())
- {
+ if (!ms_socket->isOpen()) {
retry_ms_connect();
}
- else
- {
+ else {
ms_socket->write(p_packet.toUtf8());
}
}
@@ -81,93 +81,86 @@ void NetworkManager::handle_ms_packet()
QByteArray buffer = ms_socket->readAll();
QString in_data = QString::fromUtf8(buffer, buffer.size());
- if (!in_data.endsWith("%"))
- {
+ if (!in_data.endsWith("%")) {
ms_partial_packet = true;
ms_temp_packet += in_data;
return;
}
- else
- {
- if (ms_partial_packet)
- {
+ else {
+ if (ms_partial_packet) {
in_data = ms_temp_packet + in_data;
ms_temp_packet = "";
ms_partial_packet = false;
}
}
- QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
+ QStringList packet_list =
+ in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
- for (QString packet : packet_list)
- {
+ for (QString packet : packet_list) {
AOPacket *f_packet = new AOPacket(packet);
ao_app->ms_packet_received(f_packet);
}
}
-
void NetworkManager::perform_srv_lookup()
{
- #ifdef MS_FAILOVER_SUPPORTED
+#ifdef MS_FAILOVER_SUPPORTED
ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this);
connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup()));
ms_dns->lookup();
- #endif
+#endif
}
void NetworkManager::on_srv_lookup()
{
- #ifdef MS_FAILOVER_SUPPORTED
+#ifdef MS_FAILOVER_SUPPORTED
bool connected = false;
- if (ms_dns->error() != QDnsLookup::NoError)
- {
+ if (ms_dns->error() != QDnsLookup::NoError) {
qWarning("SRV lookup of the master server DNS failed.");
ms_dns->deleteLater();
}
- else
- {
+ else {
const auto srv_records = ms_dns->serviceRecords();
- for (const QDnsServiceRecord &record : srv_records)
- {
+ for (const QDnsServiceRecord &record : srv_records) {
#ifdef DEBUG_NETWORK
qDebug() << "Connecting to " << record.target() << ":" << record.port();
#endif
ms_socket->connectToHost(record.target(), record.port());
QTime timer;
timer.start();
- do
- {
+ do {
ao_app->processEvents();
- if (ms_socket->state() == QAbstractSocket::ConnectedState)
- {
+ if (ms_socket->state() == QAbstractSocket::ConnectedState) {
connected = true;
break;
}
- else if (ms_socket->state() != QAbstractSocket::ConnectingState
- && ms_socket->state() != QAbstractSocket::HostLookupState
- && ms_socket->error() != -1)
- {
+ else if (ms_socket->state() != QAbstractSocket::ConnectingState &&
+ ms_socket->state() != QAbstractSocket::HostLookupState &&
+ ms_socket->error() != -1) {
qDebug() << ms_socket->error();
- qWarning() << "Error connecting to master server:" << ms_socket->errorString();
+ qWarning() << "Error connecting to master server:"
+ << ms_socket->errorString();
ms_socket->abort();
ms_socket->close();
break;
}
- } while (timer.elapsed() < timeout_milliseconds); // Very expensive spin-wait loop - it will bring CPU to 100%!
- if (connected)
- {
- // Connect a one-shot signal in case the master server disconnects randomly
- QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
+ } while (timer.elapsed() <
+ timeout_milliseconds); // Very expensive spin-wait loop - it will
+ // bring CPU to 100%!
+ if (connected) {
+ // Connect a one-shot signal in case the master server disconnects
+ // randomly
+ QObject::connect(
+ ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
+ SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
break;
}
- else
- {
+ else {
ms_socket->abort();
ms_socket->close();
}
@@ -179,29 +172,30 @@ void NetworkManager::on_srv_lookup()
connect_to_master_nosrv();
else
emit ms_connect_finished(connected, false);
- #endif
+#endif
}
void NetworkManager::on_ms_nosrv_connect_success()
{
emit ms_connect_finished(true, false);
- QObject::disconnect(ms_socket, SIGNAL(connected()),
- this, SLOT(on_ms_nosrv_connect_success()));
+ QObject::disconnect(ms_socket, SIGNAL(connected()), this,
+ SLOT(on_ms_nosrv_connect_success()));
- QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
+ QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
+ SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
}
void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error)
{
- qWarning() << "Master server socket error:" << ms_socket->errorString()
- << "(" << error << ")";
+ qWarning() << "Master server socket error:" << ms_socket->errorString() << "("
+ << error << ")";
// Disconnect the one-shot signal - this way, failover connect attempts
// don't trigger a full retry
QObject::disconnect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
- this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
+ this,
+ SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
emit ms_connect_finished(false, true);
@@ -210,7 +204,8 @@ void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error)
void NetworkManager::retry_ms_connect()
{
- if (!ms_reconnect_timer->isActive() && ms_socket->state() != QAbstractSocket::ConnectingState)
+ if (!ms_reconnect_timer->isActive() &&
+ ms_socket->state() != QAbstractSocket::ConnectingState)
connect_to_master();
}
@@ -219,27 +214,24 @@ void NetworkManager::handle_server_packet()
QByteArray buffer = server_socket->readAll();
QString in_data = QString::fromUtf8(buffer, buffer.size());
- if (!in_data.endsWith("%"))
- {
+ if (!in_data.endsWith("%")) {
partial_packet = true;
temp_packet += in_data;
return;
}
- else
- {
- if (partial_packet)
- {
+ else {
+ if (partial_packet) {
in_data = temp_packet + in_data;
temp_packet = "";
partial_packet = false;
}
}
- QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
+ QStringList packet_list =
+ in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts));
- for (QString packet : packet_list)
- {
+ for (QString packet : packet_list) {
AOPacket *f_packet = new AOPacket(packet);
ao_app->server_packet_received(f_packet);
diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp
index 942c275d..baba0eac 100644
--- a/src/packet_distribution.cpp
+++ b/src/packet_distribution.cpp
@@ -1,11 +1,11 @@
#include "aoapplication.h"
-#include "lobby.h"
#include "courtroom.h"
-#include "networkmanager.h"
+#include "debug_functions.h"
#include "encryption_functions.h"
#include "hardware_functions.h"
-#include "debug_functions.h"
+#include "lobby.h"
+#include "networkmanager.h"
void AOApplication::ms_packet_received(AOPacket *p_packet)
{
@@ -19,17 +19,14 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
qDebug() << "R(ms):" << p_packet->to_string();
#endif
- if (header == "ALL")
- {
+ if (header == "ALL") {
server_list.clear();
- for (QString i_string : p_packet->get_contents())
- {
+ for (QString i_string : p_packet->get_contents()) {
server_type f_server;
QStringList sub_contents = i_string.split("&");
- if (sub_contents.size() < 4)
- {
+ if (sub_contents.size() < 4) {
qDebug() << "W: malformed packet";
continue;
}
@@ -42,39 +39,32 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
server_list.append(f_server);
}
- if (lobby_constructed)
- {
+ if (lobby_constructed) {
w_lobby->list_servers();
}
}
- else if (header == "CT")
- {
+ else if (header == "CT") {
QString f_name, f_message;
- if (f_contents.size() == 1)
- {
+ if (f_contents.size() == 1) {
f_name = "";
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_message = f_contents.at(1);
}
else
goto end;
- if (lobby_constructed)
- {
+ if (lobby_constructed) {
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);
}
}
- else if (header == "AO2CHECK")
- {
+ else if (header == "AO2CHECK") {
send_ms_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
send_ms_packet(new AOPacket("HI#" + get_hdid() + "#%"));
@@ -92,31 +82,28 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
if (get_release() > f_release)
goto end;
- else if (get_release() == f_release)
- {
+ else if (get_release() == f_release) {
if (get_major_version() > f_major)
goto end;
- else if (get_major_version() == f_major)
- {
+ else if (get_major_version() == f_major) {
if (get_minor_version() >= f_minor)
goto end;
}
}
- call_notice("Outdated version! Your version: " + get_version_string()
- + "\nPlease go to aceattorneyonline.com to update.");
+ call_notice("Outdated version! Your version: " + get_version_string() +
+ "\nPlease go to aceattorneyonline.com to update.");
destruct_courtroom();
destruct_lobby();
}
- else if (header == "DOOM")
- {
+ else if (header == "DOOM") {
call_notice("You have been exiled from AO."
"Have a nice day.");
destruct_courtroom();
destruct_lobby();
}
- end:
+end:
delete p_packet;
}
@@ -134,15 +121,14 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
qDebug() << "R:" << f_packet;
#endif
- if (header == "decryptor")
- {
+ if (header == "decryptor") {
if (f_contents.size() == 0)
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();
- //default(legacy) values
+ // default(legacy) values
encryption_needed = true;
yellow_text_enabled = false;
prezoom_enabled = false;
@@ -156,7 +142,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
casing_alerts_enabled = false;
modcall_reason_enabled = false;
- //workaround for tsuserver4
+ // workaround for tsuserver4
if (f_contents.at(0) == "NOENCRYPT")
encryption_needed = false;
@@ -166,8 +152,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%");
send_server_packet(hi_packet);
}
- else if (header == "ID")
- {
+ else if (header == "ID") {
if (f_contents.size() < 2)
goto end;
@@ -176,55 +161,53 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%"));
}
- else if (header == "CT")
- {
+ else if (header == "CT") {
if (f_contents.size() < 2)
goto end;
- if (courtroom_constructed)
- {
+ if (courtroom_constructed) {
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
- 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")
- {
- if (f_packet.contains("yellowtext",Qt::CaseInsensitive))
+ else if (header == "FL") {
+ if (f_packet.contains("yellowtext", Qt::CaseInsensitive))
yellow_text_enabled = true;
- if (f_packet.contains("flipping",Qt::CaseInsensitive))
+ if (f_packet.contains("flipping", Qt::CaseInsensitive))
flipping_enabled = true;
- if (f_packet.contains("customobjections",Qt::CaseInsensitive))
+ if (f_packet.contains("customobjections", Qt::CaseInsensitive))
custom_objection_enabled = true;
- if (f_packet.contains("fastloading",Qt::CaseInsensitive))
+ if (f_packet.contains("fastloading", Qt::CaseInsensitive))
improved_loading_enabled = true;
- if (f_packet.contains("noencryption",Qt::CaseInsensitive))
+ if (f_packet.contains("noencryption", Qt::CaseInsensitive))
encryption_needed = false;
- if (f_packet.contains("deskmod",Qt::CaseInsensitive))
+ if (f_packet.contains("deskmod", Qt::CaseInsensitive))
desk_mod_enabled = true;
- if (f_packet.contains("evidence",Qt::CaseInsensitive))
+ if (f_packet.contains("evidence", Qt::CaseInsensitive))
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;
- if (f_packet.contains("arup",Qt::CaseInsensitive))
+ if (f_packet.contains("arup", Qt::CaseInsensitive))
arup_enabled = true;
- if (f_packet.contains("casing_alerts",Qt::CaseInsensitive))
+ if (f_packet.contains("casing_alerts", Qt::CaseInsensitive))
casing_alerts_enabled = true;
- if (f_packet.contains("modcall_reason",Qt::CaseInsensitive))
+ if (f_packet.contains("modcall_reason", Qt::CaseInsensitive))
modcall_reason_enabled = true;
w_lobby->enable_connect_button();
}
- else if (header == "PN")
- {
+ else if (header == "PN") {
if (f_contents.size() < 2)
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)
goto end;
@@ -249,8 +232,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
int selected_server = w_lobby->get_selected_server();
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()) {
auto info = server_list.at(selected_server);
server_name = info.name;
@@ -258,8 +240,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
window_title += ": " + server_name;
}
}
- else
- {
+ else {
if (selected_server >= 0 && selected_server < favorite_list.size()) {
auto info = favorite_list.at(selected_server);
server_name = info.name;
@@ -276,7 +257,7 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
AOPacket *f_packet;
- if(improved_loading_enabled)
+ if (improved_loading_enabled)
f_packet = new AOPacket("RC#%");
else
f_packet = new AOPacket("askchar2#%");
@@ -286,19 +267,19 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
QCryptographicHash hash(QCryptographicHash::Algorithm::Sha256);
hash.addData(server_address.toUtf8());
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)
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)
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)
break;
@@ -310,37 +291,40 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
f_char.name = sub_elements.at(0);
f_char.description = sub_elements.at(1);
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;
++loaded_chars;
- w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size));
+ w_lobby->set_loading_text("Loading chars:\n" +
+ QString::number(loaded_chars) + "/" +
+ QString::number(char_list_size));
w_courtroom->append_char(f_char);
- int total_loading_size = 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);
+ int total_loading_size =
+ 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);
}
if (improved_loading_enabled)
send_server_packet(new AOPacket("RE#%"));
- else
- {
- QString next_packet_number = QString::number(((loaded_chars - 1) / 10) + 1);
+ else {
+ QString next_packet_number =
+ QString::number(((loaded_chars - 1) / 10) + 1);
send_server_packet(new AOPacket("AN#" + next_packet_number + "#%"));
}
-
}
- else if (header == "EI")
- {
+ else if (header == "EI") {
if (!courtroom_constructed)
goto end;
-
// +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)
goto end;
@@ -354,33 +338,36 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
evi_type f_evi;
f_evi.name = sub_elements.at(0);
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);
++loaded_evidence;
- w_lobby->set_loading_text("Loading evidence:\n" + QString::number(loaded_evidence) + "/" + QString::number(evidence_list_size));
+ w_lobby->set_loading_text("Loading evidence:\n" +
+ QString::number(loaded_evidence) + "/" +
+ QString::number(evidence_list_size));
w_courtroom->append_evidence(f_evi);
- int total_loading_size = 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);
+ int total_loading_size =
+ 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);
QString next_packet_number = QString::number(loaded_evidence);
send_server_packet(new AOPacket("AE#" + next_packet_number + "#%"));
-
}
- else if (header == "EM")
- {
+ else if (header == "EM") {
if (!courtroom_constructed)
goto end;
bool musics_time = false;
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)
break;
@@ -391,52 +378,49 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
++loaded_music;
- w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size));
+ w_lobby->set_loading_text("Loading music:\n" +
+ QString::number(loaded_music) + "/" +
+ QString::number(music_list_size));
- if (musics_time)
- {
- w_courtroom->append_music(f_music);
+ if (musics_time) {
+ w_courtroom->append_music(f_music);
}
- else
- {
- if (f_music.endsWith(".wav") ||
- f_music.endsWith(".mp3") ||
- f_music.endsWith(".mp4") ||
- f_music.endsWith(".ogg") ||
- f_music.endsWith(".opus"))
- {
- musics_time = true;
- areas--;
- w_courtroom->fix_last_area();
- w_courtroom->append_music(f_music);
- }
- else
- {
- w_courtroom->append_area(f_music);
- areas++;
- }
+ else {
+ if (f_music.endsWith(".wav") || f_music.endsWith(".mp3") ||
+ f_music.endsWith(".mp4") || f_music.endsWith(".ogg") ||
+ f_music.endsWith(".opus")) {
+ musics_time = 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++)
- {
- w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
+ for (int area_n = 0; area_n < areas; area_n++) {
+ w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
}
- int total_loading_size = 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);
+ int total_loading_size =
+ 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);
}
QString next_packet_number = QString::number(((loaded_music - 1) / 10) + 1);
send_server_packet(new AOPacket("AM#" + next_packet_number + "#%"));
}
- else if (header == "CharsCheck")
- {
+ else if (header == "CharsCheck") {
if (!courtroom_constructed)
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")
w_courtroom->set_taken(n_char, true);
else
@@ -444,13 +428,11 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
}
}
- else if (header == "SC")
- {
+ else if (header == "SC") {
if (!courtroom_constructed)
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("&");
char_type f_char;
@@ -458,74 +440,78 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
if (sub_elements.size() >= 2)
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;
++loaded_chars;
- w_lobby->set_loading_text("Loading chars:\n" + QString::number(loaded_chars) + "/" + QString::number(char_list_size));
+ w_lobby->set_loading_text("Loading chars:\n" +
+ QString::number(loaded_chars) + "/" +
+ QString::number(char_list_size));
w_courtroom->append_char(f_char);
- int total_loading_size = 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);
+ int total_loading_size =
+ 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);
}
send_server_packet(new AOPacket("RM#%"));
}
- else if (header == "SM")
- {
+ else if (header == "SM") {
if (!courtroom_constructed)
goto end;
bool musics_time = false;
int areas = 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) {
++loaded_music;
- w_lobby->set_loading_text("Loading music:\n" + QString::number(loaded_music) + "/" + QString::number(music_list_size));
+ w_lobby->set_loading_text("Loading music:\n" +
+ QString::number(loaded_music) + "/" +
+ QString::number(music_list_size));
- if (musics_time)
- {
- w_courtroom->append_music(f_contents.at(n_element));
+ if (musics_time) {
+ w_courtroom->append_music(f_contents.at(n_element));
}
- else
- {
- if (f_contents.at(n_element).endsWith(".wav") ||
- f_contents.at(n_element).endsWith(".mp3") ||
- f_contents.at(n_element).endsWith(".mp4") ||
- f_contents.at(n_element).endsWith(".ogg") ||
- f_contents.at(n_element).endsWith(".opus"))
- {
- musics_time = true;
- w_courtroom->fix_last_area();
- w_courtroom->append_music(f_contents.at(n_element));
- areas--;
- }
- else
- {
- w_courtroom->append_area(f_contents.at(n_element));
- areas++;
- }
+ else {
+ if (f_contents.at(n_element).endsWith(".wav") ||
+ f_contents.at(n_element).endsWith(".mp3") ||
+ f_contents.at(n_element).endsWith(".mp4") ||
+ f_contents.at(n_element).endsWith(".ogg") ||
+ f_contents.at(n_element).endsWith(".opus")) {
+ musics_time = true;
+ w_courtroom->fix_last_area();
+ w_courtroom->append_music(f_contents.at(n_element));
+ areas--;
+ }
+ else {
+ w_courtroom->append_area(f_contents.at(n_element));
+ areas++;
+ }
}
- for (int area_n = 0; area_n < areas; area_n++)
- {
- w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
+ for (int area_n = 0; area_n < areas; area_n++) {
+ w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown");
}
- int total_loading_size = 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);
+ int total_loading_size =
+ 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);
}
send_server_packet(new AOPacket("RD#%"));
}
- else if (header == "DONE")
- {
+ else if (header == "DONE") {
if (!courtroom_constructed)
goto end;
@@ -539,59 +525,50 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
destruct_lobby();
}
- else if (header == "BN")
- {
+ else if (header == "BN") {
if (f_contents.size() < 1)
goto end;
if (courtroom_constructed)
w_courtroom->set_background(f_contents.at(0));
}
- //server accepting char request(CC) packet
- else if (header == "PV")
- {
+ // server accepting char request(CC) packet
+ else if (header == "PV") {
if (f_contents.size() < 3)
goto end;
if (courtroom_constructed)
w_courtroom->enter_courtroom(f_contents.at(2).toInt());
}
- else if (header == "MS")
- {
+ else if (header == "MS") {
if (courtroom_constructed && courtroom_loaded)
w_courtroom->handle_chatmessage(&p_packet->get_contents());
}
- else if (header == "MC")
- {
+ else if (header == "MC") {
if (courtroom_constructed && courtroom_loaded)
w_courtroom->handle_song(&p_packet->get_contents());
}
- else if (header == "RT")
- {
+ else if (header == "RT") {
if (f_contents.size() < 1)
goto end;
- if (courtroom_constructed)
- {
+ if (courtroom_constructed) {
if (f_contents.size() == 1)
- w_courtroom->handle_wtce(f_contents.at(0), 0);
+ 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());
+ w_courtroom->handle_wtce(f_contents.at(0), f_contents.at(1).toInt());
}
}
}
- else if (header == "HP")
- {
+ 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());
+ w_courtroom->set_hp_bar(f_contents.at(0).toInt(),
+ f_contents.at(1).toInt());
}
- else if (header == "LE")
- {
- if (courtroom_constructed)
- {
+ else if (header == "LE") {
+ if (courtroom_constructed) {
QVector<evi_type> f_evi_list;
- for (QString f_string : f_contents)
- {
+ for (QString f_string : f_contents) {
QStringList sub_contents = f_string.split("&");
if (sub_contents.size() < 3)
@@ -608,67 +585,59 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
w_courtroom->set_evidence_list(f_evi_list);
}
}
- else if (header == "ARUP")
- {
- if (courtroom_constructed)
- {
- int arup_type = f_contents.at(0).toInt();
- for (int n_element = 1 ; n_element < f_contents.size() ; n_element++)
- {
- w_courtroom->arup_modify(arup_type, n_element - 1, f_contents.at(n_element));
- }
+ else if (header == "ARUP") {
+ if (courtroom_constructed) {
+ int arup_type = f_contents.at(0).toInt();
+ for (int n_element = 1; n_element < f_contents.size(); n_element++) {
+ w_courtroom->arup_modify(arup_type, n_element - 1,
+ f_contents.at(n_element));
}
+ }
}
- else if (header == "IL")
- {
+ else if (header == "IL") {
if (courtroom_constructed && f_contents.size() > 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)
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)
w_courtroom->set_mute(false, f_contents.at(0).toInt());
}
- else if (header == "KK")
- {
- if (courtroom_constructed && f_contents.size() >= 1)
- {
- call_notice("You have been kicked from the server.\nReason: " + f_contents.at(0));
+ else if (header == "KK") {
+ if (courtroom_constructed && f_contents.size() >= 1) {
+ call_notice("You have been kicked from the server.\nReason: " +
+ f_contents.at(0));
construct_lobby();
destruct_courtroom();
}
}
- else if (header == "KB")
- {
- if (courtroom_constructed && f_contents.size() >= 1)
- {
- call_notice("You have been banned from the server.\nReason: " + f_contents.at(0));
+ else if (header == "KB") {
+ if (courtroom_constructed && f_contents.size() >= 1) {
+ call_notice("You have been banned from the server.\nReason: " +
+ f_contents.at(0));
construct_lobby();
destruct_courtroom();
}
-
}
- else if (header == "BD")
- {
+ else if (header == "BD") {
call_notice("You are banned on this server.\nReason: " + f_contents.at(0));
}
- else if (header == "ZZ")
- {
+ else if (header == "ZZ") {
if (courtroom_constructed && f_contents.size() > 0)
w_courtroom->mod_called(f_contents.at(0));
}
- else if (header == "CASEA")
- {
+ else if (header == "CASEA") {
if (courtroom_constructed && f_contents.size() > 6)
- 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");
+ 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");
}
- end:
+end:
delete p_packet;
}
@@ -695,8 +664,7 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded)
QString f_packet = p_packet->to_string();
- if (encryption_needed)
- {
+ if (encryption_needed) {
#ifdef DEBUG_NETWORK
qDebug() << "S(e):" << f_packet;
#endif
@@ -704,8 +672,7 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded)
p_packet->encrypt_header(s_decryptor);
f_packet = p_packet->to_string();
}
- else
- {
+ else {
#ifdef DEBUG_NETWORK
qDebug() << "S:" << f_packet;
#endif
diff --git a/src/path_functions.cpp b/src/path_functions.cpp
index c51cfde3..811ca76f 100644
--- a/src/path_functions.cpp
+++ b/src/path_functions.cpp
@@ -3,18 +3,18 @@
#include "file_functions.h"
#include <QDir>
-#include <QStandardPaths>
#include <QRegExp>
+#include <QStandardPaths>
#ifdef BASE_OVERRIDE
#include "base_override.h"
#endif
-//this is a quite broad generalization
-//the most common OSes(mac and windows) are _usually_ case insensitive
-//however, there do exist mac installations with case sensitive filesystems
-//in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac
-#if (defined (LINUX) || defined (__linux__))
+// this is a quite broad generalization
+// the most common OSes(mac and windows) are _usually_ case insensitive
+// however, there do exist mac installations with case sensitive filesystems
+// in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac
+#if (defined(LINUX) || defined(__linux__))
#define CASE_SENSITIVE_FILESYSTEM
#endif
@@ -23,7 +23,7 @@ QString AOApplication::get_base_path()
QString base_path = "";
#ifdef ANDROID
QString sdcard_storage = getenv("SECONDARY_STORAGE");
- if (dir_exists(sdcard_storage + "/AO2/")){
+ if (dir_exists(sdcard_storage + "/AO2/")) {
base_path = sdcard_storage + "/AO2/";
}
else {
@@ -37,10 +37,7 @@ QString AOApplication::get_base_path()
return base_path;
}
-QString AOApplication::get_data_path()
-{
- return get_base_path() + "data/";
-}
+QString AOApplication::get_data_path() { return get_base_path() + "data/"; }
QString AOApplication::get_default_theme_path(QString p_file)
{
@@ -104,7 +101,8 @@ QString AOApplication::get_music_path(QString p_song)
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) {
#ifndef CASE_SENSITIVE_FILESYSTEM
return path;
@@ -135,21 +133,25 @@ QString AOApplication::get_evidence_path(QString p_file)
#endif
}
-QString AOApplication::get_case_sensitive_path(QString p_file) {
- //first, check to see if it's actually there (also serves as base case for recursion)
- if (exists(p_file)) return p_file;
+QString AOApplication::get_case_sensitive_path(QString p_file)
+{
+ // first, check to see if it's actually there (also serves as base case for
+ // recursion)
+ if (exists(p_file))
+ return p_file;
QFileInfo file(p_file);
QString file_basename = file.fileName();
QString file_parent_dir = get_case_sensitive_path(file.absolutePath());
- //second, does it exist in the new parent dir?
+ // second, does it exist in the new parent dir?
if (exists(file_parent_dir + "/" + file_basename))
return file_parent_dir + "/" + file_basename;
- //last resort, dirlist parent dir and find case insensitive match
- QRegExp file_rx = QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString);
+ // last resort, dirlist parent dir and find case insensitive match
+ QRegExp file_rx =
+ QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString);
QStringList files = QDir(file_parent_dir).entryList();
int result = files.indexOf(file_rx);
@@ -157,6 +159,6 @@ QString AOApplication::get_case_sensitive_path(QString p_file) {
if (result != -1)
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;
}
diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp
index 5a34ac8b..18f0e4cf 100644
--- a/src/text_file_functions.cpp
+++ b/src/text_file_functions.cpp
@@ -48,13 +48,15 @@ int AOApplication::get_max_log_size()
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");
}
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");
}
@@ -62,14 +64,15 @@ QString AOApplication::get_default_username()
{
QString result = configini->value("default_username", "").value<QString>();
if (result.isEmpty())
- return get_ooc_name();
+ return get_ooc_name();
else
- return result;
+ return result;
}
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;
}
@@ -86,8 +89,7 @@ QStringList AOApplication::get_call_words()
QTextStream in(&callwords_ini);
- while (!in.atEnd())
- {
+ while (!in.atEnd()) {
QString line = in.readLine();
return_value.append(line);
}
@@ -102,8 +104,7 @@ void AOApplication::write_to_serverlist_txt(QString p_line)
serverlist_txt.setFileName(serverlist_txt_path);
- if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append))
- {
+ if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) {
return;
}
@@ -123,21 +124,19 @@ QVector<server_type> AOApplication::read_serverlist_txt()
serverlist_txt.setFileName(serverlist_txt_path);
- if (!serverlist_txt.open(QIODevice::ReadOnly))
- {
+ if (!serverlist_txt.open(QIODevice::ReadOnly)) {
return f_server_list;
}
QTextStream in(&serverlist_txt);
- while(!in.atEnd())
- {
+ while (!in.atEnd()) {
QString line = in.readLine();
server_type f_server;
QStringList line_contents = line.split(":");
if (line_contents.size() < 3)
- continue;
+ continue;
f_server.ip = line_contents.at(0);
f_server.port = line_contents.at(1).toInt();
@@ -150,13 +149,15 @@ QVector<server_type> AOApplication::read_serverlist_txt()
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);
QVariant value = settings.value(p_identifier);
if (value.type() == QVariant::StringList) {
return value.toStringList().join(",");
- } else {
+ }
+ else {
return value.toString();
}
}
@@ -172,8 +173,7 @@ QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file)
return_value.setX(0);
return_value.setY(0);
- if (f_result == "")
- {
+ if (f_result == "") {
f_result = read_design_ini(p_identifier, default_path);
if (f_result == "")
@@ -191,7 +191,8 @@ QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file)
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 default_path = get_default_theme_path(p_file);
@@ -204,8 +205,7 @@ pos_size_type AOApplication::get_element_dimensions(QString p_identifier, QStrin
return_value.width = -1;
return_value.height = -1;
- if (f_result == "")
- {
+ if (f_result == "") {
f_result = read_design_ini(p_identifier, default_path);
if (f_result == "")
@@ -229,8 +229,7 @@ QString AOApplication::get_font_name(QString p_identifier, QString p_file)
QString design_ini_path = get_theme_path(p_file);
QString f_result = read_design_ini(p_identifier, design_ini_path);
QString default_path = get_default_theme_path(p_file);
- if (f_result == "")
- {
+ if (f_result == "") {
f_result = read_design_ini(p_identifier, default_path);
if (f_result == "")
return "Sans";
@@ -243,8 +242,7 @@ int AOApplication::get_font_size(QString p_identifier, QString p_file)
QString default_path = get_default_theme_path(p_file);
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);
if (f_result == "")
@@ -262,8 +260,7 @@ QColor AOApplication::get_color(QString p_identifier, QString p_file)
QColor return_color(0, 0, 0);
- if (f_result == "")
- {
+ if (f_result == "") {
f_result = read_design_ini(p_identifier, default_path);
if (f_result == "")
@@ -286,39 +283,37 @@ QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat)
{
QColor return_color(255, 255, 255);
- if (p_identifier == "_inline_grey")
- {
+ if (p_identifier == "_inline_grey") {
return_color = QColor(187, 187, 187);
}
- else
- {
+ else {
switch (p_identifier.toInt()) {
- case 1:
- return_color = QColor(0, 255, 0);
- break;
- case 2:
- return_color = QColor(255, 0, 0);
- break;
- case 3:
- return_color = QColor(255, 165, 0);
- break;
- case 4:
- return_color = QColor(45, 150, 255);
- break;
- case 5:
- return_color = QColor(255, 255, 0);
- break;
- case 7:
- return_color = QColor(255, 192, 203);
- break;
- case 8:
- return_color = QColor(0, 255, 255);
- break;
- case 0:
- case 6: // 6 is rainbow.
- default:
- return_color = QColor(255, 255, 255);
- break;
+ case 1:
+ return_color = QColor(0, 255, 0);
+ break;
+ case 2:
+ return_color = QColor(255, 0, 0);
+ break;
+ case 3:
+ return_color = QColor(255, 165, 0);
+ break;
+ case 4:
+ return_color = QColor(45, 150, 255);
+ break;
+ case 5:
+ return_color = QColor(255, 255, 0);
+ break;
+ case 7:
+ return_color = QColor(255, 192, 203);
+ break;
+ case 8:
+ return_color = QColor(0, 255, 255);
+ break;
+ case 0:
+ case 6: // 6 is rainbow.
+ default:
+ return_color = QColor(255, 255, 255);
+ break;
}
}
@@ -327,8 +322,7 @@ QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat)
QString default_path = get_base_path() + "misc/default/config.ini";
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);
if (f_result == "")
@@ -355,8 +349,7 @@ QString AOApplication::get_sfx(QString p_identifier)
QString return_sfx = "";
- if (f_result == "")
- {
+ if (f_result == "") {
f_result = read_design_ini(p_identifier, default_path);
if (f_result == "")
@@ -370,35 +363,34 @@ QString AOApplication::get_sfx(QString p_identifier)
QString AOApplication::get_sfx_suffix(QString sound_to_check)
{
- QString mp3_check = get_sounds_path(sound_to_check + ".mp3");
- QString opus_check = get_sounds_path(sound_to_check + ".opus");
- if (file_exists(opus_check))
- {
- return sound_to_check + ".opus";
- }
- else if (file_exists(mp3_check))
- {
- return sound_to_check + ".mp3";
- }
- return sound_to_check + ".wav";
+ QString mp3_check = get_sounds_path(sound_to_check + ".mp3");
+ QString opus_check = get_sounds_path(sound_to_check + ".opus");
+ if (file_exists(opus_check)) {
+ return sound_to_check + ".opus";
+ }
+ else if (file_exists(mp3_check)) {
+ return sound_to_check + ".mp3";
+ }
+ return sound_to_check + ".wav";
}
QString AOApplication::get_image_suffix(QString path_to_check)
{
- QString apng_check = path_to_check + ".apng";
- if (file_exists(apng_check))
- {
- return apng_check;
- }
- return path_to_check + ".gif";
+ QString apng_check = path_to_check + ".apng";
+ if (file_exists(apng_check)) {
+ return apng_check;
+ }
+ return path_to_check + ".gif";
}
-
-//returns whatever is to the right of "search_line =" within target_tag and terminator_tag, trimmed
-//returns the empty string if the search line couldnt be found
-QString AOApplication::read_char_ini(QString p_char, QString p_search_line, QString target_tag)
+// returns whatever is to the right of "search_line =" within target_tag and
+// terminator_tag, trimmed returns the empty string if the search line couldnt
+// be found
+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);
QString value = settings.value(p_search_line).toString();
settings.endGroup();
@@ -411,7 +403,8 @@ QString AOApplication::get_char_name(QString p_char)
if (f_result == "")
return p_char;
- else return f_result;
+ else
+ return f_result;
}
QString AOApplication::get_showname(QString p_char)
@@ -423,7 +416,8 @@ QString AOApplication::get_showname(QString p_char)
return "";
if (f_result == "")
return p_char;
- else return f_result;
+ else
+ return f_result;
}
QString AOApplication::get_char_side(QString p_char)
@@ -432,7 +426,8 @@ QString AOApplication::get_char_side(QString p_char)
if (f_result == "")
return "wit";
- else return f_result;
+ else
+ return f_result;
}
QString AOApplication::get_gender(QString p_char)
@@ -441,14 +436,16 @@ QString AOApplication::get_gender(QString p_char)
if (f_result == "")
return "male";
- else return f_result;
+ else
+ return f_result;
}
QString AOApplication::get_chat(QString p_char)
{
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;
}
@@ -457,7 +454,8 @@ QString AOApplication::get_char_shouts(QString p_char)
QString f_result = read_char_ini(p_char, "shouts", "Options");
if (f_result == "")
return "default";
- else return f_result;
+ else
+ return f_result;
}
int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
@@ -466,7 +464,8 @@ int AOApplication::get_preanim_duration(QString p_char, QString p_emote)
if (f_result == "")
return -1;
- else return f_result.toInt();
+ else
+ return f_result.toInt();
}
int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote)
@@ -475,7 +474,8 @@ int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote)
if (f_result == "")
return -1;
- else return f_result.toInt();
+ else
+ return f_result.toInt();
}
int AOApplication::get_emote_number(QString p_char)
@@ -484,68 +484,75 @@ int AOApplication::get_emote_number(QString p_char)
if (f_result == "")
return 0;
- else return f_result.toInt();
+ else
+ return f_result.toInt();
}
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("#");
- if (result_contents.size() < 4)
- {
+ if (result_contents.size() < 4) {
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
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 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("#");
- if (result_contents.size() < 4)
- {
+ if (result_contents.size() < 4) {
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
return "";
}
- else return result_contents.at(1);
+ else
+ return result_contents.at(1);
}
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("#");
- if (result_contents.size() < 4)
- {
+ if (result_contents.size() < 4) {
qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote;
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)
{
- 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("#");
- if (result_contents.size() < 4)
- {
- qDebug() << "W: misformatted char.ini: " << p_char << ", " << QString::number(p_emote);
+ if (result_contents.size() < 4) {
+ qDebug() << "W: misformatted char.ini: " << p_char << ", "
+ << QString::number(p_emote);
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)
{
- 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("#");
@@ -556,25 +563,30 @@ int AOApplication::get_desk_mod(QString p_char, int p_emote)
if (string_result == "")
return -1;
- else return string_result.toInt();
+ else
+ return string_result.toInt();
}
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 == "")
return "1";
- else return f_result;
+ else
+ return f_result;
}
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 == "")
return 1;
- else return f_result.toInt();
+ else
+ return f_result.toInt();
}
int AOApplication::get_text_delay(QString p_char, QString p_emote)
@@ -583,7 +595,8 @@ int AOApplication::get_text_delay(QString p_char, QString p_emote)
if (f_result == "")
return -1;
- else return f_result.toInt();
+ else
+ return f_result.toInt();
}
QString AOApplication::get_custom_realization(QString p_char)
@@ -592,65 +605,74 @@ QString AOApplication::get_custom_realization(QString p_char)
if (f_result == "")
return get_sfx("realization");
- else return f_result;
+ else
+ return f_result;
}
bool AOApplication::get_blank_blip()
{
- QString result = configini->value("blank_blip", "false").value<QString>();
- return result.startsWith("true");
+ QString result = configini->value("blank_blip", "false").value<QString>();
+ return result.startsWith("true");
}
bool AOApplication::is_discord_enabled()
{
- QString result = configini->value("discord", "true").value<QString>();
- return result.startsWith("true");
+ QString result = configini->value("discord", "true").value<QString>();
+ return result.startsWith("true");
}
bool AOApplication::get_casing_enabled()
{
- QString result = configini->value("casing_enabled", "false").value<QString>();
- return result.startsWith("true");
+ QString result = configini->value("casing_enabled", "false").value<QString>();
+ return result.startsWith("true");
}
bool AOApplication::get_casing_defence_enabled()
{
- QString result = configini->value("casing_defence_enabled", "false").value<QString>();
- return result.startsWith("true");
+ QString result =
+ configini->value("casing_defence_enabled", "false").value<QString>();
+ return result.startsWith("true");
}
bool AOApplication::get_casing_prosecution_enabled()
{
- QString result = configini->value("casing_prosecution_enabled", "false").value<QString>();
- return result.startsWith("true");
+ QString result =
+ configini->value("casing_prosecution_enabled", "false").value<QString>();
+ return result.startsWith("true");
}
bool AOApplication::get_casing_judge_enabled()
{
- QString result = configini->value("casing_judge_enabled", "false").value<QString>();
- return result.startsWith("true");
+ QString result =
+ configini->value("casing_judge_enabled", "false").value<QString>();
+ return result.startsWith("true");
}
bool AOApplication::get_casing_juror_enabled()
{
- QString result = configini->value("casing_juror_enabled", "false").value<QString>();
- return result.startsWith("true");
+ QString result =
+ configini->value("casing_juror_enabled", "false").value<QString>();
+ return result.startsWith("true");
}
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");
}
bool AOApplication::get_casing_cm_enabled()
{
- QString result = configini->value("casing_cm_enabled", "false").value<QString>();
- return result.startsWith("true");
+ QString result =
+ configini->value("casing_cm_enabled", "false").value<QString>();
+ return result.startsWith("true");
}
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;
}