Run clang-format on entire project
Indentation fixed to 2 spaces per tab. Braces set to Stroustrup style. Lines reflow at 80 characters. One-line method bodies are on the same line as the signature. Space always after `//`. No indentation on preprocessor macros. Includes are sorted lexicographically. If you don't want to see this commit on blames, use the hidden whitespace option on GitHub, or use `-w` in git-blame.
This commit is contained in:
parent
faac191f0b
commit
13942345c6
@ -16,6 +16,7 @@ HEADERS += $$files($$PWD/include/*.h)
|
||||
|
||||
LIBS += -L$$PWD/lib
|
||||
|
||||
|
||||
#DEFINES += DISCORD
|
||||
|
||||
contains(DEFINES, DISCORD) {
|
||||
|
@ -6,38 +6,36 @@
|
||||
#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>
|
||||
#ifdef QTAUDIO
|
||||
#include <QAudioDeviceInfo>
|
||||
#endif
|
||||
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QFuture>
|
||||
#include <QThread>
|
||||
#include <QThreadPool>
|
||||
#include <QFuture>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
|
||||
class NetworkManager;
|
||||
class Lobby;
|
||||
class Courtroom;
|
||||
|
||||
class AOApplication : public QApplication
|
||||
{
|
||||
class AOApplication : public QApplication {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -102,7 +100,6 @@ public:
|
||||
int music_list_size = 0;
|
||||
int loaded_music = 0;
|
||||
int area_count = 0;
|
||||
|
||||
bool courtroom_loaded = false;
|
||||
|
||||
//////////////////versioning///////////////
|
||||
@ -147,7 +144,8 @@ 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
|
||||
@ -252,7 +250,8 @@ public:
|
||||
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);
|
||||
QString read_char_ini(QString p_char, QString p_search_line,
|
||||
QString target_tag);
|
||||
|
||||
// Returns the side of the p_char character from that characters ini file
|
||||
QString get_char_side(QString p_char);
|
||||
@ -269,7 +268,8 @@ public:
|
||||
// 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
|
||||
@ -287,15 +287,6 @@ public:
|
||||
// Returns the emote comment of p_char's p_emote
|
||||
QString get_emote_comment(QString p_char, int p_emote);
|
||||
|
||||
//Returns the base name of p_char's p_emote
|
||||
QString get_emote(QString p_char, int p_emote);
|
||||
|
||||
//Returns the preanimation name of p_char's p_emote
|
||||
QString get_pre_emote(QString p_char, int p_emote);
|
||||
|
||||
//Returns the sfx of p_char's p_emote
|
||||
QString get_sfx_name(QString p_char, int p_emote);
|
||||
|
||||
// Returns if an emote loops it's SFX
|
||||
QString get_sfx_looping(QString p_char, int p_emote);
|
||||
|
||||
@ -308,6 +299,15 @@ public:
|
||||
// Returns if an emote has a frame specific SFX for it
|
||||
QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame);
|
||||
|
||||
// Returns the base name of p_char's p_emote
|
||||
QString get_emote(QString p_char, int p_emote);
|
||||
|
||||
// Returns the preanimation name of p_char's p_emote
|
||||
QString get_pre_emote(QString p_char, int p_emote);
|
||||
|
||||
// Returns the sfx of p_char's p_emote
|
||||
QString get_sfx_name(QString p_char, int p_emote);
|
||||
|
||||
// Not in use
|
||||
int get_sfx_delay(QString p_char, int p_emote);
|
||||
|
||||
@ -336,6 +336,9 @@ public:
|
||||
// Same for judge.
|
||||
bool get_casing_judge_enabled();
|
||||
|
||||
// Same for witnesses.
|
||||
bool get_casing_wit_enabled();
|
||||
|
||||
// Same for juror.
|
||||
bool get_casing_juror_enabled();
|
||||
|
||||
@ -345,9 +348,6 @@ public:
|
||||
// Same for CM.
|
||||
bool get_casing_cm_enabled();
|
||||
|
||||
// Same for witnesses.
|
||||
bool get_casing_wit_enabled();
|
||||
|
||||
// Get the message for the CM for casing alerts.
|
||||
QString get_casing_can_host_cases();
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -3,11 +3,10 @@
|
||||
|
||||
#include "aoapplication.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QDebug>
|
||||
#include <QPushButton>
|
||||
|
||||
class AOButton : public QPushButton
|
||||
{
|
||||
class AOButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -4,20 +4,21 @@
|
||||
#include "aoapplication.h"
|
||||
#include "courtroom.h"
|
||||
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
#include <QtWidgets/QCheckBox>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <QtWidgets/QFormLayout>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
|
||||
class AOCaseAnnouncerDialog : public QDialog
|
||||
{
|
||||
class AOCaseAnnouncerDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AOCaseAnnouncerDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr, Courtroom *p_court = nullptr);
|
||||
explicit AOCaseAnnouncerDialog(QWidget *parent = nullptr,
|
||||
AOApplication *p_ao_app = nullptr,
|
||||
Courtroom *p_court = nullptr);
|
||||
|
||||
private:
|
||||
AOApplication *ao_app;
|
||||
|
@ -4,17 +4,17 @@
|
||||
#include "aoapplication.h"
|
||||
#include "aoimage.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
#include <QFile>
|
||||
|
||||
class AOCharButton : public QPushButton
|
||||
{
|
||||
class AOCharButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken);
|
||||
AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos,
|
||||
bool is_taken);
|
||||
|
||||
AOApplication *ao_app;
|
||||
|
||||
|
@ -1,19 +1,17 @@
|
||||
#ifndef AOCHARMOVIE_H
|
||||
#define AOCHARMOVIE_H
|
||||
|
||||
#include <QMovie>
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
#include <QImageReader>
|
||||
#include <QPainter>
|
||||
#include "include/aosfxplayer.h"
|
||||
#include "include/courtroom.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QImageReader>
|
||||
#include <QLabel>
|
||||
#include <QMovie>
|
||||
#include <QPainter>
|
||||
#include <QTimer>
|
||||
|
||||
class AOApplication;
|
||||
class AOCharMovie : public QLabel
|
||||
{
|
||||
class AOCharMovie : public QLabel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -28,8 +26,6 @@ public:
|
||||
void LoadImageWithStupidMethodForFlipSupport(QImage image);
|
||||
void stop();
|
||||
|
||||
void move(int ax, int ay);
|
||||
void combo_resize(int w, int h);
|
||||
void play_frame_sfx();
|
||||
|
||||
void sfx_two_network_boogaloo();
|
||||
@ -42,6 +38,10 @@ public:
|
||||
QString frame_screenshake_hellstring = "";
|
||||
QString frame_realization_hellstring = "";
|
||||
bool use_networked_framehell = false;
|
||||
|
||||
void move(int ax, int ay);
|
||||
void combo_resize(int w, int h);
|
||||
|
||||
private:
|
||||
AOApplication *ao_app;
|
||||
|
||||
@ -52,14 +52,15 @@ private:
|
||||
QString last_path;
|
||||
QString current_emote;
|
||||
QString current_char;
|
||||
int default_w;
|
||||
int default_h;
|
||||
|
||||
const int time_mod = 62;
|
||||
|
||||
// These are the X and Y values before they are fixed based on the sprite's width.
|
||||
// These are the X and Y values before they are fixed based on the sprite's
|
||||
// width.
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int default_w;
|
||||
int default_h;
|
||||
|
||||
bool m_flipped = false;
|
||||
|
||||
|
@ -3,11 +3,10 @@
|
||||
|
||||
#include "aoapplication.h"
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QDebug>
|
||||
#include <QPushButton>
|
||||
|
||||
class AOEmoteButton : public QPushButton
|
||||
{
|
||||
class AOEmoteButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -4,16 +4,16 @@
|
||||
#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);
|
||||
|
@ -4,12 +4,11 @@
|
||||
#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:
|
||||
|
@ -5,11 +5,10 @@
|
||||
|
||||
#include "aoapplication.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
#include <QLabel>
|
||||
|
||||
class AOImage : public QLabel
|
||||
{
|
||||
class AOImage : public QLabel {
|
||||
public:
|
||||
AOImage(QWidget *parent, AOApplication *p_ao_app);
|
||||
~AOImage();
|
||||
|
@ -4,8 +4,7 @@
|
||||
#include <QLineEdit>
|
||||
#include <QMouseEvent>
|
||||
|
||||
class AOLineEdit : public QLineEdit
|
||||
{
|
||||
class AOLineEdit : public QLineEdit {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
@ -19,8 +18,6 @@ signals:
|
||||
|
||||
private slots:
|
||||
void on_enter_pressed();
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // AOLINEEDIT_H
|
||||
|
@ -7,8 +7,7 @@
|
||||
class Courtroom;
|
||||
class AOApplication;
|
||||
|
||||
class AOMovie : public QLabel
|
||||
{
|
||||
class AOMovie : public QLabel {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -9,15 +9,14 @@
|
||||
|
||||
#include "aoapplication.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <string.h>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <QObject>
|
||||
|
||||
#if defined(BASSAUDIO)
|
||||
class AOMusicPlayer : public QObject
|
||||
{
|
||||
class AOMusicPlayer : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||
@ -38,11 +37,9 @@ private:
|
||||
QString f_path;
|
||||
|
||||
HSTREAM m_stream;
|
||||
|
||||
};
|
||||
#elif defined(QTAUDIO)
|
||||
class AOMusicPlayer : public QObject
|
||||
{
|
||||
class AOMusicPlayer : public QObject {
|
||||
public:
|
||||
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||
~AOMusicPlayer();
|
||||
@ -64,8 +61,7 @@ private:
|
||||
QString f_path;
|
||||
};
|
||||
#else
|
||||
class AOMusicPlayer : public QObject
|
||||
{
|
||||
class AOMusicPlayer : public QObject {
|
||||
public:
|
||||
AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||
~AOMusicPlayer();
|
||||
|
@ -29,11 +29,11 @@
|
||||
#include <QDirIterator>
|
||||
#include <QTextStream>
|
||||
|
||||
class AOOptionsDialog: public QDialog
|
||||
{
|
||||
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;
|
||||
@ -62,9 +62,10 @@ private:
|
||||
QLabel *ui_ms_lbl;
|
||||
QLineEdit *ui_ms_textbox;
|
||||
QLabel *ui_discord_lbl;
|
||||
QCheckBox *ui_discord_cb;
|
||||
QLabel *ui_epilepsy_lbl;
|
||||
QCheckBox *ui_epilepsy_cb;
|
||||
|
||||
QCheckBox *ui_discord_cb;
|
||||
QLabel *ui_language_label;
|
||||
QComboBox *ui_language_combobox;
|
||||
|
||||
@ -90,6 +91,11 @@ private:
|
||||
QSpinBox *ui_music_volume_spinbox;
|
||||
QLabel *ui_music_volume_lbl;
|
||||
QSpinBox *ui_sfx_volume_spinbox;
|
||||
QLabel *ui_loopsfx_lbl;
|
||||
QCheckBox *ui_loopsfx_cb;
|
||||
QLabel *ui_objectmusic_lbl;
|
||||
QCheckBox *ui_objectmusic_cb;
|
||||
|
||||
QSpinBox *ui_blips_volume_spinbox;
|
||||
QLabel *ui_sfx_volume_lbl;
|
||||
QLabel *ui_blips_volume_lbl;
|
||||
@ -98,10 +104,6 @@ private:
|
||||
QLabel *ui_bliprate_lbl;
|
||||
QCheckBox *ui_blank_blips_cb;
|
||||
QLabel *ui_blank_blips_lbl;
|
||||
QLabel *ui_loopsfx_lbl;
|
||||
QCheckBox *ui_loopsfx_cb;
|
||||
QLabel *ui_objectmusic_lbl;
|
||||
QCheckBox *ui_objectmusic_cb;
|
||||
QDialogButtonBox *ui_settings_buttons;
|
||||
|
||||
QWidget *ui_casing_tab;
|
||||
|
@ -1,12 +1,11 @@
|
||||
#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);
|
||||
|
@ -1,15 +1,14 @@
|
||||
#ifndef AOSCENE_H
|
||||
#define AOSCENE_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
#include <QLabel>
|
||||
#include <QMovie>
|
||||
|
||||
class Courtroom;
|
||||
class AOApplication;
|
||||
|
||||
class AOScene : public QLabel
|
||||
{
|
||||
class AOScene : public QLabel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AOScene(QWidget *parent, AOApplication *p_ao_app);
|
||||
|
@ -9,13 +9,12 @@
|
||||
|
||||
#include "aoapplication.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <string.h>
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
#include <QWidget>
|
||||
#include <string.h>
|
||||
|
||||
class AOSfxPlayer : public QObject
|
||||
{
|
||||
class AOSfxPlayer : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app);
|
||||
|
@ -1,14 +1,13 @@
|
||||
#ifndef AOTEXTAREA_H
|
||||
#define AOTEXTAREA_H
|
||||
|
||||
#include <QTextBrowser>
|
||||
#include <QScrollBar>
|
||||
#include <QTextCursor>
|
||||
#include <QRegExp>
|
||||
#include <QDebug>
|
||||
#include <QRegExp>
|
||||
#include <QScrollBar>
|
||||
#include <QTextBrowser>
|
||||
#include <QTextCursor>
|
||||
|
||||
class AOTextArea : public QTextBrowser
|
||||
{
|
||||
class AOTextArea : public QTextBrowser {
|
||||
public:
|
||||
AOTextArea(QWidget *p_parent = nullptr);
|
||||
|
||||
@ -19,7 +18,8 @@ public:
|
||||
private:
|
||||
const QRegExp omnis_dank_url_regex = QRegExp("\\b(https?://\\S+\\.\\S+)\\b");
|
||||
|
||||
void auto_scroll(QTextCursor old_cursor, int scrollbar_value, bool is_scrolled_down);
|
||||
void auto_scroll(QTextCursor old_cursor, int scrollbar_value,
|
||||
bool is_scrolled_down);
|
||||
};
|
||||
|
||||
#endif // AOTEXTAREA_H
|
||||
|
@ -3,8 +3,7 @@
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
|
||||
class AOTextEdit : public QPlainTextEdit
|
||||
{
|
||||
class AOTextEdit : public QPlainTextEdit {
|
||||
Q_OBJECT
|
||||
public:
|
||||
AOTextEdit(QWidget *parent);
|
||||
@ -17,7 +16,6 @@ signals:
|
||||
|
||||
private slots:
|
||||
void on_enter_pressed();
|
||||
|
||||
};
|
||||
|
||||
#endif // AOTEXTEDIT_H
|
||||
|
276
include/bass.h
276
include/bass.h
@ -153,7 +153,8 @@ typedef DWORD HPLUGIN; // Plugin handle
|
||||
#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_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
|
||||
@ -169,7 +170,8 @@ typedef DWORD HPLUGIN; // Plugin handle
|
||||
|
||||
// Device info structure
|
||||
typedef struct {
|
||||
#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
|
||||
#if defined(_WIN32_WCE) || \
|
||||
(WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
|
||||
const wchar_t *name; // description
|
||||
const wchar_t *driver; // driver
|
||||
#else
|
||||
@ -209,19 +211,25 @@ typedef struct {
|
||||
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)
|
||||
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 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_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
|
||||
@ -237,8 +245,11 @@ typedef struct {
|
||||
} 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
|
||||
@ -288,16 +299,24 @@ typedef struct {
|
||||
#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_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_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_IGNOREDELAY \
|
||||
0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info
|
||||
#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN
|
||||
|
||||
#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT
|
||||
@ -319,7 +338,8 @@ typedef struct {
|
||||
#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_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
|
||||
|
||||
@ -394,7 +414,8 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
DWORD ctype; // channel type
|
||||
#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP)
|
||||
#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
|
||||
@ -432,8 +453,7 @@ typedef struct BASS_3DVECTOR {
|
||||
#define BASS_3DALG_LIGHT 3
|
||||
|
||||
// EAX environments, use with BASS_SetEAXParameters
|
||||
enum
|
||||
{
|
||||
enum {
|
||||
EAX_ENVIRONMENT_GENERIC,
|
||||
EAX_ENVIRONMENT_PADDEDCELL,
|
||||
EAX_ENVIRONMENT_ROOM,
|
||||
@ -476,9 +496,11 @@ enum
|
||||
#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_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_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
|
||||
@ -492,14 +514,14 @@ enum
|
||||
#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. */
|
||||
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
|
||||
|
||||
@ -542,7 +564,8 @@ typedef struct {
|
||||
#define BASS_FILEPOS_SIZE 8
|
||||
#define BASS_FILEPOS_BUFFERING 9
|
||||
|
||||
typedef void (CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user);
|
||||
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
|
||||
@ -564,7 +587,8 @@ user : The 'user' parameter value given when calling BASS_StreamCreateURL */
|
||||
#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);
|
||||
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
|
||||
@ -637,7 +663,8 @@ RETURN : TRUE = continue recording, FALSE = stop */
|
||||
#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_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
|
||||
@ -656,28 +683,35 @@ RETURN : TRUE = continue recording, FALSE = stop */
|
||||
#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_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_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_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_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_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_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 {
|
||||
@ -724,14 +758,12 @@ typedef struct {
|
||||
#pragma pack(pop)
|
||||
|
||||
// BWF "cart" tag structures
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
DWORD dwUsage; // FOURCC timer usage ID
|
||||
DWORD dwValue; // timer value in samples from head
|
||||
} TAG_CART_TIMER;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
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
|
||||
@ -761,8 +793,7 @@ typedef struct
|
||||
} TAG_CART;
|
||||
|
||||
// RIFF "cue " tag structures
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
DWORD dwName;
|
||||
DWORD dwPosition;
|
||||
DWORD fccChunk;
|
||||
@ -771,8 +802,7 @@ typedef struct
|
||||
DWORD dwSampleOffset;
|
||||
} TAG_CUE_POINT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
DWORD dwCuePoints;
|
||||
#if defined(__GNUC__) && __GNUC__ < 3
|
||||
TAG_CUE_POINT CuePoints[0];
|
||||
@ -784,8 +814,7 @@ typedef struct
|
||||
} TAG_CUE;
|
||||
|
||||
// RIFF "smpl" tag structures
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
DWORD dwIdentifier;
|
||||
DWORD dwType;
|
||||
DWORD dwStart;
|
||||
@ -794,8 +823,7 @@ typedef struct
|
||||
DWORD dwPlayCount;
|
||||
} TAG_SMPL_LOOP;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
DWORD dwManufacturer;
|
||||
DWORD dwProduct;
|
||||
DWORD dwSamplePeriod;
|
||||
@ -827,8 +855,7 @@ typedef struct {
|
||||
#ifndef _WAVEFORMATEX_
|
||||
#define _WAVEFORMATEX_
|
||||
#pragma pack(push, 1)
|
||||
typedef struct tWAVEFORMATEX
|
||||
{
|
||||
typedef struct tWAVEFORMATEX {
|
||||
WORD wFormatTag;
|
||||
WORD nChannels;
|
||||
DWORD nSamplesPerSec;
|
||||
@ -846,10 +873,13 @@ typedef const WAVEFORMATEX *LPCWAVEFORMATEX;
|
||||
#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_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_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
|
||||
@ -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);
|
||||
@ -1109,24 +1177,34 @@ 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)
|
||||
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);
|
||||
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)
|
||||
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);
|
||||
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)
|
||||
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);
|
||||
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)
|
||||
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);
|
||||
return BASS_StreamCreateURL((const char *)url, offset, flags | BASS_UNICODE,
|
||||
proc, user);
|
||||
}
|
||||
|
||||
static inline BOOL BASS_SetConfigPtr(DWORD option, const WCHAR *value)
|
||||
|
@ -1,11 +1,10 @@
|
||||
#ifndef CHATLOGPIECE_H
|
||||
#define CHATLOGPIECE_H
|
||||
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
#include <QString>
|
||||
|
||||
class chatlogpiece
|
||||
{
|
||||
class chatlogpiece {
|
||||
public:
|
||||
chatlogpiece();
|
||||
chatlogpiece(QString p_name, QString p_showname, QString p_message,
|
||||
|
@ -1,74 +1,73 @@
|
||||
#ifndef COURTROOM_H
|
||||
#define COURTROOM_H
|
||||
|
||||
#include "aoimage.h"
|
||||
#include "aoapplication.h"
|
||||
#include "aoblipplayer.h"
|
||||
#include "aobutton.h"
|
||||
#include "aocharbutton.h"
|
||||
#include "aoemotebutton.h"
|
||||
#include "aopacket.h"
|
||||
#include "aoscene.h"
|
||||
#include "aomovie.h"
|
||||
#include "aocharmovie.h"
|
||||
#include "aoemotebutton.h"
|
||||
#include "aoevidencebutton.h"
|
||||
#include "aoevidencedisplay.h"
|
||||
#include "aoimage.h"
|
||||
#include "aolineedit.h"
|
||||
#include "aomovie.h"
|
||||
#include "aomusicplayer.h"
|
||||
#include "aooptionsdialog.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 "aocharmovie.h"
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QLineEdit>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QListWidget>
|
||||
#include <QCheckBox>
|
||||
#include <QComboBox>
|
||||
#include <QSlider>
|
||||
#include <QVector>
|
||||
#include <QSignalMapper>
|
||||
#include <QCloseEvent>
|
||||
#include <QMap>
|
||||
#include <QTextBrowser>
|
||||
#include <QSpinBox>
|
||||
#include <QMovie>
|
||||
#include <QDebug>
|
||||
#include <QScrollBar>
|
||||
#include <QRegExp>
|
||||
#include "file_functions.h"
|
||||
#include "hardware_functions.h"
|
||||
#include "lobby.h"
|
||||
#include <QBrush>
|
||||
#include <QTextCharFormat>
|
||||
#include <QFont>
|
||||
#include <QInputDialog>
|
||||
#include <QCheckBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QComboBox>
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QWidget>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QTransform>
|
||||
#include <QFont>
|
||||
#include <QFuture>
|
||||
#include <QHeaderView>
|
||||
#include <QInputDialog>
|
||||
#include <QLayout>
|
||||
#include <QLineEdit>
|
||||
#include <QListWidget>
|
||||
#include <QMainWindow>
|
||||
#include <QMap>
|
||||
#include <QMenu>
|
||||
#include <QMetaObject>
|
||||
#include <QMovie>
|
||||
#include <QParallelAnimationGroup>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
#include <QPlainTextEdit>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QRegExp>
|
||||
#include <QScrollBar>
|
||||
#include <QSignalMapper>
|
||||
#include <QSlider>
|
||||
#include <QSpinBox>
|
||||
#include <QTextBoundaryFinder>
|
||||
#include <QTextBrowser>
|
||||
#include <QTextCharFormat>
|
||||
#include <QThread>
|
||||
#include <QThreadPool>
|
||||
#include <QFuture>
|
||||
#include <QMetaObject>
|
||||
#include <QLayout>
|
||||
#include <QTextBoundaryFinder>
|
||||
#include <QTransform>
|
||||
#include <QTreeWidget>
|
||||
#include <QVector>
|
||||
#include <QWidget>
|
||||
#include <QtConcurrent/QtConcurrent>
|
||||
#include <QtConcurrent/QtConcurrentRun>
|
||||
|
||||
#include <stack>
|
||||
|
||||
class AOApplication;
|
||||
class AOCharMovie;
|
||||
class Courtroom : public QMainWindow
|
||||
{
|
||||
class Courtroom : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Courtroom(AOApplication *p_ao_app);
|
||||
@ -102,10 +101,7 @@ public:
|
||||
QCheckBox *ui_char_taken;
|
||||
void mt_pre_framegetter(int frameNumber);
|
||||
void mt_framegetter(int frameNumber);
|
||||
void reset_music_list()
|
||||
{
|
||||
music_list.clear();
|
||||
}
|
||||
void reset_music_list() { music_list.clear(); }
|
||||
|
||||
void arup_append(int players, QString status, QString cm, QString locked)
|
||||
{
|
||||
@ -117,23 +113,19 @@ public:
|
||||
|
||||
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;
|
||||
}
|
||||
@ -150,14 +142,16 @@ public:
|
||||
void set_fonts();
|
||||
|
||||
void set_window_title(QString p_title);
|
||||
QPoint get_theme_pos(QString p_identifier);
|
||||
|
||||
// reads theme inis and sets size and pos based on the identifier
|
||||
void set_size_and_pos(QWidget *p_widget, QString p_identifier);
|
||||
QPoint get_theme_pos(QString p_identifier);
|
||||
//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
|
||||
@ -181,8 +175,8 @@ public:
|
||||
// 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
|
||||
@ -197,21 +191,24 @@ public:
|
||||
QString get_current_char() { return current_char; }
|
||||
QString get_current_background() { return current_background; }
|
||||
|
||||
//properly sets up some varibles: resets user state
|
||||
void enter_courtroom(int p_cid);
|
||||
|
||||
// set the character using an ID
|
||||
void set_character(int char_id);
|
||||
|
||||
//helper function that populates ui_music_list with the contents of music_list
|
||||
// properly sets up some varibles: resets user state
|
||||
void enter_courtroom(int p_cid);
|
||||
|
||||
// helper function that populates ui_music_list with the contents of
|
||||
// music_list
|
||||
void list_music();
|
||||
void list_areas();
|
||||
|
||||
// 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);
|
||||
|
||||
//check whether or not current theme has images for buttons with fallback text
|
||||
// check whether or not current theme has images for buttons with fallback
|
||||
// text
|
||||
void detect_fallback_text();
|
||||
|
||||
// these functions handle chatmessages sequentially.
|
||||
@ -221,12 +218,13 @@ public:
|
||||
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, bool skip_filter, int chat_color);
|
||||
|
||||
// adds text to the IC chatlog. p_name first as bold then p_text then a newlin
|
||||
//this function keeps the chatlog scrolled to the top unless there's text selected
|
||||
// this function keeps the chatlog scrolled to the top unless there's text
|
||||
// selected
|
||||
// or the user isn't already scrolled to the top
|
||||
void append_ic_text(QString p_text, QString p_name = "",
|
||||
bool is_songchange = false, bool force_filter = false,
|
||||
@ -239,7 +237,8 @@ public:
|
||||
|
||||
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)
|
||||
@ -248,18 +247,19 @@ public:
|
||||
|
||||
// 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, bool wit);
|
||||
|
||||
void check_connection_received();
|
||||
void doScreenShake();
|
||||
void doRealization();
|
||||
|
||||
void announce_case(QString title, bool def, bool pro, bool jud, bool jur,
|
||||
bool steno, bool wit);
|
||||
|
||||
void check_connection_received();
|
||||
|
||||
void refresh_iclog(bool skiplast);
|
||||
|
||||
~Courtroom();
|
||||
|
||||
private:
|
||||
|
||||
int m_courtroom_width = 714;
|
||||
int m_courtroom_height = 668;
|
||||
|
||||
@ -277,12 +277,7 @@ private:
|
||||
QMovie *frame_emote_checker;
|
||||
// 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;
|
||||
@ -349,7 +344,8 @@ private:
|
||||
// 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;
|
||||
|
||||
// every time point in char.inis times this equals the final time
|
||||
@ -380,10 +376,12 @@ private:
|
||||
|
||||
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;
|
||||
|
||||
// characters we consider punctuation
|
||||
@ -430,7 +428,8 @@ 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 or not to use text for buttons instead of images, true is text
|
||||
@ -620,7 +619,8 @@ public slots:
|
||||
|
||||
void mod_called(QString p_ip);
|
||||
|
||||
void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno, bool witness);
|
||||
void case_called(QString msg, bool def, bool pro, bool jud, bool jur,
|
||||
bool steno, bool witness);
|
||||
|
||||
private slots:
|
||||
void start_chat_ticking();
|
||||
|
@ -3,16 +3,14 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
struct server_type
|
||||
{
|
||||
struct server_type {
|
||||
QString name;
|
||||
QString desc;
|
||||
QString ip;
|
||||
int port;
|
||||
};
|
||||
|
||||
struct emote_type
|
||||
{
|
||||
struct emote_type {
|
||||
QString comment;
|
||||
QString preanim;
|
||||
QString anim;
|
||||
@ -22,23 +20,20 @@ struct emote_type
|
||||
int sfx_duration;
|
||||
};
|
||||
|
||||
struct char_type
|
||||
{
|
||||
struct char_type {
|
||||
QString name;
|
||||
QString description;
|
||||
QString evidence_string;
|
||||
bool taken;
|
||||
};
|
||||
|
||||
struct evi_type
|
||||
{
|
||||
struct evi_type {
|
||||
QString name;
|
||||
QString description;
|
||||
QString image;
|
||||
};
|
||||
|
||||
struct chatmessage_type
|
||||
{
|
||||
struct chatmessage_type {
|
||||
QString message;
|
||||
QString character;
|
||||
QString side;
|
||||
@ -55,29 +50,25 @@ struct chatmessage_type
|
||||
int flip;
|
||||
};
|
||||
|
||||
struct area_type
|
||||
{
|
||||
struct area_type {
|
||||
QString name;
|
||||
QString background;
|
||||
bool passworded;
|
||||
};
|
||||
|
||||
struct pos_type
|
||||
{
|
||||
struct pos_type {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
struct pos_size_type
|
||||
{
|
||||
struct pos_size_type {
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
};
|
||||
|
||||
enum CHAT_MESSAGE
|
||||
{
|
||||
enum CHAT_MESSAGE {
|
||||
DESK_MOD = 0,
|
||||
PRE_EMOTE,
|
||||
CHAR_NAME,
|
||||
@ -108,17 +99,6 @@ enum CHAT_MESSAGE
|
||||
FRAME_SFX
|
||||
};
|
||||
|
||||
enum COLOR
|
||||
{
|
||||
WHITE = 0,
|
||||
GREEN,
|
||||
RED,
|
||||
ORANGE,
|
||||
BLUE,
|
||||
YELLOW,
|
||||
RAINBOW,
|
||||
PINK,
|
||||
CYAN
|
||||
};
|
||||
enum COLOR { WHITE = 0, GREEN, RED, ORANGE, BLUE, YELLOW, RAINBOW, PINK, CYAN };
|
||||
|
||||
#endif // DATATYPES_H
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef DEBUG_FUNCTIONS_H
|
||||
#define DEBUG_FUNCTIONS_H
|
||||
|
||||
#include <QString>
|
||||
#include <QMessageBox>
|
||||
#include <QString>
|
||||
|
||||
void call_error(QString message);
|
||||
void call_notice(QString message);
|
||||
|
@ -70,7 +70,8 @@ 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
|
||||
@ -78,7 +79,8 @@ DISCORD_EXPORT void Discord_UpdateConnection(void);
|
||||
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" */
|
||||
|
@ -18,8 +18,10 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command);
|
||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId);
|
||||
DISCORD_EXPORT void Discord_Register(const char *applicationId,
|
||||
const char *command);
|
||||
DISCORD_EXPORT void Discord_RegisterSteamGame(const char *applicationId,
|
||||
const char *steamId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
#ifndef DISCORD_RICH_PRESENCE_H
|
||||
#define DISCORD_RICH_PRESENCE_H
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QDebug>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <QDebug>
|
||||
#include <string>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include <discord-rpc.h>
|
||||
|
||||
@ -16,14 +16,14 @@
|
||||
|
||||
namespace AttorneyOnline {
|
||||
|
||||
class Discord
|
||||
{
|
||||
class Discord {
|
||||
Q_DECLARE_TR_FUNCTIONS(Discord)
|
||||
|
||||
private:
|
||||
const char *APPLICATION_ID = "399779271737868288";
|
||||
std::string server_name, server_id;
|
||||
int64_t timestamp;
|
||||
|
||||
public:
|
||||
Discord();
|
||||
~Discord();
|
||||
@ -34,5 +34,5 @@ public:
|
||||
void state_spectate();
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace AttorneyOnline
|
||||
#endif // DISCORD_RICH_PRESENCE_H
|
||||
|
@ -70,7 +70,8 @@ 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
|
||||
@ -78,7 +79,8 @@ DISCORD_EXPORT void Discord_UpdateConnection(void);
|
||||
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);
|
||||
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdlib.h>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <QVector>
|
||||
#include <cstddef>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
|
||||
QString fanta_encrypt(QString p_input, unsigned int key);
|
||||
QString fanta_decrypt(QString p_input, unsigned int key);
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef FILE_FUNCTIONS_H
|
||||
#define FILE_FUNCTIONS_H
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
#include <QString>
|
||||
|
||||
bool file_exists(QString file_path);
|
||||
|
@ -1,16 +1,15 @@
|
||||
#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
|
||||
{
|
||||
namespace omni {
|
||||
std::string int_to_hex(unsigned int input);
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef MISC_FUNCTIONS_H
|
||||
#define MISC_FUNCTIONS_H
|
||||
|
||||
#include <QTime>
|
||||
#include <QCoreApplication>
|
||||
#include <QTime>
|
||||
|
||||
void delay(int p_milliseconds);
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
#ifndef NETWORKMANAGER_H
|
||||
#define NETWORKMANAGER_H
|
||||
|
||||
// Qt for Android has stubbed QDnsLookup. This is not documented in any part of their wiki.
|
||||
// This prevents SRV lookup/failover behavior from functioning.
|
||||
// Qt for Android has stubbed QDnsLookup. This is not documented in any part of
|
||||
// their wiki. This prevents SRV lookup/failover behavior from functioning.
|
||||
// https://bugreports.qt.io/browse/QTBUG-56143
|
||||
#ifndef ANDROID
|
||||
#define MS_FAILOVER_SUPPORTED
|
||||
@ -14,17 +14,16 @@
|
||||
#undef MS_FAILOVER_SUPPORTED
|
||||
#endif
|
||||
|
||||
#include "aopacket.h"
|
||||
#include "aoapplication.h"
|
||||
#include "aopacket.h"
|
||||
|
||||
#include <QTcpSocket>
|
||||
#include <QDnsLookup>
|
||||
#include <QTcpSocket>
|
||||
#include <QTime>
|
||||
#include <QTimer>
|
||||
#include <cstring>
|
||||
|
||||
class NetworkManager : public QObject
|
||||
{
|
||||
class NetworkManager : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
#include "aoapplication.h"
|
||||
#include "file_functions.h"
|
||||
#include <QTextStream>
|
||||
#include <QStringList>
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
#include <QSettings>
|
||||
#include <QStringList>
|
||||
#include <QTextStream>
|
||||
#include <QVector>
|
||||
|
||||
#endif // TEXT_FILE_FUNCTIONS_H
|
||||
|
@ -9,6 +9,7 @@ ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/"
|
||||
|
||||
cd "${ROOT_DIR}"
|
||||
|
||||
|
||||
#need some openGL stuff
|
||||
sudo apt install libgl1-mesa-dev
|
||||
#install curl incase of fresh vm
|
||||
|
@ -1,17 +1,17 @@
|
||||
#include "aoapplication.h"
|
||||
|
||||
#include "lobby.h"
|
||||
#include "courtroom.h"
|
||||
#include "networkmanager.h"
|
||||
#include "debug_functions.h"
|
||||
|
||||
#include "aooptionsdialog.h"
|
||||
#include "aocaseannouncerdialog.h"
|
||||
#include "aooptionsdialog.h"
|
||||
#include "courtroom.h"
|
||||
#include "debug_functions.h"
|
||||
#include "lobby.h"
|
||||
#include "networkmanager.h"
|
||||
|
||||
AOApplication::AOApplication(int &argc, char **argv) : QApplication(argc, argv)
|
||||
{
|
||||
// Create the QSettings class that points to the config.ini.
|
||||
configini = new QSettings(get_base_path() + "config.ini", QSettings::IniFormat);
|
||||
configini =
|
||||
new QSettings(get_base_path() + "config.ini", QSettings::IniFormat);
|
||||
|
||||
net_manager = new NetworkManager(this);
|
||||
discord = new AttorneyOnline::Discord();
|
||||
@ -28,8 +28,7 @@ AOApplication::~AOApplication()
|
||||
|
||||
void AOApplication::construct_lobby()
|
||||
{
|
||||
if (lobby_constructed)
|
||||
{
|
||||
if (lobby_constructed) {
|
||||
qDebug() << "W: lobby was attempted constructed when it already exists";
|
||||
return;
|
||||
}
|
||||
@ -50,8 +49,7 @@ void AOApplication::construct_lobby()
|
||||
|
||||
void AOApplication::destruct_lobby()
|
||||
{
|
||||
if(!lobby_constructed)
|
||||
{
|
||||
if (!lobby_constructed) {
|
||||
qDebug() << "W: lobby was attempted destructed when it did not exist";
|
||||
return;
|
||||
}
|
||||
@ -63,8 +61,7 @@ void AOApplication::destruct_lobby()
|
||||
|
||||
void AOApplication::construct_courtroom()
|
||||
{
|
||||
if (courtroom_constructed)
|
||||
{
|
||||
if (courtroom_constructed) {
|
||||
qDebug() << "W: courtroom was attempted constructed when it already exists";
|
||||
return;
|
||||
}
|
||||
@ -80,8 +77,7 @@ void AOApplication::construct_courtroom()
|
||||
|
||||
void AOApplication::destruct_courtroom()
|
||||
{
|
||||
if (!courtroom_constructed)
|
||||
{
|
||||
if (!courtroom_constructed) {
|
||||
qDebug() << "W: courtroom was attempted destructed when it did not exist";
|
||||
return;
|
||||
}
|
||||
@ -93,16 +89,11 @@ void AOApplication::destruct_courtroom()
|
||||
|
||||
QString AOApplication::get_version_string()
|
||||
{
|
||||
return
|
||||
QString::number(RELEASE) + "." +
|
||||
QString::number(MAJOR_VERSION) + "." +
|
||||
return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." +
|
||||
QString::number(MINOR_VERSION);
|
||||
}
|
||||
|
||||
void AOApplication::reload_theme()
|
||||
{
|
||||
current_theme = read_theme();
|
||||
}
|
||||
void AOApplication::reload_theme() { current_theme = read_theme(); }
|
||||
|
||||
void AOApplication::set_favorite_list()
|
||||
{
|
||||
@ -133,8 +124,7 @@ void AOApplication::add_favorite_server(int p_server)
|
||||
|
||||
void AOApplication::server_disconnected()
|
||||
{
|
||||
if (courtroom_constructed)
|
||||
{
|
||||
if (courtroom_constructed) {
|
||||
beep();
|
||||
call_notice(tr("Disconnected from server."));
|
||||
construct_lobby();
|
||||
@ -145,31 +135,32 @@ void AOApplication::server_disconnected()
|
||||
void AOApplication::loading_cancelled()
|
||||
{
|
||||
destruct_courtroom();
|
||||
|
||||
w_lobby->hide_loading_overlay();
|
||||
}
|
||||
|
||||
void AOApplication::ms_connect_finished(bool connected, bool will_retry)
|
||||
{
|
||||
if (connected)
|
||||
{
|
||||
if (connected) {
|
||||
AOPacket *f_packet = new AOPacket("ALL#%");
|
||||
send_ms_packet(f_packet);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (will_retry)
|
||||
{
|
||||
else {
|
||||
if (will_retry) {
|
||||
if (lobby_constructed)
|
||||
w_lobby->append_error(tr("Error connecting to master server. Will try again in %1 seconds.").arg(QString::number(net_manager->ms_reconnect_delay)));
|
||||
w_lobby->append_error(
|
||||
tr("Error connecting to master server. Will try again in %1 "
|
||||
"seconds.")
|
||||
.arg(QString::number(net_manager->ms_reconnect_delay)));
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
call_error(tr("There was an error connecting to the master server.\n"
|
||||
"We deploy multiple master servers to mitigate any possible downtime, "
|
||||
"but the client appears to have exhausted all possible methods of finding "
|
||||
"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."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,11 @@ void AOBlipPlayer::set_blips(QString p_sfx)
|
||||
{
|
||||
QString f_path = ao_app->get_sounds_path(p_sfx);
|
||||
|
||||
for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
|
||||
{
|
||||
for (int n_stream = 0; n_stream < 5; ++n_stream) {
|
||||
BASS_StreamFree(m_stream_list[n_stream]);
|
||||
|
||||
m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
|
||||
m_stream_list[n_stream] = BASS_StreamCreateFile(
|
||||
FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
|
||||
}
|
||||
|
||||
set_volume_internal(m_volume);
|
||||
@ -44,8 +44,7 @@ void AOBlipPlayer::set_volume_internal(qreal p_value)
|
||||
{
|
||||
float volume = p_value;
|
||||
|
||||
for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
|
||||
{
|
||||
for (int n_stream = 0; n_stream < 5; ++n_stream) {
|
||||
BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
|
||||
}
|
||||
}
|
||||
@ -60,8 +59,7 @@ void AOBlipPlayer::set_blips(QString p_sfx)
|
||||
{
|
||||
QString f_path = ao_app->get_sounds_path(p_sfx);
|
||||
|
||||
for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
|
||||
{
|
||||
for (int n_stream = 0; n_stream < 5; ++n_stream) {
|
||||
m_blips.setSource(QUrl::fromLocalFile(f_path));
|
||||
}
|
||||
|
||||
@ -95,23 +93,11 @@ AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||
ao_app = p_ao_app;
|
||||
}
|
||||
|
||||
void AOBlipPlayer::set_blips(QString p_sfx)
|
||||
{
|
||||
void AOBlipPlayer::set_blips(QString p_sfx) {}
|
||||
|
||||
}
|
||||
void AOBlipPlayer::blip_tick() {}
|
||||
|
||||
void AOBlipPlayer::blip_tick()
|
||||
{
|
||||
void AOBlipPlayer::set_volume(qreal p_value) {}
|
||||
|
||||
}
|
||||
|
||||
void AOBlipPlayer::set_volume(qreal p_value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AOBlipPlayer::set_volume_internal(qreal p_value)
|
||||
{
|
||||
|
||||
}
|
||||
void AOBlipPlayer::set_volume_internal(qreal p_value) {}
|
||||
#endif
|
||||
|
@ -3,15 +3,13 @@
|
||||
#include "debug_functions.h"
|
||||
#include "file_functions.h"
|
||||
|
||||
AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent)
|
||||
AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app)
|
||||
: QPushButton(parent)
|
||||
{
|
||||
ao_app = p_ao_app;
|
||||
}
|
||||
|
||||
AOButton::~AOButton()
|
||||
{
|
||||
|
||||
}
|
||||
AOButton::~AOButton() {}
|
||||
|
||||
void AOButton::set_image(QString p_image)
|
||||
{
|
||||
@ -23,4 +21,3 @@ void AOButton::set_image(QString p_image)
|
||||
else
|
||||
this->setStyleSheet("border-image:url(\"" + default_image_path + "\")");
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include "aocaseannouncerdialog.h"
|
||||
|
||||
AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_ao_app, Courtroom *p_court)
|
||||
AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent,
|
||||
AOApplication *p_ao_app,
|
||||
Courtroom *p_court)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ao_app = p_ao_app;
|
||||
@ -14,21 +16,27 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
|
||||
QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
|
||||
sizepolicy.setHorizontalStretch(0);
|
||||
sizepolicy.setVerticalStretch(0);
|
||||
sizepolicy.setHeightForWidth(ui_announcer_buttons->sizePolicy().hasHeightForWidth());
|
||||
sizepolicy.setHeightForWidth(
|
||||
ui_announcer_buttons->sizePolicy().hasHeightForWidth());
|
||||
ui_announcer_buttons->setSizePolicy(sizepolicy);
|
||||
ui_announcer_buttons->setOrientation(Qt::Horizontal);
|
||||
ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok |
|
||||
QDialogButtonBox::Cancel);
|
||||
|
||||
QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this, SLOT(ok_pressed()));
|
||||
QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this, SLOT(cancel_pressed()));
|
||||
QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this,
|
||||
SLOT(ok_pressed()));
|
||||
QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this,
|
||||
SLOT(cancel_pressed()));
|
||||
|
||||
setUpdatesEnabled(false);
|
||||
|
||||
ui_vbox_layout = new QVBoxLayout(this);
|
||||
|
||||
ui_form_layout = new QFormLayout(this);
|
||||
ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter);
|
||||
ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop);
|
||||
ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
||||
Qt::AlignVCenter);
|
||||
ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft |
|
||||
Qt::AlignTop);
|
||||
ui_form_layout->setContentsMargins(6, 6, 6, 6);
|
||||
|
||||
ui_vbox_layout->addItem(ui_form_layout);
|
||||
@ -69,18 +77,13 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a
|
||||
|
||||
void AOCaseAnnouncerDialog::ok_pressed()
|
||||
{
|
||||
court->announce_case(ui_case_title_textbox->text(),
|
||||
ui_defense_needed->isChecked(),
|
||||
ui_prosecutor_needed->isChecked(),
|
||||
ui_judge_needed->isChecked(),
|
||||
ui_juror_needed->isChecked(),
|
||||
ui_steno_needed->isChecked(),
|
||||
court->announce_case(
|
||||
ui_case_title_textbox->text(), ui_defense_needed->isChecked(),
|
||||
ui_prosecutor_needed->isChecked(), ui_judge_needed->isChecked(),
|
||||
ui_juror_needed->isChecked(), ui_steno_needed->isChecked(),
|
||||
ui_witness_needed->isChecked());
|
||||
|
||||
done(0);
|
||||
}
|
||||
|
||||
void AOCaseAnnouncerDialog::cancel_pressed()
|
||||
{
|
||||
done(0);
|
||||
}
|
||||
void AOCaseAnnouncerDialog::cancel_pressed() { done(0); }
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
#include "file_functions.h"
|
||||
|
||||
AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken) : QPushButton(parent)
|
||||
AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos,
|
||||
int y_pos, bool is_taken)
|
||||
: QPushButton(parent)
|
||||
{
|
||||
m_parent = parent;
|
||||
|
||||
@ -40,39 +42,29 @@ 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)
|
||||
{
|
||||
if (taken) {
|
||||
ui_taken->move(0, 0);
|
||||
ui_taken->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ui_taken->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void AOCharButton::set_passworded()
|
||||
{
|
||||
ui_passworded->show();
|
||||
}
|
||||
void AOCharButton::set_passworded() { ui_passworded->show(); }
|
||||
|
||||
void AOCharButton::set_image(QString p_character)
|
||||
{
|
||||
QString image_path = ao_app->get_character_path(p_character, "char_icon.png");
|
||||
|
||||
this->setText("");
|
||||
|
||||
if (file_exists(image_path))
|
||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
||||
else
|
||||
{
|
||||
else {
|
||||
this->setStyleSheet("border-image:url()");
|
||||
this->setText(p_character);
|
||||
}
|
||||
@ -93,5 +85,3 @@ void AOCharButton::leaveEvent(QEvent * e)
|
||||
ui_selector->hide();
|
||||
QPushButton::leaveEvent(e);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
#include "aocharmovie.h"
|
||||
|
||||
#include "misc_functions.h"
|
||||
#include "file_functions.h"
|
||||
#include "aoapplication.h"
|
||||
#include "file_functions.h"
|
||||
#include "misc_functions.h"
|
||||
|
||||
AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
|
||||
AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app)
|
||||
: QLabel(p_parent)
|
||||
{
|
||||
ao_app = p_ao_app;
|
||||
m_movie = new QMovie(this);
|
||||
@ -19,17 +20,22 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_
|
||||
void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
|
||||
{
|
||||
apng = false;
|
||||
QString original_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif");
|
||||
QString alt_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".png");
|
||||
|
||||
QString original_path =
|
||||
ao_app->get_character_path(p_char, emote_prefix + p_emote + ".gif");
|
||||
QString alt_path =
|
||||
ao_app->get_character_path(p_char, emote_prefix + p_emote + ".png");
|
||||
QString apng_path =
|
||||
ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng");
|
||||
QString alt_path_still = ao_app->get_character_path(p_char, p_emote + ".png");
|
||||
QString apng_path = ao_app->get_character_path(p_char, emote_prefix + p_emote + ".apng");
|
||||
|
||||
QString placeholder_path = ao_app->get_theme_path("placeholder.gif");
|
||||
QString placeholder_default_path = ao_app->get_default_theme_path("placeholder.gif");
|
||||
QString placeholder_default_path =
|
||||
ao_app->get_default_theme_path("placeholder.gif");
|
||||
QString gif_path;
|
||||
current_emote = emote_prefix + p_emote;
|
||||
current_char = p_char;
|
||||
if (file_exists(apng_path))
|
||||
{
|
||||
if (file_exists(apng_path)) {
|
||||
gif_path = apng_path;
|
||||
apng = true;
|
||||
}
|
||||
@ -53,7 +59,8 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
|
||||
this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
|
||||
this->show();
|
||||
this->play_frame_sfx();
|
||||
// if the frame count is 0 (i.e. it's a static PNG) don't try to play the next frame, ya goofus
|
||||
// if the frame count is 0 (i.e. it's a static PNG) don't try to play the next
|
||||
// frame, ya goofus
|
||||
if (m_movie->frameCount() != 0) {
|
||||
ticker->start(m_movie->nextFrameDelay());
|
||||
}
|
||||
@ -62,31 +69,28 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix)
|
||||
void AOCharMovie::play_frame_sfx()
|
||||
{
|
||||
int current_frame = m_movie->currentFrameNumber();
|
||||
QString sfx_to_play = ao_app->get_frame_sfx_name(current_char, current_emote, current_frame);
|
||||
QString screenshake_to_play = ao_app->get_screenshake_frame(current_char, current_emote, current_frame);
|
||||
QString realization_to_play = ao_app->get_realization_frame(current_char, current_emote, current_frame);
|
||||
if(sfx_to_play != "" && !use_networked_framehell)
|
||||
{
|
||||
QString sfx_to_play =
|
||||
ao_app->get_frame_sfx_name(current_char, current_emote, current_frame);
|
||||
QString screenshake_to_play =
|
||||
ao_app->get_screenshake_frame(current_char, current_emote, current_frame);
|
||||
QString realization_to_play =
|
||||
ao_app->get_realization_frame(current_char, current_emote, current_frame);
|
||||
if (sfx_to_play != "" && !use_networked_framehell) {
|
||||
frame_specific_sfx_player->play(ao_app->get_sfx_suffix(sfx_to_play));
|
||||
}
|
||||
else if(use_networked_framehell)
|
||||
{
|
||||
else if (use_networked_framehell) {
|
||||
this->sfx_two_network_boogaloo();
|
||||
}
|
||||
if(screenshake_to_play != "" && !use_networked_framehell)
|
||||
{
|
||||
if (screenshake_to_play != "" && !use_networked_framehell) {
|
||||
mycourtroom->doScreenShake();
|
||||
}
|
||||
else if(use_networked_framehell)
|
||||
{
|
||||
else if (use_networked_framehell) {
|
||||
this->screenshake_two_network_boogaloo();
|
||||
}
|
||||
if(realization_to_play != "" && !use_networked_framehell)
|
||||
{
|
||||
if (realization_to_play != "" && !use_networked_framehell) {
|
||||
mycourtroom->doRealization();
|
||||
}
|
||||
else if(use_networked_framehell)
|
||||
{
|
||||
else if (use_networked_framehell) {
|
||||
this->realization_two_network_boogaloo();
|
||||
}
|
||||
}
|
||||
@ -104,7 +108,8 @@ void AOCharMovie::realization_two_network_boogaloo()
|
||||
for (int ii = 1; ii < extra_garbage.length(); ii++) {
|
||||
QString levels_of_garbage = extra_garbage.at(ii);
|
||||
QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
|
||||
if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") {
|
||||
if (that_shouldnt_be_possible.at(0).toInt() == current_frame &&
|
||||
that_shouldnt_be_possible.at(1) != "") {
|
||||
mycourtroom->doRealization();
|
||||
}
|
||||
}
|
||||
@ -124,7 +129,8 @@ void AOCharMovie::screenshake_two_network_boogaloo()
|
||||
for (int ii = 1; ii < extra_garbage.length(); ii++) {
|
||||
QString levels_of_garbage = extra_garbage.at(ii);
|
||||
QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
|
||||
if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") {
|
||||
if (that_shouldnt_be_possible.at(0).toInt() == current_frame &&
|
||||
that_shouldnt_be_possible.at(1) != "") {
|
||||
mycourtroom->doScreenShake();
|
||||
}
|
||||
}
|
||||
@ -144,44 +150,41 @@ void AOCharMovie::sfx_two_network_boogaloo()
|
||||
for (int ii = 1; ii < extra_garbage.length(); ii++) {
|
||||
QString levels_of_garbage = extra_garbage.at(ii);
|
||||
QStringList that_shouldnt_be_possible = levels_of_garbage.split("=");
|
||||
if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") {
|
||||
frame_specific_sfx_player->play(ao_app->get_sfx_suffix(that_shouldnt_be_possible.at(1)));
|
||||
if (that_shouldnt_be_possible.at(0).toInt() == current_frame &&
|
||||
that_shouldnt_be_possible.at(1) != "") {
|
||||
frame_specific_sfx_player->play(
|
||||
ao_app->get_sfx_suffix(that_shouldnt_be_possible.at(1)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void AOCharMovie::movie_ticker()
|
||||
{
|
||||
if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1)
|
||||
{
|
||||
if (m_movie->currentFrameNumber() == m_movie->frameCount() - 1) {
|
||||
delete m_movie;
|
||||
m_movie = new QMovie(this);
|
||||
m_movie->stop();
|
||||
this->clear();
|
||||
m_movie->setFileName(last_path);
|
||||
m_movie->jumpToFrame(0);
|
||||
if(play_once)
|
||||
{
|
||||
if (play_once) {
|
||||
timer_done();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
m_movie->jumpToNextFrame();
|
||||
}
|
||||
this->LoadImageWithStupidMethodForFlipSupport(m_movie->currentImage());
|
||||
// imagine if QT had sane stuff like "mirror on QMovie" or "resize the image on QT" or "interface with the current QMovie image" or anything else
|
||||
// imagine if QT had sane stuff like "mirror on QMovie" or "resize the image
|
||||
// on QT" or "interface with the current QMovie image" or anything else
|
||||
|
||||
this->play_frame_sfx();
|
||||
|
||||
if (m_movie->frameCount() == 0)
|
||||
{
|
||||
if (m_movie->frameCount() == 0) {
|
||||
return;
|
||||
}
|
||||
else if (!apng)
|
||||
{
|
||||
else if (!apng) {
|
||||
ticker->start(m_movie->nextFrameDelay());
|
||||
}
|
||||
}
|
||||
@ -198,10 +201,13 @@ void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image)
|
||||
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);
|
||||
}
|
||||
@ -231,7 +237,8 @@ void AOCharMovie::play_idle(QString p_char, QString p_emote)
|
||||
|
||||
void AOCharMovie::stop()
|
||||
{
|
||||
//for all intents and purposes, stopping is the same as hiding. at no point do we want a frozen gif to display
|
||||
// for all intents and purposes, stopping is the same as hiding. at no point
|
||||
// do we want a frozen gif to display
|
||||
m_movie->stop();
|
||||
frame_specific_sfx_player->stop();
|
||||
this->hide();
|
||||
@ -250,7 +257,4 @@ void AOCharMovie::move(int ax, int ay)
|
||||
QLabel::move(x, y);
|
||||
}
|
||||
|
||||
void AOCharMovie::timer_done()
|
||||
{
|
||||
done();
|
||||
}
|
||||
void AOCharMovie::timer_done() { done(); }
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
#include "file_functions.h"
|
||||
|
||||
AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
|
||||
AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app,
|
||||
int p_x, int p_y)
|
||||
: QPushButton(p_parent)
|
||||
{
|
||||
parent = p_parent;
|
||||
ao_app = p_ao_app;
|
||||
@ -16,21 +18,17 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x
|
||||
void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix)
|
||||
{
|
||||
QString emotion_number = QString::number(p_emote + 1);
|
||||
QString image_path = ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix);
|
||||
QString image_path = ao_app->get_character_path(
|
||||
p_char, "emotions/button" + emotion_number + suffix);
|
||||
|
||||
if (file_exists(image_path))
|
||||
{
|
||||
if (file_exists(image_path)) {
|
||||
this->setText("");
|
||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
this->setText(ao_app->get_emote_comment(p_char, p_emote));
|
||||
this->setStyleSheet("border-image:url(\"\")");
|
||||
}
|
||||
}
|
||||
|
||||
void AOEmoteButton::on_clicked()
|
||||
{
|
||||
emote_clicked(m_id);
|
||||
}
|
||||
void AOEmoteButton::on_clicked() { emote_clicked(m_id); }
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
#include "file_functions.h"
|
||||
|
||||
AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent)
|
||||
AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app,
|
||||
int p_x, int p_y)
|
||||
: QPushButton(p_parent)
|
||||
{
|
||||
ao_app = p_ao_app;
|
||||
m_parent = p_parent;
|
||||
@ -39,13 +41,11 @@ void AOEvidenceButton::set_image(QString p_image)
|
||||
{
|
||||
QString image_path = ao_app->get_evidence_path(p_image);
|
||||
|
||||
if (file_exists(image_path))
|
||||
{
|
||||
if (file_exists(image_path)) {
|
||||
this->setText("");
|
||||
this->setStyleSheet("border-image:url(\"" + image_path + "\")");
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
this->setText(p_image);
|
||||
this->setStyleSheet("");
|
||||
}
|
||||
@ -75,10 +75,7 @@ void AOEvidenceButton::set_selected(bool p_selected)
|
||||
ui_selected->hide();
|
||||
}
|
||||
|
||||
void AOEvidenceButton::on_clicked()
|
||||
{
|
||||
evidence_clicked(m_id);
|
||||
}
|
||||
void AOEvidenceButton::on_clicked() { evidence_clicked(m_id); }
|
||||
|
||||
void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
{
|
||||
|
@ -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);
|
||||
@ -68,8 +71,7 @@ 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))
|
||||
{
|
||||
if (p_frame == (evidence_movie->frameCount() - 1)) {
|
||||
// we need this or else the last frame wont show
|
||||
delay(evidence_movie->nextFrameDelay());
|
||||
|
||||
@ -88,9 +90,4 @@ void AOEvidenceDisplay::reset()
|
||||
this->clear();
|
||||
}
|
||||
|
||||
QLabel* AOEvidenceDisplay::get_evidence_icon()
|
||||
{
|
||||
return evidence_icon;
|
||||
}
|
||||
|
||||
|
||||
QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; }
|
||||
|
@ -8,10 +8,7 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
|
||||
ao_app = p_ao_app;
|
||||
}
|
||||
|
||||
AOImage::~AOImage()
|
||||
{
|
||||
|
||||
}
|
||||
AOImage::~AOImage() {}
|
||||
|
||||
void AOImage::set_image(QString p_image)
|
||||
{
|
||||
@ -27,7 +24,8 @@ void AOImage::set_image(QString p_image)
|
||||
|
||||
QPixmap f_pixmap(final_image_path);
|
||||
|
||||
this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
|
||||
this->setPixmap(
|
||||
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
|
||||
}
|
||||
|
||||
void AOImage::set_image_from_path(QString p_path)
|
||||
@ -43,5 +41,6 @@ void AOImage::set_image_from_path(QString p_path)
|
||||
|
||||
QPixmap f_pixmap(final_path);
|
||||
|
||||
this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
|
||||
this->setPixmap(
|
||||
f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio));
|
||||
}
|
||||
|
@ -15,7 +15,4 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
this->setReadOnly(false);
|
||||
}
|
||||
|
||||
void AOLineEdit::on_enter_pressed()
|
||||
{
|
||||
this->setReadOnly(true);
|
||||
}
|
||||
void AOLineEdit::on_enter_pressed() { this->setReadOnly(true); }
|
||||
|
@ -18,10 +18,7 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(timer_done()));
|
||||
}
|
||||
|
||||
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::start_timer(int delay) { timer->start(delay); }
|
||||
|
||||
void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme,
|
||||
|
@ -1,16 +1,14 @@
|
||||
#include "aomusicplayer.h"
|
||||
|
||||
#if defined(BASSAUDIO)
|
||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||
: QObject()
|
||||
{
|
||||
m_parent = parent;
|
||||
ao_app = p_ao_app;
|
||||
}
|
||||
|
||||
AOMusicPlayer::~AOMusicPlayer()
|
||||
{
|
||||
kill_loop();
|
||||
}
|
||||
AOMusicPlayer::~AOMusicPlayer() { kill_loop(); }
|
||||
|
||||
void AOMusicPlayer::play(QString p_song)
|
||||
{
|
||||
@ -18,24 +16,21 @@ void AOMusicPlayer::play(QString p_song)
|
||||
|
||||
f_path = ao_app->get_music_path(p_song);
|
||||
|
||||
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
|
||||
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0,
|
||||
BASS_STREAM_AUTOFREE | BASS_UNICODE |
|
||||
BASS_ASYNCFILE);
|
||||
|
||||
this->set_volume(m_volume);
|
||||
|
||||
if (ao_app->get_audio_output_device() != "default")
|
||||
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
||||
if(enable_looping)
|
||||
{
|
||||
if (enable_looping) {
|
||||
BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
|
||||
}
|
||||
BASS_ChannelPlay(m_stream, false);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void AOMusicPlayer::set_volume(int p_value)
|
||||
@ -45,27 +40,19 @@ void AOMusicPlayer::set_volume(int p_value)
|
||||
BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
|
||||
}
|
||||
|
||||
QString AOMusicPlayer::get_path()
|
||||
{
|
||||
return f_path;
|
||||
}
|
||||
QString AOMusicPlayer::get_path() { return f_path; }
|
||||
|
||||
void AOMusicPlayer::kill_loop()
|
||||
{
|
||||
BASS_ChannelStop(m_stream);
|
||||
}
|
||||
void AOMusicPlayer::kill_loop() { BASS_ChannelStop(m_stream); }
|
||||
|
||||
#elif defined(QTAUDIO)
|
||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||
: QObject()
|
||||
{
|
||||
m_parent = parent;
|
||||
ao_app = p_ao_app;
|
||||
}
|
||||
|
||||
AOMusicPlayer::~AOMusicPlayer()
|
||||
{
|
||||
m_player.stop();
|
||||
}
|
||||
AOMusicPlayer::~AOMusicPlayer() { m_player.stop(); }
|
||||
|
||||
void AOMusicPlayer::play(QString p_song)
|
||||
{
|
||||
@ -91,44 +78,24 @@ void AOMusicPlayer::set_volume(int p_value)
|
||||
m_player.setVolume(linearVolume * 100);
|
||||
}
|
||||
|
||||
QString AOMusicPlayer::get_path()
|
||||
{
|
||||
return f_path;
|
||||
}
|
||||
QString AOMusicPlayer::get_path() { return f_path; }
|
||||
|
||||
void AOMusicPlayer::kill_loop()
|
||||
{
|
||||
m_player.stop();
|
||||
}
|
||||
void AOMusicPlayer::kill_loop() { m_player.stop(); }
|
||||
#else
|
||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
||||
AOMusicPlayer::AOMusicPlayer(QWidget *parent, AOApplication *p_ao_app)
|
||||
: QObject()
|
||||
{
|
||||
m_parent = parent;
|
||||
ao_app = p_ao_app;
|
||||
}
|
||||
|
||||
AOMusicPlayer::~AOMusicPlayer()
|
||||
{
|
||||
AOMusicPlayer::~AOMusicPlayer() {}
|
||||
|
||||
}
|
||||
void AOMusicPlayer::play(QString p_song) {}
|
||||
|
||||
void AOMusicPlayer::play(QString p_song)
|
||||
{
|
||||
void AOMusicPlayer::set_volume(int p_value) {}
|
||||
|
||||
}
|
||||
QString AOMusicPlayer::get_path() { return f_path; }
|
||||
|
||||
void AOMusicPlayer::set_volume(int p_value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QString AOMusicPlayer::get_path()
|
||||
{
|
||||
return f_path;
|
||||
}
|
||||
|
||||
void AOMusicPlayer::kill_loop()
|
||||
{
|
||||
|
||||
}
|
||||
void AOMusicPlayer::kill_loop() {}
|
||||
#endif
|
||||
|
@ -8,8 +8,7 @@ AOPacket::AOPacket(QString p_packet_string)
|
||||
|
||||
m_header = packet_contents.at(0);
|
||||
|
||||
for(int n_string = 1 ; n_string < packet_contents.size() - 1 ; ++n_string)
|
||||
{
|
||||
for (int n_string = 1; n_string < packet_contents.size() - 1; ++n_string) {
|
||||
m_contents.append(packet_contents.at(n_string));
|
||||
}
|
||||
}
|
||||
@ -20,23 +19,18 @@ AOPacket::AOPacket(QString p_header, QStringList &p_contents)
|
||||
m_contents = p_contents;
|
||||
}
|
||||
|
||||
AOPacket::~AOPacket()
|
||||
{
|
||||
|
||||
}
|
||||
AOPacket::~AOPacket() {}
|
||||
|
||||
QString AOPacket::to_string()
|
||||
{
|
||||
QString f_string = m_header;
|
||||
|
||||
for (QString i_string : m_contents)
|
||||
{
|
||||
for (QString i_string : m_contents) {
|
||||
f_string += ("#" + i_string);
|
||||
}
|
||||
|
||||
f_string += "#%";
|
||||
|
||||
|
||||
if (encrypted)
|
||||
return "#" + f_string;
|
||||
else
|
||||
@ -59,10 +53,12 @@ void AOPacket::decrypt_header(unsigned int p_key)
|
||||
|
||||
void AOPacket::net_encode()
|
||||
{
|
||||
for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
|
||||
{
|
||||
for (int n_element = 0; n_element < m_contents.size(); ++n_element) {
|
||||
QString f_element = m_contents.at(n_element);
|
||||
f_element.replace("#", "<num>").replace("%", "<percent>").replace("$", "<dollar>").replace("&", "<and>");
|
||||
f_element.replace("#", "<num>")
|
||||
.replace("%", "<percent>")
|
||||
.replace("$", "<dollar>")
|
||||
.replace("&", "<and>");
|
||||
|
||||
m_contents.removeAt(n_element);
|
||||
m_contents.insert(n_element, f_element);
|
||||
@ -71,13 +67,14 @@ void AOPacket::net_encode()
|
||||
|
||||
void AOPacket::net_decode()
|
||||
{
|
||||
for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element)
|
||||
{
|
||||
for (int n_element = 0; n_element < m_contents.size(); ++n_element) {
|
||||
QString f_element = m_contents.at(n_element);
|
||||
f_element.replace("<num>", "#").replace("<percent>", "%").replace("<dollar>", "$").replace("<and>", "&");
|
||||
f_element.replace("<num>", "#")
|
||||
.replace("<percent>", "%")
|
||||
.replace("<dollar>", "$")
|
||||
.replace("<and>", "&");
|
||||
|
||||
m_contents.removeAt(n_element);
|
||||
m_contents.insert(n_element, f_element);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,19 +30,19 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
|
||||
else
|
||||
f_path = sound_path;
|
||||
BASS_ChannelStop(m_stream);
|
||||
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
|
||||
m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0,
|
||||
BASS_STREAM_AUTOFREE | BASS_UNICODE |
|
||||
BASS_ASYNCFILE);
|
||||
|
||||
set_volume_internal(m_volume);
|
||||
|
||||
if (ao_app->get_audio_output_device() != "default")
|
||||
BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
|
||||
BASS_ChannelPlay(m_stream, false);
|
||||
if(looping_sfx && ao_app->get_looping_sfx())
|
||||
{
|
||||
if (looping_sfx && ao_app->get_looping_sfx()) {
|
||||
BASS_ChannelFlags(m_stream, BASS_SAMPLE_LOOP, BASS_SAMPLE_LOOP);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
BASS_ChannelFlags(m_stream, 0, BASS_SAMPLE_LOOP);
|
||||
}
|
||||
}
|
||||
@ -52,10 +52,7 @@ void AOSfxPlayer::setLooping(bool is_looping)
|
||||
this->looping_sfx = is_looping;
|
||||
}
|
||||
|
||||
void AOSfxPlayer::stop()
|
||||
{
|
||||
BASS_ChannelStop(m_stream);
|
||||
}
|
||||
void AOSfxPlayer::stop() { BASS_ChannelStop(m_stream); }
|
||||
|
||||
void AOSfxPlayer::set_volume(qreal p_value)
|
||||
{
|
||||
@ -112,10 +109,7 @@ void AOSfxPlayer::setLooping(bool is_looping)
|
||||
this->looping_sfx = is_looping;
|
||||
}
|
||||
|
||||
void AOSfxPlayer::stop()
|
||||
{
|
||||
m_sfx.stop();
|
||||
}
|
||||
void AOSfxPlayer::stop() { m_sfx.stop(); }
|
||||
|
||||
void AOSfxPlayer::set_volume(qreal p_value)
|
||||
{
|
||||
@ -134,28 +128,16 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject()
|
||||
ao_app = p_ao_app;
|
||||
}
|
||||
|
||||
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
|
||||
{
|
||||
|
||||
}
|
||||
void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) {}
|
||||
|
||||
void AOSfxPlayer::setLooping(bool is_looping)
|
||||
{
|
||||
this->looping_sfx = is_looping;
|
||||
}
|
||||
|
||||
void AOSfxPlayer::stop()
|
||||
{
|
||||
void AOSfxPlayer::stop() {}
|
||||
|
||||
}
|
||||
void AOSfxPlayer::set_volume(qreal p_value) {}
|
||||
|
||||
void AOSfxPlayer::set_volume(qreal p_value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AOSfxPlayer::set_volume_internal(qreal p_value)
|
||||
{
|
||||
|
||||
}
|
||||
void AOSfxPlayer::set_volume_internal(qreal p_value) {}
|
||||
#endif
|
||||
|
@ -1,16 +1,14 @@
|
||||
#include "aotextarea.h"
|
||||
|
||||
AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent)
|
||||
{
|
||||
|
||||
}
|
||||
AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) {}
|
||||
|
||||
void AOTextArea::append_chatmessage(QString p_name, QString p_message,
|
||||
QString p_colour, bool song)
|
||||
{
|
||||
const QTextCursor old_cursor = this->textCursor();
|
||||
const int old_scrollbar_value = this->verticalScrollBar()->value();
|
||||
const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum();
|
||||
const bool is_scrolled_down =
|
||||
old_scrollbar_value == this->verticalScrollBar()->maximum();
|
||||
|
||||
this->moveCursor(QTextCursor::End);
|
||||
|
||||
@ -24,7 +22,9 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message,
|
||||
|
||||
// cheap workarounds ahoy
|
||||
p_message += " ";
|
||||
QString result = p_message.toHtmlEscaped().replace("\n", "<br>").replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>" );
|
||||
QString result = p_message.toHtmlEscaped()
|
||||
.replace("\n", "<br>")
|
||||
.replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>");
|
||||
|
||||
this->insertHtml(result);
|
||||
|
||||
@ -35,31 +35,34 @@ 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.
|
||||
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.
|
||||
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());
|
||||
}
|
||||
|
@ -14,8 +14,4 @@ void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e)
|
||||
this->setReadOnly(false);
|
||||
}
|
||||
|
||||
void AOTextEdit::on_enter_pressed()
|
||||
{
|
||||
this->setReadOnly(true);
|
||||
}
|
||||
|
||||
void AOTextEdit::on_enter_pressed() { this->setReadOnly(true); }
|
||||
|
@ -1,12 +1,11 @@
|
||||
#include "courtroom.h"
|
||||
#include "lobby.h"
|
||||
|
||||
#include "file_functions.h"
|
||||
#include "debug_functions.h"
|
||||
#include "file_functions.h"
|
||||
#include "hardware_functions.h"
|
||||
|
||||
class AOCharSelectGenerationThreading : public QRunnable
|
||||
{
|
||||
class AOCharSelectGenerationThreading : public QRunnable {
|
||||
public:
|
||||
Courtroom *thisCourtroom;
|
||||
int char_num;
|
||||
@ -93,28 +92,36 @@ void Courtroom::construct_char_select()
|
||||
|
||||
set_size_and_pos(ui_char_buttons, "char_buttons");
|
||||
|
||||
connect(char_button_mapper, SIGNAL(mapped(int)), this, SLOT(char_clicked(int)));
|
||||
connect(ui_back_to_lobby, SIGNAL(clicked()), this, SLOT(on_back_to_lobby_clicked()));
|
||||
connect(char_button_mapper, SIGNAL(mapped(int)), this,
|
||||
SLOT(char_clicked(int)));
|
||||
connect(ui_back_to_lobby, SIGNAL(clicked()), this,
|
||||
SLOT(on_back_to_lobby_clicked()));
|
||||
|
||||
connect(ui_char_select_left, SIGNAL(clicked()), this, SLOT(on_char_select_left_clicked()));
|
||||
connect(ui_char_select_right, SIGNAL(clicked()), this, SLOT(on_char_select_right_clicked()));
|
||||
connect(ui_char_select_left, SIGNAL(clicked()), this,
|
||||
SLOT(on_char_select_left_clicked()));
|
||||
connect(ui_char_select_right, SIGNAL(clicked()), this,
|
||||
SLOT(on_char_select_right_clicked()));
|
||||
|
||||
connect(ui_spectator, SIGNAL(clicked()), this, SLOT(on_spectator_clicked()));
|
||||
|
||||
connect(ui_char_search, SIGNAL(textEdited(const QString&)), this, SLOT(on_char_search_changed()));
|
||||
connect(ui_char_passworded, SIGNAL(stateChanged(int)), this, SLOT(on_char_passworded_clicked()));
|
||||
connect(ui_char_taken, SIGNAL(stateChanged(int)), this, SLOT(on_char_taken_clicked()));
|
||||
connect(ui_char_search, SIGNAL(textEdited(const QString &)), this,
|
||||
SLOT(on_char_search_changed()));
|
||||
connect(ui_char_passworded, SIGNAL(stateChanged(int)), this,
|
||||
SLOT(on_char_passworded_clicked()));
|
||||
connect(ui_char_taken, SIGNAL(stateChanged(int)), this,
|
||||
SLOT(on_char_taken_clicked()));
|
||||
}
|
||||
|
||||
void Courtroom::set_char_select()
|
||||
{
|
||||
QString filename = "courtroom_design.ini";
|
||||
|
||||
pos_size_type f_charselect = ao_app->get_element_dimensions("char_select", filename);
|
||||
pos_size_type f_charselect =
|
||||
ao_app->get_element_dimensions("char_select", filename);
|
||||
|
||||
if (f_charselect.width < 0 || f_charselect.height < 0)
|
||||
{
|
||||
qDebug() << "W: did not find courtroom width or height in courtroom_design.ini!";
|
||||
if (f_charselect.width < 0 || f_charselect.height < 0) {
|
||||
qDebug()
|
||||
<< "W: did not find courtroom width or height in courtroom_design.ini!";
|
||||
this->resize(714, 668);
|
||||
}
|
||||
else
|
||||
@ -135,8 +142,7 @@ 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);
|
||||
@ -145,15 +151,13 @@ void Courtroom::set_char_select_page()
|
||||
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
|
||||
if (total_pages > current_char_page + 1)
|
||||
chars_on_page = max_chars_on_page;
|
||||
else
|
||||
chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page;
|
||||
|
||||
}
|
||||
else
|
||||
chars_on_page = max_chars_on_page;
|
||||
@ -169,24 +173,25 @@ void Courtroom::set_char_select_page()
|
||||
|
||||
void Courtroom::char_clicked(int n_char)
|
||||
{
|
||||
QString char_ini_path = ao_app->get_character_path(char_list.at(n_char).name, "char.ini");
|
||||
QString char_ini_path =
|
||||
ao_app->get_character_path(char_list.at(n_char).name, "char.ini");
|
||||
|
||||
qDebug() << "char_ini_path" << char_ini_path;
|
||||
|
||||
if (!file_exists(char_ini_path))
|
||||
{
|
||||
if (!file_exists(char_ini_path)) {
|
||||
call_notice(tr("Could not find %1").arg(char_ini_path, 1));
|
||||
return;
|
||||
}
|
||||
|
||||
if (n_char == m_cid)
|
||||
{
|
||||
if (n_char == m_cid) {
|
||||
enter_courtroom(m_cid);
|
||||
}
|
||||
else
|
||||
{
|
||||
ao_app->send_server_packet(new AOPacket("PW#" + ui_char_password->text() + "#%"));
|
||||
ao_app->send_server_packet(new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" + QString::number(n_char) + "#" + get_hdid() + "#%"));
|
||||
else {
|
||||
ao_app->send_server_packet(
|
||||
new AOPacket("PW#" + ui_char_password->text() + "#%"));
|
||||
ao_app->send_server_packet(
|
||||
new AOPacket("CC#" + QString::number(ao_app->s_pv) + "#" +
|
||||
QString::number(n_char) + "#" + get_hdid() + "#%"));
|
||||
}
|
||||
|
||||
ui_ic_chat_name->setPlaceholderText(char_list.at(n_char).name);
|
||||
@ -197,7 +202,8 @@ void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
|
||||
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;
|
||||
@ -205,14 +211,17 @@ void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
|
||||
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;
|
||||
|
||||
int startout = starting;
|
||||
for (int n = starting ; n < startout+chars_on_this_page ; ++n)
|
||||
{
|
||||
for (int n = starting; n < startout + chars_on_this_page; ++n) {
|
||||
int x_pos = (button_width + x_spacing) * x_mod_count;
|
||||
int y_pos = (button_height + y_spacing) * y_mod_count;
|
||||
|
||||
@ -222,8 +231,7 @@ void Courtroom::put_button_in_place(int starting, int chars_on_this_page)
|
||||
|
||||
++x_mod_count;
|
||||
|
||||
if (x_mod_count == char_columns)
|
||||
{
|
||||
if (x_mod_count == char_columns) {
|
||||
++y_mod_count;
|
||||
x_mod_count = 0;
|
||||
}
|
||||
@ -234,8 +242,7 @@ 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)
|
||||
{
|
||||
if (ui_char_button_list.size() > 0) {
|
||||
foreach (AOCharButton *item, ui_char_button_list) {
|
||||
delete item;
|
||||
}
|
||||
@ -278,17 +285,8 @@ void Courtroom::filter_character_list()
|
||||
set_char_select_page();
|
||||
}
|
||||
|
||||
void Courtroom::on_char_search_changed()
|
||||
{
|
||||
filter_character_list();
|
||||
}
|
||||
void Courtroom::on_char_search_changed() { filter_character_list(); }
|
||||
|
||||
void Courtroom::on_char_passworded_clicked()
|
||||
{
|
||||
filter_character_list();
|
||||
}
|
||||
void Courtroom::on_char_passworded_clicked() { filter_character_list(); }
|
||||
|
||||
void Courtroom::on_char_taken_clicked()
|
||||
{
|
||||
filter_character_list();
|
||||
}
|
||||
void Courtroom::on_char_taken_clicked() { filter_character_list(); }
|
||||
|
@ -33,36 +33,17 @@ chatlogpiece::chatlogpiece(QString p_name, QString p_showname,
|
||||
datetime = p_datetime.toUTC();
|
||||
}
|
||||
|
||||
QString chatlogpiece::get_name()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
QString chatlogpiece::get_name() { return name; }
|
||||
|
||||
QString chatlogpiece::get_showname()
|
||||
{
|
||||
return showname;
|
||||
}
|
||||
QString chatlogpiece::get_showname() { return showname; }
|
||||
|
||||
QString chatlogpiece::get_message()
|
||||
{
|
||||
return message;
|
||||
}
|
||||
QString chatlogpiece::get_message() { return message; }
|
||||
|
||||
QDateTime chatlogpiece::get_datetime()
|
||||
{
|
||||
return datetime;
|
||||
}
|
||||
QDateTime chatlogpiece::get_datetime() { return datetime; }
|
||||
|
||||
bool chatlogpiece::get_is_song()
|
||||
{
|
||||
return is_song;
|
||||
}
|
||||
|
||||
QString chatlogpiece::get_datetime_as_string()
|
||||
{
|
||||
return datetime.toString();
|
||||
}
|
||||
bool chatlogpiece::get_is_song() { return is_song; }
|
||||
|
||||
QString chatlogpiece::get_datetime_as_string() { return datetime.toString(); }
|
||||
int chatlogpiece::get_chat_color() { return color; }
|
||||
|
||||
QString chatlogpiece::get_full()
|
||||
|
1344
src/courtroom.cpp
1344
src/courtroom.cpp
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
#include <QMessageBox>
|
||||
#include <QCoreApplication>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "debug_functions.h"
|
||||
|
||||
@ -7,9 +7,10 @@ void call_error(QString p_message)
|
||||
{
|
||||
QMessageBox *msgBox = new QMessageBox;
|
||||
|
||||
msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1").arg(p_message));
|
||||
msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Error"));
|
||||
|
||||
msgBox->setText(QCoreApplication::translate("debug_functions", "Error: %1")
|
||||
.arg(p_message));
|
||||
msgBox->setWindowTitle(
|
||||
QCoreApplication::translate("debug_functions", "Error"));
|
||||
|
||||
// msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->exec();
|
||||
@ -20,8 +21,9 @@ void call_notice(QString p_message)
|
||||
QMessageBox *msgBox = new QMessageBox;
|
||||
|
||||
msgBox->setText(p_message);
|
||||
msgBox->setWindowTitle(QCoreApplication::translate("debug_functions", "Notice"));
|
||||
|
||||
msgBox->setWindowTitle(
|
||||
QCoreApplication::translate("debug_functions", "Notice"));
|
||||
|
||||
// msgBox->setWindowModality(Qt::NonModal);
|
||||
msgBox->exec();
|
||||
|
@ -8,9 +8,7 @@ Discord::Discord()
|
||||
DiscordEventHandlers handlers;
|
||||
std::memset(&handlers, 0, sizeof(handlers));
|
||||
handlers = {};
|
||||
handlers.ready = [] {
|
||||
qInfo() << "Discord RPC ready";
|
||||
};
|
||||
handlers.ready = [] { qInfo() << "Discord RPC ready"; };
|
||||
handlers.disconnected = [](int errorCode, const char *message) {
|
||||
qInfo() << "Discord RPC disconnected! " << message << errorCode;
|
||||
};
|
||||
@ -21,10 +19,7 @@ Discord::Discord()
|
||||
Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr);
|
||||
}
|
||||
|
||||
Discord::~Discord()
|
||||
{
|
||||
Discord_Shutdown();
|
||||
}
|
||||
Discord::~Discord() { Discord_Shutdown(); }
|
||||
|
||||
void Discord::state_lobby()
|
||||
{
|
||||
@ -64,10 +59,12 @@ void Discord::state_server(std::string name, std::string server_id)
|
||||
|
||||
void Discord::state_character(std::string name)
|
||||
{
|
||||
auto name_internal = QString(name.c_str()).toLower().replace(' ', '_').toStdString();
|
||||
auto name_internal =
|
||||
QString(name.c_str()).toLower().replace(' ', '_').toStdString();
|
||||
auto name_friendly = QString(name.c_str()).replace('_', ' ').toStdString();
|
||||
const std::string playing_as = "Playing as " + name_friendly;
|
||||
qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str() << ")";
|
||||
qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str()
|
||||
<< ")";
|
||||
|
||||
DiscordRichPresence presence;
|
||||
std::memset(&presence, 0, sizeof(presence));
|
||||
@ -101,20 +98,11 @@ void Discord::state_spectate()
|
||||
Discord_UpdatePresence(&presence);
|
||||
}
|
||||
#else
|
||||
Discord::Discord()
|
||||
{
|
||||
Discord::Discord() {}
|
||||
|
||||
}
|
||||
Discord::~Discord() {}
|
||||
|
||||
Discord::~Discord()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Discord::state_lobby()
|
||||
{
|
||||
|
||||
}
|
||||
void Discord::state_lobby() {}
|
||||
|
||||
void Discord::state_server(std::string name, std::string server_id)
|
||||
{
|
||||
@ -129,7 +117,6 @@ void Discord::state_character(std::string name)
|
||||
void Discord::state_spectate()
|
||||
{
|
||||
qDebug() << "Discord RPC: Setting specator state";
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} // namespace AttorneyOnline
|
||||
|
@ -8,7 +8,8 @@ void Courtroom::construct_emotes()
|
||||
|
||||
set_size_and_pos(ui_emotes, "emotes");
|
||||
|
||||
QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini");
|
||||
QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing",
|
||||
"courtroom_design.ini");
|
||||
|
||||
const int button_width = 40;
|
||||
int x_spacing = f_spacing.x();
|
||||
@ -18,13 +19,14 @@ void Courtroom::construct_emotes()
|
||||
int y_spacing = f_spacing.y();
|
||||
int y_mod_count = 0;
|
||||
|
||||
emote_columns = ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1;
|
||||
emote_rows = ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1;
|
||||
emote_columns =
|
||||
((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1;
|
||||
emote_rows =
|
||||
((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1;
|
||||
|
||||
max_emotes_on_page = emote_columns * emote_rows;
|
||||
|
||||
for (int n = 0 ; n < max_emotes_on_page ; ++n)
|
||||
{
|
||||
for (int n = 0; n < max_emotes_on_page; ++n) {
|
||||
int x_pos = (button_width + x_spacing) * x_mod_count;
|
||||
int y_pos = (button_height + y_spacing) * y_mod_count;
|
||||
|
||||
@ -34,12 +36,12 @@ void Courtroom::construct_emotes()
|
||||
|
||||
f_emote->set_id(n);
|
||||
|
||||
connect(f_emote, SIGNAL(emote_clicked(int)), this, SLOT(on_emote_clicked(int)));
|
||||
connect(f_emote, SIGNAL(emote_clicked(int)), this,
|
||||
SLOT(on_emote_clicked(int)));
|
||||
|
||||
++x_mod_count;
|
||||
|
||||
if (x_mod_count == emote_columns)
|
||||
{
|
||||
if (x_mod_count == emote_columns) {
|
||||
++y_mod_count;
|
||||
x_mod_count = 0;
|
||||
}
|
||||
@ -56,23 +58,20 @@ void Courtroom::set_emote_page()
|
||||
ui_emote_left->hide();
|
||||
ui_emote_right->hide();
|
||||
|
||||
for (AOEmoteButton *i_button : ui_emote_list)
|
||||
{
|
||||
for (AOEmoteButton *i_button : ui_emote_list) {
|
||||
i_button->hide();
|
||||
}
|
||||
|
||||
int total_pages = total_emotes / max_emotes_on_page;
|
||||
int emotes_on_page = 0;
|
||||
|
||||
if (total_emotes % max_emotes_on_page != 0)
|
||||
{
|
||||
if (total_emotes % max_emotes_on_page != 0) {
|
||||
++total_pages;
|
||||
// i. e. not on the last page
|
||||
if (total_pages > current_emote_page + 1)
|
||||
emotes_on_page = max_emotes_on_page;
|
||||
else
|
||||
emotes_on_page = total_emotes % max_emotes_on_page;
|
||||
|
||||
}
|
||||
else
|
||||
emotes_on_page = max_emotes_on_page;
|
||||
@ -83,8 +82,7 @@ void Courtroom::set_emote_page()
|
||||
if (current_emote_page > 0)
|
||||
ui_emote_left->show();
|
||||
|
||||
for (int n_emote = 0 ; n_emote < emotes_on_page ; ++n_emote)
|
||||
{
|
||||
for (int n_emote = 0; n_emote < emotes_on_page; ++n_emote) {
|
||||
int n_real_emote = n_emote + current_emote_page * max_emotes_on_page;
|
||||
AOEmoteButton *f_emote = ui_emote_list.at(n_emote);
|
||||
|
||||
@ -95,7 +93,6 @@ void Courtroom::set_emote_page()
|
||||
|
||||
f_emote->show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Courtroom::set_emote_dropdown()
|
||||
@ -105,8 +102,7 @@ void Courtroom::set_emote_dropdown()
|
||||
int total_emotes = ao_app->get_emote_number(current_char);
|
||||
QStringList emote_list;
|
||||
|
||||
for (int n = 0 ; n < total_emotes ; ++n)
|
||||
{
|
||||
for (int n = 0; n < total_emotes; ++n) {
|
||||
emote_list.append(ao_app->get_emote_comment(current_char, n));
|
||||
}
|
||||
|
||||
@ -119,19 +115,20 @@ void Courtroom::select_emote(int p_id)
|
||||
int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page;
|
||||
|
||||
if (current_emote >= min && current_emote <= max)
|
||||
ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_off.png");
|
||||
ui_emote_list.at(current_emote % max_emotes_on_page)
|
||||
->set_image(current_char, current_emote, "_off.png");
|
||||
|
||||
int old_emote = current_emote;
|
||||
|
||||
current_emote = p_id;
|
||||
|
||||
if (current_emote >= min && current_emote <= max)
|
||||
ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png");
|
||||
ui_emote_list.at(current_emote % max_emotes_on_page)
|
||||
->set_image(current_char, current_emote, "_on.png");
|
||||
|
||||
int emote_mod = ao_app->get_emote_mod(current_char, current_emote);
|
||||
|
||||
if (old_emote == current_emote)
|
||||
{
|
||||
if (old_emote == current_emote) {
|
||||
ui_pre->setChecked(!ui_pre->isChecked());
|
||||
}
|
||||
else if (emote_mod == 1)
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
QString fanta_encrypt(QString temp_input, unsigned int p_key)
|
||||
{
|
||||
//using standard stdlib types is actually easier here because of implicit char<->int conversion
|
||||
//which in turn makes encryption arithmetic easier
|
||||
// using standard stdlib types is actually easier here because of implicit
|
||||
// char<->int conversion which in turn makes encryption arithmetic easier
|
||||
|
||||
unsigned int key = p_key;
|
||||
unsigned int C1 = 53761;
|
||||
@ -14,8 +14,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key)
|
||||
QVector<uint_fast8_t> temp_result;
|
||||
std::string input = temp_input.toUtf8().constData();
|
||||
|
||||
for (unsigned int pos = 0 ; pos < input.size() ; ++pos)
|
||||
{
|
||||
for (unsigned int pos = 0; pos < input.size(); ++pos) {
|
||||
uint_fast8_t output = input.at(pos) ^ (key >> 8) % 256;
|
||||
temp_result.append(output);
|
||||
key = (temp_result.at(pos) + key) * C1 + C2;
|
||||
@ -23,8 +22,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key)
|
||||
|
||||
std::string result = "";
|
||||
|
||||
for (uint_fast8_t i_int : temp_result)
|
||||
{
|
||||
for (uint_fast8_t i_int : temp_result) {
|
||||
result += omni::int_to_hex(i_int);
|
||||
}
|
||||
|
||||
@ -39,8 +37,7 @@ QString fanta_decrypt(QString temp_input, unsigned int key)
|
||||
|
||||
QVector<unsigned int> unhexed_vector;
|
||||
|
||||
for(unsigned int i=0; i< input.length(); i+=2)
|
||||
{
|
||||
for (unsigned int i = 0; i < input.length(); i += 2) {
|
||||
std::string byte = input.substr(i, 2);
|
||||
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);
|
||||
|
||||
}
|
||||
|
@ -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,8 +113,7 @@ 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();
|
||||
}
|
||||
|
||||
@ -109,15 +123,13 @@ void Courtroom::set_evidence_page()
|
||||
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
|
||||
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
|
||||
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);
|
||||
@ -215,9 +229,9 @@ void Courtroom::on_evidence_clicked(int p_id)
|
||||
|
||||
int f_real_id = p_id + max_evidence_on_page * current_evidence_page;
|
||||
|
||||
if (f_real_id == local_evidence_list.size())
|
||||
{
|
||||
ao_app->send_server_packet(new AOPacket("PE#<name>#<description>#empty.png#%"));
|
||||
if (f_real_id == local_evidence_list.size()) {
|
||||
ao_app->send_server_packet(
|
||||
new AOPacket("PE#<name>#<description>#empty.png#%"));
|
||||
return;
|
||||
}
|
||||
else if (f_real_id > local_evidence_list.size())
|
||||
@ -233,7 +247,6 @@ void Courtroom::on_evidence_clicked(int p_id)
|
||||
current_evidence = f_real_id;
|
||||
|
||||
ui_ic_chat_message->setFocus();
|
||||
|
||||
}
|
||||
|
||||
void Courtroom::on_evidence_double_clicked(int p_id)
|
||||
@ -262,8 +275,7 @@ void Courtroom::on_evidence_hover(int p_id, bool p_state)
|
||||
ui_evidence_name->setReadOnly(true);
|
||||
int final_id = p_id + max_evidence_on_page * current_evidence_page;
|
||||
|
||||
if (p_state)
|
||||
{
|
||||
if (p_state) {
|
||||
if (final_id == local_evidence_list.size())
|
||||
ui_evidence_name->setText(tr("Add new evidence..."));
|
||||
else if (final_id < local_evidence_list.size())
|
||||
@ -310,7 +322,8 @@ void Courtroom::on_evidence_delete_clicked()
|
||||
ui_evidence_description->setReadOnly(true);
|
||||
ui_evidence_overlay->hide();
|
||||
|
||||
ao_app->send_server_packet(new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
|
||||
ao_app->send_server_packet(
|
||||
new AOPacket("DE#" + QString::number(current_evidence) + "#%"));
|
||||
|
||||
current_evidence = 0;
|
||||
|
||||
@ -338,4 +351,3 @@ void Courtroom::on_evidence_x_clicked()
|
||||
|
||||
ui_ic_chat_message->setFocus();
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,8 @@ bool dir_exists(QString dir_path)
|
||||
return check_dir.exists();
|
||||
}
|
||||
|
||||
bool exists(QString p_path) {
|
||||
bool exists(QString p_path)
|
||||
{
|
||||
QFile file(p_path);
|
||||
|
||||
return file.exists();
|
||||
|
@ -10,7 +10,8 @@ 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);
|
||||
@ -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)
|
||||
@ -58,13 +57,12 @@ QString get_hdid()
|
||||
CFStringRef serial;
|
||||
char buffer[64] = {0};
|
||||
QString hdid;
|
||||
io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault,
|
||||
IOServiceMatching("IOPlatformExpertDevice"));
|
||||
if (platformExpert)
|
||||
{
|
||||
CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert,
|
||||
CFSTR(kIOPlatformSerialNumberKey),
|
||||
kCFAllocatorDefault, 0);
|
||||
io_service_t platformExpert = IOServiceGetMatchingService(
|
||||
kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
|
||||
if (platformExpert) {
|
||||
CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(
|
||||
platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault,
|
||||
0);
|
||||
if (serialNumberAsCFString) {
|
||||
serial = (CFStringRef)serialNumberAsCFString;
|
||||
}
|
||||
|
@ -1,18 +1,17 @@
|
||||
#include "hex_functions.h"
|
||||
|
||||
namespace omni
|
||||
{
|
||||
namespace omni {
|
||||
std::string int_to_hex(unsigned int input)
|
||||
{
|
||||
if (input > 255)
|
||||
return "FF";
|
||||
|
||||
std::stringstream stream;
|
||||
stream << std::setfill('0') << std::setw(sizeof(char)*2)
|
||||
<< std::hex << input;
|
||||
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;
|
||||
}
|
||||
}
|
||||
} // namespace omni
|
||||
|
@ -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,18 +37,24 @@ 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_server_list, SIGNAL(activated(QModelIndex)), this, SLOT(on_server_list_doubleclicked(QModelIndex)));
|
||||
connect(ui_chatmessage, SIGNAL(returnPressed()), this, SLOT(on_chatfield_return_pressed()));
|
||||
connect(ui_server_list, SIGNAL(clicked(QModelIndex)), this,
|
||||
SLOT(on_server_list_clicked(QModelIndex)));
|
||||
connect(ui_server_list, SIGNAL(activated(QModelIndex)), this,
|
||||
SLOT(on_server_list_doubleclicked(QModelIndex)));
|
||||
connect(ui_chatmessage, SIGNAL(returnPressed()), this,
|
||||
SLOT(on_chatfield_return_pressed()));
|
||||
connect(ui_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled()));
|
||||
|
||||
ui_connect->setEnabled(false);
|
||||
@ -67,19 +73,19 @@ 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)
|
||||
{
|
||||
qDebug() << "W: did not find lobby width or height in " << ao_app->get_theme_path(filename);
|
||||
if (f_lobby.width < 0 || f_lobby.height < 0) {
|
||||
qDebug() << "W: did not find lobby width or height in "
|
||||
<< ao_app->get_theme_path(filename);
|
||||
|
||||
// Most common symptom of bad config files and missing assets.
|
||||
call_notice(tr("It doesn't look like your client is set up correctly.\n"
|
||||
call_notice(
|
||||
tr("It doesn't look like your client is set up correctly.\n"
|
||||
"Did you download all resources correctly from tiny.cc/getao, "
|
||||
"including the large 'base' folder?"));
|
||||
|
||||
this->resize(517, 666);
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
this->resize(f_lobby.width, f_lobby.height);
|
||||
}
|
||||
|
||||
@ -124,20 +130,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);"
|
||||
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);
|
||||
@ -152,31 +159,30 @@ void Lobby::set_widgets()
|
||||
ui_cancel->setText(tr("Cancel"));
|
||||
|
||||
ui_loading_background->hide();
|
||||
}
|
||||
|
||||
void Lobby::lobbyThreadHandler(QString loadingText)
|
||||
{
|
||||
this->set_loading_text(loadingText);
|
||||
}
|
||||
|
||||
void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier)
|
||||
{
|
||||
QString filename = "lobby_design.ini";
|
||||
|
||||
pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void Lobby::lobbyThreadHandler(QString loadingText){
|
||||
this->set_loading_text(loadingText);
|
||||
}
|
||||
|
||||
void Lobby::set_loading_text(QString p_text)
|
||||
{
|
||||
ui_loading_text->clear();
|
||||
@ -191,10 +197,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)
|
||||
{
|
||||
@ -292,8 +295,7 @@ void Lobby::on_about_clicked()
|
||||
// clicked on an item in the serverlist
|
||||
void Lobby::on_server_list_clicked(QModelIndex p_model)
|
||||
{
|
||||
if (p_model != last_model)
|
||||
{
|
||||
if (p_model != last_model) {
|
||||
server_type f_server;
|
||||
last_model = p_model;
|
||||
int n_server = p_model.row();
|
||||
@ -301,8 +303,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())
|
||||
@ -310,8 +311,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;
|
||||
|
||||
@ -345,7 +345,6 @@ void Lobby::on_chatfield_return_pressed()
|
||||
if (ui_chatname->text() == "" || ui_chatmessage->text() == "")
|
||||
return;
|
||||
|
||||
|
||||
QString f_header = "CT";
|
||||
QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()};
|
||||
|
||||
@ -364,8 +363,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);
|
||||
}
|
||||
}
|
||||
@ -374,8 +372,7 @@ 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);
|
||||
}
|
||||
}
|
||||
@ -395,16 +392,12 @@ void Lobby::append_error(QString f_message)
|
||||
|
||||
void Lobby::set_player_count(int players_online, int max_players)
|
||||
{
|
||||
QString f_string = tr("Online: %1/%2").arg(QString::number(players_online)).arg(QString::number(max_players));
|
||||
QString f_string = tr("Online: %1/%2")
|
||||
.arg(QString::number(players_online))
|
||||
.arg(QString::number(max_players));
|
||||
ui_player_count->setText(f_string);
|
||||
}
|
||||
|
||||
void Lobby::enable_connect_button()
|
||||
{
|
||||
ui_connect->setEnabled(true);
|
||||
}
|
||||
void Lobby::enable_connect_button() { ui_connect->setEnabled(true); }
|
||||
|
||||
Lobby::~Lobby()
|
||||
{
|
||||
|
||||
}
|
||||
Lobby::~Lobby() {}
|
||||
|
13
src/main.cpp
13
src/main.cpp
@ -1,13 +1,13 @@
|
||||
#include "aoapplication.h"
|
||||
|
||||
#include "datatypes.h"
|
||||
#include "networkmanager.h"
|
||||
#include "lobby.h"
|
||||
#include "courtroom.h"
|
||||
#include <QPluginLoader>
|
||||
#include "datatypes.h"
|
||||
#include "lobby.h"
|
||||
#include "networkmanager.h"
|
||||
#include <QDebug>
|
||||
#include <QTranslator>
|
||||
#include <QLibraryInfo>
|
||||
#include <QPluginLoader>
|
||||
#include <QTranslator>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@ -22,7 +22,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
QSettings *configini = main_app.configini;
|
||||
|
||||
QString p_language = configini->value("language", QLocale::system().name()).toString();
|
||||
QString p_language =
|
||||
configini->value("language", QLocale::system().name()).toString();
|
||||
if (p_language == " " || p_language == "")
|
||||
p_language = QLocale::system().name();
|
||||
|
||||
|
@ -13,21 +13,23 @@ NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent)
|
||||
|
||||
ms_reconnect_timer = new QTimer(this);
|
||||
ms_reconnect_timer->setSingleShot(true);
|
||||
QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect()));
|
||||
QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this,
|
||||
SLOT(retry_ms_connect()));
|
||||
|
||||
QObject::connect(ms_socket, SIGNAL(readyRead()), this, SLOT(handle_ms_packet()));
|
||||
QObject::connect(server_socket, SIGNAL(readyRead()), this, SLOT(handle_server_packet()));
|
||||
QObject::connect(server_socket, SIGNAL(disconnected()), ao_app, SLOT(server_disconnected()));
|
||||
QObject::connect(ms_socket, SIGNAL(readyRead()), this,
|
||||
SLOT(handle_ms_packet()));
|
||||
QObject::connect(server_socket, SIGNAL(readyRead()), this,
|
||||
SLOT(handle_server_packet()));
|
||||
QObject::connect(server_socket, SIGNAL(disconnected()), ao_app,
|
||||
SLOT(server_disconnected()));
|
||||
|
||||
QString master_config = ao_app->configini->value("master", "").value<QString>();
|
||||
QString master_config =
|
||||
ao_app->configini->value("master", "").value<QString>();
|
||||
if (master_config != "")
|
||||
ms_nosrv_hostname = master_config;
|
||||
}
|
||||
|
||||
NetworkManager::~NetworkManager()
|
||||
{
|
||||
|
||||
}
|
||||
NetworkManager::~NetworkManager() {}
|
||||
|
||||
void NetworkManager::connect_to_master()
|
||||
{
|
||||
@ -43,11 +45,11 @@ void NetworkManager::connect_to_master()
|
||||
|
||||
void NetworkManager::connect_to_master_nosrv()
|
||||
{
|
||||
QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)),
|
||||
this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
|
||||
QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this,
|
||||
SLOT(on_ms_socket_error(QAbstractSocket::SocketError)));
|
||||
|
||||
QObject::connect(ms_socket, SIGNAL(connected()),
|
||||
this, SLOT(on_ms_nosrv_connect_success()));
|
||||
QObject::connect(ms_socket, SIGNAL(connected()), this,
|
||||
SLOT(on_ms_nosrv_connect_success()));
|
||||
ms_socket->connectToHost(ms_nosrv_hostname, ms_port);
|
||||
}
|
||||
|
||||
@ -61,12 +63,10 @@ void NetworkManager::connect_to_server(server_type p_server)
|
||||
|
||||
void NetworkManager::ship_ms_packet(QString p_packet)
|
||||
{
|
||||
if (!ms_socket->isOpen())
|
||||
{
|
||||
if (!ms_socket->isOpen()) {
|
||||
retry_ms_connect();
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
ms_socket->write(p_packet.toUtf8());
|
||||
}
|
||||
}
|
||||
@ -81,34 +81,30 @@ 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
|
||||
@ -123,51 +119,48 @@ void NetworkManager::on_srv_lookup()
|
||||
{
|
||||
#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();
|
||||
}
|
||||
@ -186,22 +179,23 @@ 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);
|
||||
|
@ -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 AOPacketLoadMusic(AOApplication *my_app, QString file_name, bool is_music)
|
||||
{
|
||||
@ -33,17 +33,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;
|
||||
}
|
||||
@ -56,39 +53,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() + "#%"));
|
||||
|
||||
@ -106,12 +96,10 @@ 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;
|
||||
}
|
||||
@ -123,8 +111,7 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
|
||||
destruct_courtroom();
|
||||
destruct_lobby();
|
||||
}
|
||||
else if (header == "DOOM")
|
||||
{
|
||||
else if (header == "DOOM") {
|
||||
call_notice(tr("You have been exiled from AO.\n"
|
||||
"Have a nice day."));
|
||||
destruct_courtroom();
|
||||
@ -138,12 +125,9 @@ void AOApplication::ms_packet_received(AOPacket *p_packet)
|
||||
|
||||
bool AOApplication::is_music_track(QString trackname)
|
||||
{
|
||||
return (trackname.startsWith("==") ||
|
||||
trackname.endsWith(".wav") ||
|
||||
trackname.endsWith(".mp3") ||
|
||||
trackname.endsWith(".mp4") ||
|
||||
trackname.endsWith(".ogg") ||
|
||||
trackname.endsWith(".opus"));
|
||||
return (trackname.startsWith("==") || trackname.endsWith(".wav") ||
|
||||
trackname.endsWith(".mp3") || trackname.endsWith(".mp4") ||
|
||||
trackname.endsWith(".ogg") || trackname.endsWith(".opus"));
|
||||
}
|
||||
|
||||
void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
@ -159,8 +143,7 @@ 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;
|
||||
|
||||
@ -192,8 +175,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;
|
||||
|
||||
@ -204,21 +186,20 @@ 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")
|
||||
{
|
||||
else if (header == "FL") {
|
||||
if (f_packet.contains("yellowtext", Qt::CaseInsensitive))
|
||||
yellow_text_enabled = true;
|
||||
if (f_packet.contains("flipping", Qt::CaseInsensitive))
|
||||
@ -246,15 +227,14 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
|
||||
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;
|
||||
|
||||
@ -279,8 +259,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;
|
||||
@ -288,8 +267,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;
|
||||
@ -316,19 +294,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;
|
||||
|
||||
@ -345,30 +323,33 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
|
||||
++loaded_chars;
|
||||
|
||||
w_lobby->set_loading_text(tr("Loading chars:\n%1/%2").arg(QString::number(loaded_chars)).arg(QString::number(char_list_size)));
|
||||
w_lobby->set_loading_text(tr("Loading chars:\n%1/%2")
|
||||
.arg(QString::number(loaded_chars))
|
||||
.arg(QString::number(char_list_size)));
|
||||
|
||||
w_courtroom->append_char(f_char);
|
||||
|
||||
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
|
||||
if (f_contents.at(0).toInt() != loaded_evidence + 1)
|
||||
@ -389,28 +370,31 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
|
||||
++loaded_evidence;
|
||||
|
||||
w_lobby->set_loading_text(tr("Loading evidence:\n%1/%2").arg(QString::number(loaded_evidence)).arg(QString::number(evidence_list_size)));
|
||||
w_lobby->set_loading_text(tr("Loading evidence:\n%1/%2")
|
||||
.arg(QString::number(loaded_evidence))
|
||||
.arg(QString::number(evidence_list_size)));
|
||||
|
||||
w_courtroom->append_evidence(f_evi);
|
||||
|
||||
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 musiclist_start = 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;
|
||||
|
||||
@ -421,28 +405,31 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
|
||||
++loaded_music;
|
||||
|
||||
w_lobby->set_loading_text(tr("Loading music:\n%1/%2").arg(QString::number(loaded_music)).arg(QString::number(music_list_size)));
|
||||
w_lobby->set_loading_text(tr("Loading music:\n%1/%2")
|
||||
.arg(QString::number(loaded_music))
|
||||
.arg(QString::number(music_list_size)));
|
||||
|
||||
for (int area_n = 0; area_n < areas; area_n++)
|
||||
{
|
||||
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
|
||||
@ -450,13 +437,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;
|
||||
@ -469,12 +454,18 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
|
||||
++loaded_chars;
|
||||
|
||||
w_lobby->set_loading_text(tr("Loading chars:\n%1/%2").arg(QString::number(loaded_chars)).arg(QString::number(char_list_size)));
|
||||
w_lobby->set_loading_text(tr("Loading chars:\n%1/%2")
|
||||
.arg(QString::number(loaded_chars))
|
||||
.arg(QString::number(char_list_size)));
|
||||
|
||||
w_courtroom->append_char(f_char);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@ -519,8 +510,8 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
|
||||
send_server_packet(new AOPacket("RD#%"));
|
||||
}
|
||||
else if (header == "DONE")
|
||||
{
|
||||
else if (header == "DONE") {
|
||||
|
||||
if (!courtroom_constructed)
|
||||
goto end;
|
||||
|
||||
@ -534,18 +525,16 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
|
||||
destruct_lobby();
|
||||
}
|
||||
else if (header == "REFMUSIC")
|
||||
{
|
||||
else if (header == "REFMUSIC") {
|
||||
if (courtroom_constructed)
|
||||
w_courtroom->reset_music_list();
|
||||
for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element)
|
||||
{
|
||||
for (int n_element = 0; n_element < f_contents.size(); ++n_element) {
|
||||
w_courtroom->append_music(f_contents.at(n_element));
|
||||
}
|
||||
w_courtroom->list_music();
|
||||
}
|
||||
else if (header == "BN")
|
||||
{
|
||||
else if (header == "BN") {
|
||||
|
||||
if (f_contents.size() < 1)
|
||||
goto end;
|
||||
|
||||
@ -553,45 +542,36 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
w_courtroom->set_background(f_contents.at(0));
|
||||
}
|
||||
// server accepting char request(CC) packet
|
||||
else if (header == "PV")
|
||||
{
|
||||
else if (header == "PV") {
|
||||
if (f_contents.size() < 3)
|
||||
goto end;
|
||||
if (f_contents.size() < 4) {
|
||||
if (courtroom_constructed)
|
||||
w_courtroom->enter_courtroom(f_contents.at(2).toInt());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (courtroom_constructed)
|
||||
{
|
||||
if(f_contents.at(3) == "True")
|
||||
{
|
||||
else {
|
||||
if (courtroom_constructed) {
|
||||
if (f_contents.at(3) == "True") {
|
||||
w_courtroom->set_character(f_contents.at(2).toInt());
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
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);
|
||||
else if (f_contents.size() == 2) {
|
||||
@ -599,19 +579,16 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
@ -628,69 +605,61 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
w_courtroom->set_evidence_list(f_evi_list);
|
||||
}
|
||||
}
|
||||
else if (header == "ARUP")
|
||||
{
|
||||
if (courtroom_constructed)
|
||||
{
|
||||
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));
|
||||
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 == "FAILEDLOGIN")
|
||||
{
|
||||
else if (header == "FAILEDLOGIN") {
|
||||
if (courtroom_constructed)
|
||||
w_courtroom->handle_failed_login();
|
||||
}
|
||||
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(tr("You have been kicked from the server.\nReason: %1").arg(f_contents.at(0)));
|
||||
else if (header == "KK") {
|
||||
if (courtroom_constructed && f_contents.size() >= 1) {
|
||||
call_notice(tr("You have been kicked from the server.\nReason: %1")
|
||||
.arg(f_contents.at(0)));
|
||||
construct_lobby();
|
||||
destruct_courtroom();
|
||||
}
|
||||
}
|
||||
else if (header == "KB")
|
||||
{
|
||||
if (courtroom_constructed && f_contents.size() >= 1)
|
||||
{
|
||||
call_notice(tr("You have been banned from the server.\nReason: %1").arg(f_contents.at(0)));
|
||||
else if (header == "KB") {
|
||||
if (courtroom_constructed && f_contents.size() >= 1) {
|
||||
call_notice(tr("You have been banned from the server.\nReason: %1")
|
||||
.arg(f_contents.at(0)));
|
||||
construct_lobby();
|
||||
destruct_courtroom();
|
||||
}
|
||||
|
||||
}
|
||||
else if (header == "BD")
|
||||
{
|
||||
call_notice(tr("You are banned on this server.\nReason: %1").arg(f_contents.at(0)));
|
||||
else if (header == "BD") {
|
||||
call_notice(
|
||||
tr("You are banned on this server.\nReason: %1").arg(f_contents.at(0)));
|
||||
}
|
||||
else if (header == "ZZ")
|
||||
{
|
||||
else if (header == "ZZ") {
|
||||
if (courtroom_constructed && f_contents.size() > 0)
|
||||
w_courtroom->mod_called(f_contents.at(0));
|
||||
}
|
||||
else if (header == "CASEA")
|
||||
{
|
||||
else if (header == "CASEA") {
|
||||
if (courtroom_constructed && f_contents.size() > 7)
|
||||
w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1", f_contents.at(2) == "1", f_contents.at(3) == "1", f_contents.at(4) == "1", f_contents.at(5) == "1", f_contents.at(6) == "1");
|
||||
w_courtroom->case_called(f_contents.at(0), f_contents.at(1) == "1",
|
||||
f_contents.at(2) == "1", f_contents.at(3) == "1",
|
||||
f_contents.at(4) == "1", f_contents.at(5) == "1",
|
||||
f_contents.at(6) == "1");
|
||||
}
|
||||
|
||||
end:
|
||||
@ -720,8 +689,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
|
||||
@ -729,8 +697,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 {
|
||||
qDebug() << "S:" << f_packet;
|
||||
#ifdef DEBUG_NETWORK
|
||||
qDebug() << "S:" << f_packet;
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include "file_functions.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QStandardPaths>
|
||||
#include <QRegExp>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#ifdef BASE_OVERRIDE
|
||||
#include "base_override.h"
|
||||
@ -39,10 +39,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)
|
||||
{
|
||||
@ -99,24 +96,21 @@ QString AOApplication::get_music_path(QString p_song)
|
||||
QString withending_check = get_base_path() + "sounds/music/" + p_song;
|
||||
QString mp3_check = get_base_path() + "sounds/music/" + p_song + ".mp3";
|
||||
QString opus_check = get_base_path() + "sounds/music/" + p_song + ".opus";
|
||||
if (file_exists(opus_check))
|
||||
{
|
||||
if (file_exists(opus_check)) {
|
||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||
return opus_check;
|
||||
#else
|
||||
return get_case_sensitive_path(opus_check);
|
||||
#endif
|
||||
}
|
||||
else if (file_exists(mp3_check))
|
||||
{
|
||||
else if (file_exists(mp3_check)) {
|
||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||
return mp3_check;
|
||||
#else
|
||||
return get_case_sensitive_path(mp3_check);
|
||||
#endif
|
||||
}
|
||||
else if (file_exists(withending_check))
|
||||
{
|
||||
else if (file_exists(withending_check)) {
|
||||
#ifndef CASE_SENSITIVE_FILESYSTEM
|
||||
return withending_check;
|
||||
#else
|
||||
@ -127,13 +121,15 @@ QString AOApplication::get_music_path(QString p_song)
|
||||
return get_base_path() + "sounds/music/" + p_song + ".wav";
|
||||
;
|
||||
#else
|
||||
return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".wav");
|
||||
return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song +
|
||||
".wav");
|
||||
#endif
|
||||
}
|
||||
|
||||
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;
|
||||
@ -164,9 +160,12 @@ 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);
|
||||
|
||||
@ -178,7 +177,8 @@ QString AOApplication::get_case_sensitive_path(QString p_file) {
|
||||
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);
|
||||
QRegExp file_rx =
|
||||
QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString);
|
||||
QStringList files = QDir(file_parent_dir).entryList();
|
||||
|
||||
int result = files.indexOf(file_rx);
|
||||
|
@ -57,13 +57,15 @@ int AOApplication::get_pundelay()
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@ -78,7 +80,8 @@ QString AOApplication::get_default_username()
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -95,8 +98,7 @@ QStringList AOApplication::get_call_words()
|
||||
|
||||
QTextStream in(&callwords_ini);
|
||||
|
||||
while (!in.atEnd())
|
||||
{
|
||||
while (!in.atEnd()) {
|
||||
QString line = in.readLine();
|
||||
return_value.append(line);
|
||||
}
|
||||
@ -111,8 +113,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;
|
||||
}
|
||||
|
||||
@ -132,15 +133,13 @@ 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(":");
|
||||
@ -159,7 +158,8 @@ 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);
|
||||
@ -185,7 +185,8 @@ QString AOApplication::read_design_ini(QString p_identifier, QString p_design_pa
|
||||
}
|
||||
if (value.type() == QVariant::StringList) {
|
||||
return value.toStringList().join(",");
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
@ -201,8 +202,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 == "")
|
||||
@ -220,7 +220,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);
|
||||
@ -233,8 +234,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 == "")
|
||||
@ -258,8 +258,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";
|
||||
@ -272,8 +271,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 == "")
|
||||
@ -291,8 +289,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 == "")
|
||||
@ -315,12 +312,10 @@ 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);
|
||||
@ -356,8 +351,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 == "")
|
||||
@ -384,8 +378,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 == "")
|
||||
@ -420,12 +413,10 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check)
|
||||
if (!file_exists(get_sounds_path(sound_to_check))) {
|
||||
QString mp3_check = get_sounds_path(sound_to_check + ".mp3");
|
||||
QString opus_check = get_sounds_path(sound_to_check + ".opus");
|
||||
if (file_exists(opus_check))
|
||||
{
|
||||
if (file_exists(opus_check)) {
|
||||
return sound_to_check + ".opus";
|
||||
}
|
||||
else if (file_exists(mp3_check))
|
||||
{
|
||||
else if (file_exists(mp3_check)) {
|
||||
return sound_to_check + ".mp3";
|
||||
}
|
||||
return sound_to_check + ".wav";
|
||||
@ -446,12 +437,14 @@ QString AOApplication::get_image_suffix(QString path_to_check)
|
||||
return path_to_check + ".png";
|
||||
}
|
||||
|
||||
|
||||
//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();
|
||||
@ -464,7 +457,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)
|
||||
@ -476,7 +470,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)
|
||||
@ -485,7 +480,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)
|
||||
@ -494,14 +490,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;
|
||||
}
|
||||
|
||||
@ -510,7 +508,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)
|
||||
@ -519,7 +518,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)
|
||||
@ -528,7 +528,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)
|
||||
@ -537,68 +538,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("#");
|
||||
|
||||
@ -609,61 +617,74 @@ 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;
|
||||
}
|
||||
|
||||
QString AOApplication::get_sfx_looping(QString p_char, int p_emote)
|
||||
{
|
||||
QString f_result = read_char_ini(p_char, QString::number(p_emote + 1), "SoundL");
|
||||
QString f_result =
|
||||
read_char_ini(p_char, QString::number(p_emote + 1), "SoundL");
|
||||
|
||||
if (f_result == "")
|
||||
return "0";
|
||||
else return f_result;
|
||||
else
|
||||
return f_result;
|
||||
}
|
||||
|
||||
QString AOApplication::get_frame_sfx_name(QString p_char, QString p_emote, int n_frame)
|
||||
QString AOApplication::get_frame_sfx_name(QString p_char, QString p_emote,
|
||||
int n_frame)
|
||||
{
|
||||
QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameSFX"));
|
||||
QString f_result = read_char_ini(p_char, QString::number(n_frame),
|
||||
p_emote.append("_FrameSFX"));
|
||||
if (f_result == "")
|
||||
return "";
|
||||
else return f_result;
|
||||
else
|
||||
return f_result;
|
||||
}
|
||||
|
||||
QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote, int n_frame)
|
||||
QString AOApplication::get_screenshake_frame(QString p_char, QString p_emote,
|
||||
int n_frame)
|
||||
{
|
||||
QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameScreenshake"));
|
||||
QString f_result = read_char_ini(p_char, QString::number(n_frame),
|
||||
p_emote.append("_FrameScreenshake"));
|
||||
if (f_result == "")
|
||||
return "";
|
||||
else return f_result;
|
||||
else
|
||||
return f_result;
|
||||
}
|
||||
|
||||
|
||||
QString AOApplication::get_realization_frame(QString p_char, QString p_emote, int n_frame)
|
||||
QString AOApplication::get_realization_frame(QString p_char, QString p_emote,
|
||||
int n_frame)
|
||||
{
|
||||
QString f_result = read_char_ini(p_char, QString::number(n_frame), p_emote.append("_FrameRealization"));
|
||||
QString f_result = read_char_ini(p_char, QString::number(n_frame),
|
||||
p_emote.append("_FrameRealization"));
|
||||
if (f_result == "")
|
||||
return "";
|
||||
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)
|
||||
@ -672,7 +693,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)
|
||||
@ -681,7 +703,8 @@ QString AOApplication::get_custom_realization(QString p_char)
|
||||
|
||||
if (f_result == "")
|
||||
return get_sfx("realization");
|
||||
else return f_result;
|
||||
else
|
||||
return get_sfx_suffix(f_result);
|
||||
}
|
||||
|
||||
bool AOApplication::get_blank_blip()
|
||||
@ -698,7 +721,8 @@ bool AOApplication::get_looping_sfx()
|
||||
|
||||
bool AOApplication::get_objectmusic()
|
||||
{
|
||||
QString result = configini->value("kill_music_on_object", "false").value<QString>();
|
||||
QString result =
|
||||
configini->value("kill_music_on_object", "false").value<QString>();
|
||||
return result.startsWith("true");
|
||||
}
|
||||
|
||||
@ -714,7 +738,6 @@ bool AOApplication::is_keepevi_enabled()
|
||||
return result.startsWith("true");
|
||||
}
|
||||
|
||||
|
||||
bool AOApplication::get_casing_enabled()
|
||||
{
|
||||
QString result = configini->value("casing_enabled", "false").value<QString>();
|
||||
@ -723,49 +746,58 @@ bool AOApplication::get_casing_enabled()
|
||||
|
||||
bool AOApplication::get_casing_defence_enabled()
|
||||
{
|
||||
QString result = configini->value("casing_defence_enabled", "false").value<QString>();
|
||||
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>();
|
||||
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>();
|
||||
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>();
|
||||
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_wit_enabled()
|
||||
{
|
||||
QString result = configini->value("casing_wit_enabled", "false").value<QString>();
|
||||
QString result =
|
||||
configini->value("casing_wit_enabled", "false").value<QString>();
|
||||
return result.startsWith("true");
|
||||
}
|
||||
|
||||
bool AOApplication::get_casing_cm_enabled()
|
||||
{
|
||||
QString result = configini->value("casing_cm_enabled", "false").value<QString>();
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user