aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSalanto <62221668+Salanto@users.noreply.github.com>2023-05-31 20:17:30 +0200
committerGitHub <noreply@github.com>2023-05-31 20:17:30 +0200
commit7c1fe80d4cbece55149b6fd52e3e90515f440446 (patch)
tree2fc87a7cfb5bf9dbb81f52c857a769a6413e8b14 /include
parent2915f4cc04c75f02d5c6c89e497193bb981c34b5 (diff)
2.10.1 Changes (#888)
* Utilise .ui file to create settings dialog (#858) * Remove config loading from AOApplications Removes most, but not all config functions from AOApplication and moves them into their own class. Not even remotely done here. but holy shit I'm tired. * First steps towards UI file * Fixed your UI layout issue * Leifa bullies me * Set all the setters Reminder : Figure out why username and ooc_name exist. Are they the same? Maybe. Maybe not. Gonna have to look at it and migrate the key. Todo : Cleanup key naming. Most of these are terrible, imprecise or I just don't like them. * Make layout appear proper * Minor option dialog update * Hookup AOOptionsdialogue to Options Getter/setter Not done yet, but parts of the options interactions work again. * More settings menu working * Mostly working settings dialogue Restore default and cancel still need work * Fix asset widget * Tooltips Also removes the commented out tooltip code * Finish Tooltips Move widget implementation to its own folder * Migrate callwords to config.ini Also correct sleep deprived code. * Fix widget translation * Language dropdown changes We might want to look into doing this a bit better. * Remove QSettings from AOApplication Try cleaning up stray references to said object anymore * Fix constructor order to prevent runtime crash * Slightly sort implementation file * Remove unused label declarations from header Fix some comments * Formatting * Fix buttons Also fixes restore settings when a restore to default is aborted. * Raise pair list after courtroom construction (#859) * Don't reset evidence selection (#860) They are defaulted in the header. This SHOULD not affect the client negatively. * Hitting the emergency exit (#861) Don't change the widget state when the ID exceeds the current widget list due to pages being changed while evidence is being edited. * add CI and license badge * add contributors * Handle config.temp after confirmation * Deletes config.temp when the user has confirmed they want to keep the current settings. * Make reset to default destructive Don't worry, we ask first! :) * Fix case of self_offset received without a y offset (#864) caused by typos in #701 it's possible for older clients to send x offsets without a y offset. if you think this case is annoying you can remove it in the next version and handle it server-side instead * Change default settings (#839) * Make default config enable features for most cases except for Continuous Playback due to it introducing performance issues according to tooltip and confirmed in testing * Increase log size to 1000 * Default disable animated themes Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com> Co-authored-by: stonedDiscord <Tukz@gmx.de> * Make it a singleton? Maybe? I dunno? Ask Longbyte * Commit suggestions * More suggestions Also try fixing a memory leak. Not going to well. * Return to dialog Otherwise we don't have Exec. * Cleanup * Deprecate ooc_name, implement username * Remove ooc_name key and copy its value to default_showname if its empty. * Consistent naming in AOOptionsDialog * Clang format * Don't write the username to the showname * Fix theme dropdown being incorrectly set * Bandaid callword playing every message * Remove unused or duplicate includes * More include removals Removes lobby and courtroom direct includes from the dialog source * Burn baby, burn! * Remove reload_theme function * Remove "Case Alert Supported Message" All servers I tested on master supported it. The text is redundant in operation. Co-authored-by: TrickyLeifa <date.epoch@gmail.com> Co-authored-by: stonedDiscord <Tukz@gmx.de> Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com> Co-authored-by: Crystalwarrior <Varsash@Gmail.com> * Cleanup lobby (#880) * Remove config loading from AOApplications Removes most, but not all config functions from AOApplication and moves them into their own class. Not even remotely done here. but holy shit I'm tired. * First steps towards UI file * Fixed your UI layout issue * Leifa bullies me * Set all the setters Reminder : Figure out why username and ooc_name exist. Are they the same? Maybe. Maybe not. Gonna have to look at it and migrate the key. Todo : Cleanup key naming. Most of these are terrible, imprecise or I just don't like them. * Make layout appear proper * Minor option dialog update * Hookup AOOptionsdialogue to Options Getter/setter Not done yet, but parts of the options interactions work again. * More settings menu working * Mostly working settings dialogue Restore default and cancel still need work * Fix asset widget * Tooltips Also removes the commented out tooltip code * Finish Tooltips Move widget implementation to its own folder * Migrate callwords to config.ini Also correct sleep deprived code. * Fix widget translation * Language dropdown changes We might want to look into doing this a bit better. * Remove QSettings from AOApplication Try cleaning up stray references to said object anymore * Fix constructor order to prevent runtime crash * Slightly sort implementation file * Remove unused label declarations from header Fix some comments * Formatting * Fix buttons Also fixes restore settings when a restore to default is aborted. * Raise pair list after courtroom construction (#859) * Don't reset evidence selection (#860) They are defaulted in the header. This SHOULD not affect the client negatively. * Hitting the emergency exit (#861) Don't change the widget state when the ID exceeds the current widget list due to pages being changed while evidence is being edited. * add CI and license badge * add contributors * Handle config.temp after confirmation * Deletes config.temp when the user has confirmed they want to keep the current settings. * Make reset to default destructive Don't worry, we ask first! :) * Fix case of self_offset received without a y offset (#864) caused by typos in #701 it's possible for older clients to send x offsets without a y offset. if you think this case is annoying you can remove it in the next version and handle it server-side instead * Change default settings (#839) * Make default config enable features for most cases except for Continuous Playback due to it introducing performance issues according to tooltip and confirmed in testing * Increase log size to 1000 * Default disable animated themes Co-authored-by: Salanto <62221668+Salanto@users.noreply.github.com> Co-authored-by: stonedDiscord <Tukz@gmx.de> * Make it a singleton? Maybe? I dunno? Ask Longbyte * Commit suggestions * More suggestions Also try fixing a memory leak. Not going to well. * Return to dialog Otherwise we don't have Exec. * Cleanup * Deprecate ooc_name, implement username * Remove ooc_name key and copy its value to default_showname if its empty. * Consistent naming in AOOptionsDialog * Clang format * Don't write the username to the showname * Fix theme dropdown being incorrectly set * Bandaid callword playing every message * Remove unused or duplicate includes * More include removals Removes lobby and courtroom direct includes from the dialog source * Burn baby, burn! * Remove reload_theme function * Remove "Case Alert Supported Message" All servers I tested on master supported it. The text is redundant in operation. * Create preliminary lobby design Attempts to slightly modernize the aging lobby to a scheme more akin to modern server browsers. * Fix missing header, add necessary search lineedits * More UI changes * Start hooking up new UI elements * Hookup Serverbrowser to new UI frontend Still need to fix the favorites AND implement the NEW demolist * Fixup demo ui and make demoserver functional * More demoserver cleanup * Remove jarring ao_app pointer shenigans Still a bit to do before we can safely remove that pointer, but hey, its something. * *unholy screeches* Tried to untangle the tange of dependencies that is connection behaviour * Rip out loading screen Some servers are not even sending proper values anymore, like vanilla, so why keep it? * Optimise includes, format header Lobby should not even have to know what an AOPacket is, smh * Formatting fixes and turn settings menu opening into a signal * Why does netmanager never emit when the server is connected * Fixup final parts About as well implemented as I can do rn. Missing the load screen, but that was more flair than anything else * Correct start page * demo qol Co-authored-by: TrickyLeifa <date.epoch@gmail.com> Co-authored-by: stonedDiscord <Tukz@gmx.de> Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com> Co-authored-by: Crystalwarrior <Varsash@Gmail.com> * Delete rebase artifact * only set setting codec on qt5 * fix old regex * qlocale include was missing * Add default soundfont value + cleaup stream checks * Remove Case Announcement * Add add_server dialog and move logic to options.h * Add Direction Connection Widget and function * Visual Fluff, don't show direct connection on demo screen * Implement ui-file reload and RCC mounting. * Add edit menu to favorites * Add Server remains active when no server is selected * Hack together window title for courtroom I hate this. * Fix incorrect subtheme location code * Cleanup * Make all charicons appear on first join This entire system needs a rework, but this will do for now. Also slightly improves performance by not making it load the character list 4 times, only 2 now :^) closes #854 * Fix evidence hover selector under Qt5 #closes #890 * Remove options calling itself trough pointer * Fix Android CI (#891) * pro gamer move * remove pregenerated android files * version * install old ass android platform * Revert "remove pregenerated android files" This reverts commit c81a94c6fd337e187af61e9dd706fac5cd51bcc0. * switch to 24 * CharButton - Fix enterEvent override in Qt5 Also mark them as override. Also make the preprocessor if a bit less copypastey. * version bump * Update embeeded lobby ui color sheme Shoutout to Dumb Fuck (That is their real discord name). Co-Authored-By: Crystalwarrior <3470436+Crystalwarrior@users.noreply.github.com> * Add changelog.md loading logic from main mount path * Expand tabbar of optional Tabbar widget * Fix order column being incorrectly sized * missed a space * remove fonts * change margins * fix minimum sizes * Allow theme overwrite of settings menu * Cleanup iterator for subthemes * Allow reload of settings menu Might aswell do them all :shrug: * AO base path (#893) * make get_base_path global and move parts that use base to use it * options uses base * sal moved a bunch of code * fix creating case folder --------- Co-authored-by: stonedDiscord <10584181+stonedDiscord@users.noreply.github.com> * Android 2 10 1 (#894) * ask for file permissions before trying to load a file * create armv7 gitignore * extract all the abis * don't fail if the dir exists * Clear options map before reloading the UI * Fix runtime warning for theme/subtheme combobox Shouldn't do the job of something that the template can do for me. Also fix formatting cause it was busted. Also made the subtheme/theme load code not give me cancer. * Sort dropdown numerically to match explorer preview closes #793 * fuck bass * copy mingw * copy other dll * wrong folder * Account for server subtheme * Replace incorrect subtheme check * Settings, not server * Remove debug * Add compatibility code, suppress compiler warning (#896) lobby.cpp: * Added compatibility code so 2.10.1 can run on Qt versions older than 5.14, such as the version that ships with Ubuntu 20.04 courtroom.cpp: * Used a Q_UNUSED macro on an unused variable to suppress a compiler warning * Resolve Qt6(.5.0) compiler errors * Undo incompetence. * Force theme reload on theme change If a user saves a new theme and does not reload the UI it will cause misplacement of widgets inside of courtroom. This is mitigated by forcing a reload. * make speedlines stretch by default (in *actually* non-stupid way this time) (#901) * Rework default volume settings (#903) * rework volume default settings * remove default volume settings in options dialog * make client remember last volume settings instead * fix options starting tab * Reworked direct connect (#906) Resolve issue #905 Works as advertised. * Set join text when double-click on connected server Good enough. I would handle this a bit smarter and lock based on the connection state of NetworkManager, but NetworkManager sucks and I refuse to fix it this close before 2.10.1 is done. * remove unused m_looping * remove useless underflow check * do not fall from server to favorites * Ci android fix (#899) * pro gamer move * remove pregenerated android files * version * install old ass android platform * Revert "remove pregenerated android files" This reverts commit c81a94c6fd337e187af61e9dd706fac5cd51bcc0. * switch to 24 * use android\src\android\templates instead * deprecate "chat" deskmod (#910) * ignore deskmod when zoom speaking * clean up deskmod a bit * adds an enum for deskmods * deprecates the "chat" deskmood * modifies set_scene since it never rly used the deskmod argument meaningfully * actually use the enums i made lol * fix typo * Add credits for lamdacalculus --------- Co-authored-by: TrickyLeifa <date.epoch@gmail.com> Co-authored-by: stonedDiscord <Tukz@gmx.de> Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com> Co-authored-by: Crystalwarrior <Varsash@Gmail.com> Co-authored-by: Crystalwarrior <3470436+Crystalwarrior@users.noreply.github.com> Co-authored-by: stonedDiscord <10584181+stonedDiscord@users.noreply.github.com> Co-authored-by: segfault <128277930+memsecviolator@users.noreply.github.com> Co-authored-by: lambdcalculus <64238778+lambdcalculus@users.noreply.github.com> Co-authored-by: Leifa♥ <26681464+TrickyLeifa@users.noreply.github.com>
Diffstat (limited to 'include')
-rw-r--r--include/aoapplication.h229
-rw-r--r--include/aocaseannouncerdialog.h46
-rw-r--r--include/aocharbutton.h8
-rw-r--r--include/aoevidencebutton.h10
-rw-r--r--include/aomusicplayer.h28
-rw-r--r--include/aooptionsdialog.h273
-rw-r--r--include/courtroom.h14
-rw-r--r--include/datatypes.h11
-rw-r--r--include/demoserver.h3
-rw-r--r--include/file_functions.h2
-rw-r--r--include/interfaces/server_dialog.h21
-rw-r--r--include/lobby.h134
-rw-r--r--include/networkmanager.h4
-rw-r--r--include/options.h290
-rw-r--r--include/widgets/add_server_dialog.h44
-rw-r--r--include/widgets/aooptionsdialog.h159
-rw-r--r--include/widgets/direct_connect_dialog.h46
-rw-r--r--include/widgets/edit_server_dialog.h46
18 files changed, 725 insertions, 643 deletions
diff --git a/include/aoapplication.h b/include/aoapplication.h
index 16895d8..8ef2a12 100644
--- a/include/aoapplication.h
+++ b/include/aoapplication.h
@@ -1,14 +1,13 @@
#ifndef AOAPPLICATION_H
#define AOAPPLICATION_H
+#include "widgets/aooptionsdialog.h"
#include "aopacket.h"
#include "datatypes.h"
#include "demoserver.h"
#include "discord_rich_presence.h"
#include "bass.h"
-#include "bassmidi.h"
-#include "bassopus.h"
#include <QApplication>
#include <QFile>
@@ -34,6 +33,7 @@
class NetworkManager;
class Lobby;
class Courtroom;
+class Options;
class VPath : QString {
using QString::QString;
@@ -130,10 +130,6 @@ public:
///////////////////////////////////////////
- void load_favorite_list();
- void save_favorite_list();
- QVector<server_type> &get_favorite_list() { return favorite_list; }
-
// Adds the server to favorite_servers.ini
void add_favorite_server(int p_server);
void remove_favorite_server(int p_server);
@@ -141,14 +137,10 @@ public:
void set_server_list(QVector<server_type> &servers) { server_list = servers; }
QVector<server_type> &get_server_list() { return server_list; }
- // reads the theme from config.ini and sets it accordingly
- void reload_theme();
-
// Returns the character the player has currently selected
QString get_current_char();
// implementation in path_functions.cpp
- QString get_base_path();
VPath get_theme_path(QString p_file, QString p_theme="");
VPath get_character_path(QString p_char, QString p_file);
VPath get_misc_path(QString p_misc, QString p_file);
@@ -173,147 +165,6 @@ public:
////// Functions for reading and writing files //////
// Implementations file_functions.cpp
- // Instead of reinventing the wheel, we'll use a QSettings class.
- QSettings *configini;
-
- // Reads the theme from config.ini and loads it into the current_theme
- // variable
- QString read_theme();
-
- // Returns the value of ooc_name in config.ini
- QString get_ooc_name();
-
- // Returns the blip rate from config.ini (once per X symbols)
- int read_blip_rate();
-
- // Returns true if blank blips is enabled in config.ini and false otherwise
- bool get_blank_blip();
-
- // Returns true if looping sound effects are enabled in the config.ini
- bool get_looping_sfx();
-
- // Returns true if stop music on objection is enabled in the config.ini
- bool objection_stop_music();
-
- // Returns true if streaming is enabled in the config.ini
- bool is_streaming_disabled();
-
- // Returns the value of default_music in config.ini
- int get_default_music();
-
- // Returns the value of default_sfx in config.ini
- int get_default_sfx();
-
- // Returns the value of default_blip in config.ini
- int get_default_blip();
-
- // Returns the value of suppress_audio in config.ini
- int get_default_suppress_audio();
-
- // Returns the value if objections interrupt and skip the message queue
- // from the config.ini.
- bool is_instant_objection_enabled();
-
- // returns if log will show messages as-received, while viewport will parse according to the queue (Text Stay Time)
- // from the config.ini
- bool is_desyncrhonized_logs_enabled();
-
- // Returns the value of whether Discord should be enabled on startup
- // from the config.ini.
- bool is_discord_enabled();
-
- // Returns the value of whether shaking should be enabled.
- // from the config.ini.
- bool is_shake_enabled();
-
- // Returns the value of whether effects should be enabled.
- // from the config.ini.
- bool is_effects_enabled();
-
- // Returns the value of whether frame-specific effects defined in char.ini
- // should be sent/received over the network. from the config.ini.
- bool is_frame_network_enabled();
-
- // Returns the value of whether colored ic log should be a thing.
- // from the config.ini.
- bool is_colorlog_enabled();
-
- // Returns the value of whether sticky sounds should be a thing.
- // from the config.ini.
- bool is_stickysounds_enabled();
-
- // Returns the value of whether sticky effects should be a thing.
- // from the config.ini.
- bool is_stickyeffects_enabled();
-
- // Returns the value of whether sticky preanims should be a thing.
- // from the config.ini.
- bool is_stickypres_enabled();
-
- // Returns the value of whether custom chatboxes should be a thing.
- // from the config.ini.
- // I am increasingly maddened by the lack of dynamic auto-generation system
- // for settings.
- bool is_customchat_enabled();
-
- // Returns the value of characer sticker (avatar) setting
- bool is_sticker_enabled();
-
- // Returns the value of whether continuous playback should be used
- // from the config.ini.
- bool is_continuous_enabled();
-
- // Returns the value of whether stopping music by double clicking category should be used
- // from the config.ini.
- bool is_category_stop_enabled();
-
- // Returns the value of the maximum amount of lines the IC chatlog
- // may contain, from config.ini.
- int get_max_log_size();
-
- // Current wait time between messages for the queue system
- int stay_time();
-
- // Returns the letter display speed during text crawl in in-character messages
- int get_text_crawl();
-
- // Returns Minimum amount of time (in miliseconds) that must pass before the next Enter key press will send your IC message. (new behaviour)
- int get_chat_ratelimit();
-
- // Returns whether the log should go upwards (new behaviour)
- // or downwards (vanilla behaviour).
- bool get_log_goes_downwards();
-
- // Returns whether the log should separate name from text via newline or :
- bool get_log_newline();
-
- // Get spacing between IC log entries.
- int get_log_margin();
-
- // Returns whether the log should have a timestamp.
- bool get_log_timestamp();
-
- // Returns the format string for the log timestamp
- QString get_log_timestamp_format();
-
- // Returns whether to log IC actions.
- bool get_log_ic_actions();
-
- // Returns the username the user may have set in config.ini.
- QString get_default_username();
-
- // Returns the audio device used for the client.
- QString get_audio_output_device();
-
- // Returns whether the user would like to have custom shownames on by default.
- bool get_showname_enabled_by_default();
-
- //Returns the showname the user may have set in config.ini.
- QString get_default_showname();
-
- // Returns the list of words in callwords.ini
- QStringList get_call_words();
-
// returns all of the file's lines in a QStringList
QStringList get_list_file(VPath path);
QStringList get_list_file(QString p_file);
@@ -333,23 +184,17 @@ public:
void append_to_demofile(QString packet_string);
/**
- * @brief Reads favorite_servers.ini and returns a list of servers.
+ * @brief Reads the clients log folder and locates potential demo files to populate the demoserver list.
*
- * The demo server entry is always present at the top of the list.
+ * @return A seperated list of servernames and demo logfile filenames.
*
- * If the server list returned was to be empty (exluding the demo server entry),
- * will return a list of servers from the legacy serverlist.txt file.
+ * @details This is to remove the need of delimiters or deal with potential
+ * harmfully encoding or plattform differences. We always get a combo of servername and filename.
*
- * @return A list of servers.
- */
- QVector<server_type> read_favorite_servers();
-
- /**
- * @brief Reads serverlist.txt and returns a list of servers.
+ * Do note this function assumes all demo files have the .demo extension.
*
- * @return A list of servers.
*/
- QVector<server_type> read_legacy_favorite_servers();
+ QMultiMap<QString, QString> load_demo_logs_list() const;
// Returns the value of p_identifier in the design.ini file in p_design_path
QString read_design_ini(QString p_identifier, VPath p_design_path);
@@ -505,62 +350,11 @@ public:
// These are all casing-related settings.
// ======
- // Returns if the user has casing alerts enabled.
- bool get_casing_enabled();
-
- // Returns if the user wants to get alerts for the defence role.
- bool get_casing_defence_enabled();
-
- // Same for prosecution.
- bool get_casing_prosecution_enabled();
-
- // Same for judge.
- bool get_casing_judge_enabled();
-
- // Same for juror.
- bool get_casing_juror_enabled();
-
- // Same for steno.
- bool get_casing_steno_enabled();
-
- // Same for CM.
- bool get_casing_cm_enabled();
-
- // Get the message for the CM for casing alerts.
- QString get_casing_can_host_cases();
-
- // Get if text file logging is enabled
- bool get_text_logging_enabled();
-
- // Get if demo logging is enabled
- bool get_demo_logging_enabled();
-
- // Get the subtheme from settings
- QString get_subtheme();
-
- // Get if the theme is animated
- bool get_animated_theme();
-
- // Get the default scaling method
- QString get_default_scaling();
-
- // Get a list of custom mount paths
- QStringList get_mount_paths();
-
- // Get whether to opt out of player count metrics sent to the master server
- bool get_player_count_optout();
-
- // Get if sfx can be sent to play on idle
- bool get_sfx_on_idle();
-
- // Whether opening evidence requires a single or double click
- bool get_evidence_double_click();
-
// Currently defined subtheme
QString subtheme;
- QString default_theme = "default";
- QString current_theme = default_theme;
+ //Default is always default.
+ const QString default_theme = "default";
// The file name of the log file in base/logs.
QString log_filename;
@@ -587,10 +381,9 @@ public:
private:
const int RELEASE = 2;
const int MAJOR_VERSION = 10;
- const int MINOR_VERSION = 0;
+ const int MINOR_VERSION = 1;
QVector<server_type> server_list;
- QVector<server_type> favorite_list;
QHash<uint, QString> asset_lookup_cache;
QHash<uint, QString> dir_listing_cache;
QSet<uint> dir_listing_exist_cache;
diff --git a/include/aocaseannouncerdialog.h b/include/aocaseannouncerdialog.h
deleted file mode 100644
index 0ac8f07..0000000
--- a/include/aocaseannouncerdialog.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef AOCASEANNOUNCERDIALOG_H
-#define AOCASEANNOUNCERDIALOG_H
-
-#include "aoapplication.h"
-#include "courtroom.h"
-
-#include <QDialogButtonBox>
-#include <QtWidgets/QCheckBox>
-#include <QtWidgets/QDialog>
-#include <QtWidgets/QFormLayout>
-#include <QtWidgets/QLabel>
-#include <QtWidgets/QLineEdit>
-#include <QtWidgets/QVBoxLayout>
-
-class AOCaseAnnouncerDialog : public QDialog {
- Q_OBJECT
-
-public:
- explicit AOCaseAnnouncerDialog(QWidget *parent = nullptr,
- AOApplication *p_ao_app = nullptr,
- Courtroom *p_court = nullptr);
-
-private:
- AOApplication *ao_app;
- Courtroom *court;
-
- QDialogButtonBox *ui_announcer_buttons;
-
- QVBoxLayout *ui_vbox_layout;
- QFormLayout *ui_form_layout;
-
- QLabel *ui_case_title_label;
- QLineEdit *ui_case_title_textbox;
-
- QCheckBox *ui_defense_needed;
- QCheckBox *ui_prosecutor_needed;
- QCheckBox *ui_judge_needed;
- QCheckBox *ui_juror_needed;
- QCheckBox *ui_steno_needed;
-
-public slots:
- void ok_pressed();
- void cancel_pressed();
-};
-
-#endif // AOCASEANNOUNCERDIALOG_H
diff --git a/include/aocharbutton.h b/include/aocharbutton.h
index 8e8038f..688d52d 100644
--- a/include/aocharbutton.h
+++ b/include/aocharbutton.h
@@ -38,8 +38,12 @@ private:
AOImage *ui_selector;
protected:
- void enterEvent(QEnterEvent *e);
- void leaveEvent(QEvent *e);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ void enterEvent(QEvent *e) override;
+#else
+ void enterEvent(QEnterEvent *e) override;
+#endif
+ void leaveEvent(QEvent *e) override;
};
#endif // AOCHARBUTTON_H
diff --git a/include/aoevidencebutton.h b/include/aoevidencebutton.h
index 1898539..f0e1353 100644
--- a/include/aoevidencebutton.h
+++ b/include/aoevidencebutton.h
@@ -32,9 +32,13 @@ private:
int m_id = 0;
protected:
- void enterEvent(QEnterEvent *e);
- void leaveEvent(QEvent *e);
- void mouseDoubleClickEvent(QMouseEvent *e);
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ void enterEvent(QEvent *e) override;
+#else
+ void enterEvent(QEnterEvent *e) override;
+#endif
+ void leaveEvent(QEvent *e) override;
+ void mouseDoubleClickEvent(QMouseEvent *e) override;
/*
void dragLeaveEvent(QMouseEvent *e);
void dragEnterEvent(QMouseEvent *e);
diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h
index 35bd784..d028844 100644
--- a/include/aomusicplayer.h
+++ b/include/aomusicplayer.h
@@ -1,11 +1,5 @@
#ifndef AOMUSICPLAYER_H
#define AOMUSICPLAYER_H
-#include "file_functions.h"
-
-#include "bass.h"
-#include "bassmidi.h"
-#include "bassopus.h"
-
#include "aoapplication.h"
#include <QDebug>
@@ -24,17 +18,6 @@ public:
const int m_channelmax = 4;
- // These have to be public for the stupid sync thing
- /**
- * @brief The starting sample of the AB-Loop.
- */
- unsigned int loop_start[4] = {0, 0, 0, 0};
-
- /**
- * @brief The end sample of the AB-Loop.
- */
- unsigned int loop_end[4] = {0, 0, 0, 0};
-
QFutureWatcher<QString> music_watcher;
public slots:
@@ -46,7 +29,6 @@ private:
QWidget *m_parent;
AOApplication *ao_app;
- bool m_looping = false;
bool m_muted = false;
int m_volume[4] = {0, 0, 0, 0};
@@ -56,6 +38,16 @@ private:
// Channel 3 = extra
HSTREAM m_stream_list[4];
HSYNC loop_sync[4];
+
+ /**
+ * @brief The starting sample of the AB-Loop.
+ */
+ unsigned int loop_start[4] = {0, 0, 0, 0};
+
+ /**
+ * @brief The end sample of the AB-Loop.
+ */
+ unsigned int loop_end[4] = {0, 0, 0, 0};
};
#endif // AOMUSICPLAYER_H
diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h
deleted file mode 100644
index be305d2..0000000
--- a/include/aooptionsdialog.h
+++ /dev/null
@@ -1,273 +0,0 @@
-#ifndef AOOPTIONSDIALOG_H
-#define AOOPTIONSDIALOG_H
-
-#include "aoapplication.h"
-#include "bass.h"
-
-#include <QtCore/QVariant>
-#include <QtWidgets/QApplication>
-#include <QtWidgets/QCheckBox>
-#include <QtWidgets/QComboBox>
-#include <QtWidgets/QDialog>
-#include <QtWidgets/QDialogButtonBox>
-#include <QtWidgets/QFormLayout>
-#include <QtWidgets/QFrame>
-#include <QtWidgets/QLabel>
-#include <QtWidgets/QLineEdit>
-#include <QtWidgets/QPlainTextEdit>
-#include <QtWidgets/QPushButton>
-#include <QtWidgets/QScrollArea>
-#include <QtWidgets/QSpinBox>
-#include <QtWidgets/QTabWidget>
-#include <QtWidgets/QVBoxLayout>
-#include <QtWidgets/QWidget>
-
-#include <QDirIterator>
-#include <QListWidget>
-#include <QTextBrowser>
-#include <QTextStream>
-
-class Lobby;
-class Courtroom;
-
-class AOOptionsDialog : public QDialog {
- Q_OBJECT
-public:
- explicit AOOptionsDialog(QWidget *parent = nullptr,
- AOApplication *p_ao_app = nullptr);
-
-private:
- AOApplication *ao_app;
-
- QVBoxLayout *ui_vertical_layout;
- QTabWidget *ui_settings_tabs;
-
- QWidget *ui_gameplay_tab;
- QWidget *ui_form_layout_widget;
- QFormLayout *ui_gameplay_form;
-
- QLabel *ui_theme_label;
- QComboBox *ui_theme_combobox;
- QLabel *ui_subtheme_label;
- QComboBox *ui_subtheme_combobox;
- QPushButton *ui_theme_reload_button;
- QPushButton *ui_theme_folder_button;
- QLabel *ui_evidence_double_click_lbl;
- QCheckBox *ui_evidence_double_click_cb;
- QLabel *ui_animated_theme_lbl;
- QCheckBox *ui_animated_theme_cb;
- QFrame *ui_theme_log_divider;
- QLabel *ui_stay_time_lbl;
- QSpinBox *ui_stay_time_spinbox;
- QLabel *ui_instant_objection_lbl;
- QCheckBox *ui_instant_objection_cb;
- QLabel *ui_text_crawl_lbl;
- QSpinBox *ui_text_crawl_spinbox;
- QLabel *ui_chat_ratelimit_lbl;
- QSpinBox *ui_chat_ratelimit_spinbox;
- QFrame *ui_log_names_divider;
- QLineEdit *ui_username_textbox;
- QLabel *ui_username_lbl;
- QLabel *ui_showname_lbl;
- QCheckBox *ui_showname_cb;
- QLabel *ui_default_showname_lbl;
- QLineEdit *ui_default_showname_textbox;
- QFrame *ui_net_divider;
- QLabel *ui_ms_lbl;
- QLineEdit *ui_ms_textbox;
- QLabel *ui_discord_lbl;
- QCheckBox *ui_discord_cb;
- QLabel *ui_language_label;
- QComboBox *ui_language_combobox;
- QLabel *ui_scaling_label;
- QComboBox *ui_scaling_combobox;
-
- QLabel *ui_shake_lbl;
- QCheckBox *ui_shake_cb;
- QLabel *ui_effects_lbl;
- QCheckBox *ui_effects_cb;
- QLabel *ui_framenetwork_lbl;
- QCheckBox *ui_framenetwork_cb;
-
- QLabel *ui_colorlog_lbl;
- QCheckBox *ui_colorlog_cb;
-
- QLabel *ui_stickysounds_lbl;
- QCheckBox *ui_stickysounds_cb;
-
- QLabel *ui_stickyeffects_lbl;
- QCheckBox *ui_stickyeffects_cb;
-
- QLabel *ui_stickypres_lbl;
- QCheckBox *ui_stickypres_cb;
-
- QLabel *ui_customchat_lbl;
- QCheckBox *ui_customchat_cb;
-
- QLabel *ui_sticker_lbl;
- QCheckBox *ui_sticker_cb;
-
- QLabel *ui_continuous_lbl;
- QCheckBox *ui_continuous_cb;
-
- QLabel *ui_category_stop_lbl;
- QCheckBox *ui_category_stop_cb;
-
- QLabel *ui_sfx_on_idle_lbl;
- QCheckBox *ui_sfx_on_idle_cb;
-
- QWidget *ui_callwords_tab;
- QWidget *ui_callwords_widget;
- QVBoxLayout *ui_callwords_layout;
- QPlainTextEdit *ui_callwords_textbox;
- QLabel *ui_callwords_explain_lbl;
- QCheckBox *ui_callwords_char_textbox;
-
- QWidget *ui_audio_tab;
- QWidget *ui_audio_widget;
- QFormLayout *ui_audio_layout;
- QLabel *ui_audio_device_lbl;
- QComboBox *ui_audio_device_combobox;
- QFrame *ui_audio_volume_divider;
- QSpinBox *ui_music_volume_spinbox;
- QLabel *ui_music_volume_lbl;
- QSpinBox *ui_sfx_volume_spinbox;
- QSpinBox *ui_blips_volume_spinbox;
- QSpinBox *ui_suppress_audio_spinbox;
- QLabel *ui_sfx_volume_lbl;
- QLabel *ui_blips_volume_lbl;
- QLabel *ui_suppress_audio_lbl;
- QFrame *ui_volume_blip_divider;
- QSpinBox *ui_bliprate_spinbox;
- QLabel *ui_bliprate_lbl;
- QCheckBox *ui_blank_blips_cb;
- QLabel *ui_blank_blips_lbl;
- QLabel *ui_loopsfx_lbl;
- QCheckBox *ui_loopsfx_cb;
- QLabel *ui_objectmusic_lbl;
- QCheckBox *ui_objectmusic_cb;
- QLabel *ui_disablestreams_lbl;
- QCheckBox *ui_disablestreams_cb;
- QDialogButtonBox *ui_settings_buttons;
-
- QWidget *ui_casing_tab;
- QWidget *ui_casing_widget;
- QFormLayout *ui_casing_layout;
- QLabel *ui_casing_supported_lbl;
- QLabel *ui_casing_enabled_lbl;
- QCheckBox *ui_casing_enabled_cb;
- QLabel *ui_casing_def_lbl;
- QCheckBox *ui_casing_def_cb;
- QLabel *ui_casing_pro_lbl;
- QCheckBox *ui_casing_pro_cb;
- QLabel *ui_casing_jud_lbl;
- QCheckBox *ui_casing_jud_cb;
- QLabel *ui_casing_jur_lbl;
- QCheckBox *ui_casing_jur_cb;
- QLabel *ui_casing_steno_lbl;
- QCheckBox *ui_casing_steno_cb;
- QLabel *ui_casing_cm_lbl;
- QCheckBox *ui_casing_cm_cb;
- QLabel *ui_casing_cm_cases_lbl;
- QLineEdit *ui_casing_cm_cases_textbox;
-
- QWidget *ui_assets_tab;
- QVBoxLayout *ui_assets_tab_layout;
- QGridLayout *ui_mount_buttons_layout;
- QLabel *ui_asset_lbl;
- QListWidget *ui_mount_list;
- QPushButton *ui_mount_add;
- QPushButton *ui_mount_remove;
- QPushButton *ui_mount_up;
- QPushButton *ui_mount_down;
- QPushButton *ui_mount_clear_cache;
-
- QWidget *ui_logging_tab;
- QWidget *ui_form_logging_widget;
- QFormLayout *ui_logging_form;
-
- /**
- * Option for log direction. Supported options are downwards and wrong way.
- */
- QLabel *ui_downwards_lbl;
- QCheckBox *ui_downwards_cb;
-
- /**
- * Option for log length. Controls how many IC-log entries are kept before it autowraps.
- */
- QLabel *ui_length_lbl;
- QSpinBox *ui_length_spinbox;
-
- /**
- * Option for log newline. Controls if the IC-log contains newlines or as one consecutive string.
- */
- QLabel *ui_log_newline_lbl;
- QCheckBox *ui_log_newline_cb;
-
- /**
- * Option for log margin. Controls how many pixels are between each log entry.
- */
- QLabel *ui_log_margin_lbl;
- QSpinBox *ui_log_margin_spinbox;
-
- /**
- * Option for timestamp format. A checkmark to enable the timestamp dropdown.
- * Why does this exist? Are we Dorico now?
- */
- QLabel *ui_log_timestamp_lbl;
- QCheckBox *ui_log_timestamp_cb;
-
- /**
- * Option for timestamp format. Dropdown to select the preferred format.
- */
- QLabel *ui_log_timestamp_format_lbl;
- QComboBox *ui_log_timestamp_format_combobox;
-
- /**
- * Option for desynched IC-log and viewport. Controls if entires are appended to the IC-log before displayed in the viewport.
- */
- QLabel *ui_desync_logs_lbl;
- QCheckBox *ui_desync_logs_cb;
-
- /**
- * Option for logging IC-actions. Will add shouts, evidence or music changes to the IC-log.
- */
- QLabel *ui_log_ic_actions_lbl;
- QCheckBox *ui_log_ic_actions_cb;
-
- /**
- * Option to enable logging. If enabled client will save all messages to the log folder.
- */
- QLabel *ui_log_text_lbl;
- QCheckBox *ui_log_text_cb;
-
- /**
- * Option to enable demo logging. If enabled, client will save a demo file for replay trough the demo server.
- */
- QLabel *ui_log_demo_lbl;
- QCheckBox *ui_log_demo_cb;
-
- QWidget *ui_privacy_tab;
- QVBoxLayout *ui_privacy_layout;
- QCheckBox *ui_privacy_optout_cb;
- QFrame *ui_privacy_separator;
- QTextBrowser *ui_privacy_policy;
-
- bool asset_cache_dirty = false;
-
- bool needs_default_audiodev();
- void update_values();
-
-signals:
-
-public slots:
- void save_pressed();
- void discard_pressed();
- void button_clicked(QAbstractButton *button);
- void on_timestamp_format_edited();
- void timestamp_cb_changed(int state);
- void on_reload_theme_clicked();
- void theme_changed(int i);
-};
-
-#endif // AOOPTIONSDIALOG_H
diff --git a/include/courtroom.h b/include/courtroom.h
index d767f0a..65ef75a 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -12,7 +12,7 @@
#include "aoimage.h"
#include "aolayer.h"
#include "aomusicplayer.h"
-#include "aooptionsdialog.h"
+#include "widgets/aooptionsdialog.h"
#include "aopacket.h"
#include "aosfxplayer.h"
#include "aotextarea.h"
@@ -191,7 +191,7 @@ public:
void set_pair_list();
// sets desk and bg based on pos in chatmessage
- void set_scene(QString f_desk_mod, QString f_side);
+ void set_scene(bool show_desk, QString f_side);
// sets ui_vp_player_char according to SELF_OFFSET, only a function bc it's used with desk_mod 4 and 5
void set_self_offset(const QString& p_list);
@@ -318,9 +318,6 @@ public:
// Toggles the judge buttons, whether they should appear or not.
void show_judge_controls(bool visible);
- void announce_case(QString title, bool def, bool pro, bool jud, bool jur,
- bool steno);
-
void check_connection_received();
void start_clock(int id);
@@ -741,14 +738,12 @@ private:
AOButton *ui_reload_theme;
AOButton *ui_call_mod;
AOButton *ui_settings;
- AOButton *ui_announce_casing;
AOButton *ui_switch_area_music;
QCheckBox *ui_pre;
QCheckBox *ui_flip;
QCheckBox *ui_additive;
QCheckBox *ui_guard;
- QCheckBox *ui_casing;
QCheckBox *ui_immediate;
QCheckBox *ui_showname_enable;
@@ -852,8 +847,6 @@ public slots:
void mod_called(QString p_ip);
- void case_called(QString msg, bool def, bool pro, bool jud, bool jur,
- bool steno);
void on_reload_theme_clicked();
void update_ui_music_name();
@@ -975,7 +968,6 @@ private slots:
void on_change_character_clicked();
void on_call_mod_clicked();
void on_settings_clicked();
- void on_announce_casing_clicked();
void on_pre_clicked();
void on_flip_clicked();
@@ -1016,8 +1008,6 @@ private slots:
void on_switch_area_music_clicked();
- void on_casing_clicked();
-
void on_application_state_changed(Qt::ApplicationState state);
void ping_server();
diff --git a/include/datatypes.h b/include/datatypes.h
index 682d68a..3a82eff 100644
--- a/include/datatypes.h
+++ b/include/datatypes.h
@@ -120,6 +120,17 @@ enum EMOTE_MOD_TYPE {
PREANIM_ZOOM = 6,
};
+enum DESK_MOD_TYPE {
+ DESK_HIDE = 0,
+ DESK_SHOW,
+ DESK_EMOTE_ONLY,
+ DESK_PRE_ONLY,
+ DESK_EMOTE_ONLY_EX,
+ DESK_PRE_ONLY_EX,
+ //"EX" for "expanded"
+ //dumb, i know, but throw the first stone if you have a better idea
+};
+
enum MUSIC_EFFECT { FADE_IN = 1, FADE_OUT = 2, SYNC_POS = 4 };
#endif // DATATYPES_H
diff --git a/include/demoserver.h b/include/demoserver.h
index bb0baed..877d5cc 100644
--- a/include/demoserver.h
+++ b/include/demoserver.h
@@ -22,6 +22,8 @@ public:
int port = 27088;
int max_wait = -1;
+ void set_demo_file(QString filepath);
+
private:
void handle_packet(AOPacket *packet);
void load_demo(QString filename);
@@ -39,6 +41,7 @@ private:
QString p_path;
QTimer *timer;
int elapsed_time = 0;
+ QString filename;
private slots:
void accept_connection();
diff --git a/include/file_functions.h b/include/file_functions.h
index 8bb2e5f..31e2e16 100644
--- a/include/file_functions.h
+++ b/include/file_functions.h
@@ -4,9 +4,11 @@
#include <QDir>
#include <QFileInfo>
#include <QString>
+#include <QCoreApplication>
bool file_exists(QString file_path);
bool dir_exists(QString file_path);
bool exists(QString p_path);
+QString get_base_path();
#endif // FILE_FUNCTIONS_H
diff --git a/include/interfaces/server_dialog.h b/include/interfaces/server_dialog.h
new file mode 100644
index 0000000..63817d0
--- /dev/null
+++ b/include/interfaces/server_dialog.h
@@ -0,0 +1,21 @@
+#include <QDialog>
+#pragma once
+
+#ifndef AO_UI_FAVORITESERVERDIALOG
+#define AO_UI_FAVORITESRRVERDIALOG
+namespace AttorneyOnline {
+ namespace UI {
+ class FavoriteServerDialog : public QDialog {
+ public:
+ FavoriteServerDialog() = default;
+ ~FavoriteServerDialog() = default;
+
+ const QString DEFAULT_UI = "favorite_server_dialog.ui";
+ const int TCP_INDEX = 0;
+ private slots:
+ virtual void onSavePressed() = 0;
+ virtual void onCancelPressed() = 0;
+ };
+ } // namespace UI
+} // namespace AttorneyOnline
+#endif // AO_UI_FAVORITESERVERDIALOG
diff --git a/include/lobby.h b/include/lobby.h
index d39d7f9..e5d3576 100644
--- a/include/lobby.h
+++ b/include/lobby.h
@@ -1,22 +1,17 @@
#ifndef LOBBY_H
#define LOBBY_H
-#include "aobutton.h"
-#include "aoimage.h"
-#include "aopacket.h"
-#include "aotextarea.h"
-
-#include <QLabel>
-#include <QLineEdit>
-#include <QListWidget>
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QTextBrowser;
+class QTreeWidget;
+class QTreeWidgetItem;
+
#include <QMainWindow>
-#include <QPlainTextEdit>
-#include <QProgressBar>
-#include <QTextBrowser>
-#include <QTreeWidget>
-#include <QDebug>
-#include <QScrollBar>
-#include <QHeaderView>
+#include "networkmanager.h"
+#include "file_functions.h"
+
#ifdef ANDROID
#include <QtAndroidExtras/QtAndroid>
#endif
@@ -25,91 +20,88 @@ class AOApplication;
class Lobby : public QMainWindow {
Q_OBJECT
-
public:
- Lobby(AOApplication *p_ao_app);
+ Lobby(AOApplication *p_ao_app, NetworkManager *p_net_man = nullptr);
+ ~Lobby();
- void set_widgets();
+ void set_player_count(int players_online, int max_players);
+ void set_server_description(const QString &server_description);
void list_servers();
+ int get_selected_server();
+ int pageSelected();
+
+private:
+ AOApplication *ao_app;
+ NetworkManager *net_manager;
+
+ const QString DEFAULT_UI = "lobby.ui";
+
void list_favorites();
+ void list_demos();
void get_motd();
void check_for_updates();
- void append_chatmessage(QString f_name, QString f_message);
- void append_error(QString f_message);
- void set_player_count(int players_online, int max_players);
- void set_server_description(const QString& server_description);
- void set_stylesheet(QWidget *widget);
- void set_stylesheets();
- void set_fonts();
- void set_font(QWidget *widget, QString p_identifier);
- void set_loading_text(QString p_text);
- void show_loading_overlay() { ui_loading_background->show(); }
- void hide_loading_overlay() { ui_loading_background->hide(); }
- QString get_chatlog();
- int get_selected_server();
- void enable_connect_button();
void reset_selection();
- void set_loading_value(int p_value);
-
- bool public_servers_selected = true;
- bool doubleclicked = false;
+ int last_index = -1;
- ~Lobby();
+ enum TabPage { SERVER, FAVORITES, DEMOS };
-private:
- AOApplication *ao_app;
+ // UI-file Lobby
- AOImage *ui_background;
+ // Top Row
+ QLabel *ui_game_version_lbl;
+ QPushButton *ui_settings_button;
+ QPushButton *ui_about_button;
- AOButton *ui_public_servers;
- AOButton *ui_favorites;
+ // Server, Favs and Demo lists
+ QTabWidget *ui_connections_tabview;
- AOButton *ui_refresh;
- AOButton *ui_add_to_fav;
- AOButton *ui_remove_from_fav;
- AOButton *ui_connect;
+ QTreeWidget *ui_serverlist_tree;
+ QLineEdit *ui_serverlist_search;
- QLabel *ui_version;
- AOButton *ui_about;
+ QTreeWidget *ui_favorites_tree;
+ QLineEdit *ui_favorites_search;
- AOButton *ui_settings;
+ QTreeWidget *ui_demo_tree;
+ QLineEdit *ui_demo_search;
- QTreeWidget *ui_server_list;
- QLineEdit *ui_server_search;
+ QPushButton *ui_add_to_favorite_button;
+ QPushButton *ui_add_server_button;
+ QPushButton *ui_remove_from_favorites_button;
+ QPushButton *ui_edit_favorite_button;
+ QPushButton *ui_direct_connect_button;
+ QPushButton *ui_refresh_button;
- QLabel *ui_player_count;
- AOTextArea *ui_description;
+ // Serverinfo / MOTD Horizontal Row
+ QTextBrowser *ui_motd_text;
- AOTextArea *ui_chatbox;
+ QLabel *ui_server_player_count_lbl;
+ QTextBrowser *ui_server_description_text;
+ QPushButton *ui_connect_button;
- AOImage *ui_loading_background;
- QTextEdit *ui_loading_text;
- QProgressBar *ui_progress_bar;
- AOButton *ui_cancel;
+ // Optional Widget
+ QTextBrowser *ui_game_changelog_text;
- int last_index = -1;
+ void loadUI();
- void set_size_and_pos(QWidget *p_widget, QString p_identifier);
+ TabPage current_page = SERVER;
private slots:
- void on_public_servers_clicked();
- void on_favorites_clicked();
-
- void on_refresh_pressed();
+ void on_tab_changed(int index);
void on_refresh_released();
- void on_add_to_fav_pressed();
+ void on_direct_connect_released();
void on_add_to_fav_released();
- void on_remove_from_fav_pressed();
+ void on_add_server_to_fave_released();
+ void on_edit_favorite_released();
void on_remove_from_fav_released();
- void on_connect_pressed();
- void on_connect_released();
void on_about_clicked();
- void on_settings_clicked();
void on_server_list_clicked(QTreeWidgetItem *p_item, int column);
- void on_server_list_doubleclicked(QTreeWidgetItem *p_item, int column);
- void on_server_list_context_menu_requested(const QPoint &point);
+ void on_list_doubleclicked(QTreeWidgetItem *p_item, int column);
+ void on_favorite_tree_clicked(QTreeWidgetItem *p_item, int column);
void on_server_search_edited(QString p_text);
+ void on_demo_clicked(QTreeWidgetItem *item, int column);
+ void onReloadThemeRequested(); // Oh boy.
+ void onSettingsRequested();
};
#endif // LOBBY_H
diff --git a/include/networkmanager.h b/include/networkmanager.h
index 705fb9e..052bc9b 100644
--- a/include/networkmanager.h
+++ b/include/networkmanager.h
@@ -51,9 +51,13 @@ public:
void connect_to_server(server_type p_server);
void disconnect_from_server();
+signals:
+ void server_connected(bool state);
+
public slots:
void get_server_list(const std::function<void()> &cb);
void ship_server_packet(QString p_packet);
+ void join_to_server();
void handle_server_packet(const QString& p_data);
void request_document(MSDocumentType document_type,
diff --git a/include/options.h b/include/options.h
new file mode 100644
index 0000000..aba346c
--- /dev/null
+++ b/include/options.h
@@ -0,0 +1,290 @@
+#ifndef OPTIONS_H
+#define OPTIONS_H
+
+
+#include <QCoreApplication>
+#include <QSettings>
+#include <datatypes.h>
+
+class Options {
+private:
+ /**
+ * @brief QSettings object for config.ini
+ */
+ QSettings config;
+
+ /**
+ * @brief QSettings object for favorite_servers.ini
+ */
+ QSettings favorite;
+
+
+ void migrateCallwords();
+
+ /**
+ * @brief Constructor for options class.
+ */
+ Options();
+
+ QString m_server_subtheme;
+
+public:
+ Options(Options const &) = delete;
+ void operator=(Options const &) = delete;
+
+ static Options &getInstance()
+ {
+ static Options instance;
+ return instance;
+ }
+
+ /**
+ * @brief Migrates old configuration files to the most recent format.
+ */
+ void migrate();
+
+ // Reads the theme from config.ini and loads it into the currenttheme
+ // variable
+ QString theme() const;
+ void setTheme(QString value);
+
+ // Returns the value of oocname in config.ini
+ QString oocName() const;
+ void setOocName(QString value);
+
+ // Returns the blip rate from config.ini (once per X symbols)
+ int blipRate() const;
+ void setBlipRate(int value);
+
+ // Returns true if blank blips is enabled in config.ini and false otherwise
+ bool blankBlip() const;
+ void setBlankBlip(bool value);
+
+ // Returns true if looping sound effects are enabled in the config.ini
+ bool loopingSfx() const;
+ void setLoopingSfx(bool value);
+
+ // Returns true if stop music on objection is enabled in the config.ini
+ bool objectionStopMusic() const;
+ void setObjectionStopMusic(bool value);
+
+ // Returns true if streaming is enabled in the config.ini
+ bool streamingEnabled() const;
+ void setStreamingEnabled(bool value);
+
+ // Returns the value of defaultmusic in config.ini
+ int musicVolume() const;
+ void setMusicVolume(int value);
+
+ // Returns the value of defaultsfx in config.ini
+ int sfxVolume() const;
+ void setSfxVolume(int value);
+
+ // Returns the value of defaultblip in config.ini
+ int blipVolume() const;
+ void setBlipVolume(int value);
+
+ // Returns the value of suppressaudio in config.ini
+ int defaultSuppressAudio() const;
+ void setDefaultSupressedAudio(int value);
+
+ // Returns the value if objections interrupt and skip the message queue
+ // from the config.ini.
+ bool objectionSkipQueueEnabled() const;
+ void setObjectionSkipQueueEnabled(bool value);
+
+ // returns if log will show messages as-received, while viewport will parse
+ // according to the queue (Text Stay Time) from the config.ini
+ bool desynchronisedLogsEnabled() const;
+ void setDesynchronisedLogsEnabled(bool value);
+
+ // Returns the value of whether Discord should be enabled on startup
+ // from the config.ini.
+ bool discordEnabled() const;
+ void setDiscordEnabled(bool value);
+
+ // Returns the value of whether shaking should be enabled.
+ // from the config.ini.
+ bool shakeEnabled() const;
+ void setShakeEnabled(bool value);
+
+ // Returns the value of whether effects should be Enabled.
+ // from the config.ini.
+ bool effectsEnabled() const;
+ void setEffectsEnabled(bool value);
+
+ // Returns the value of whether frame-specific effects defined in char.ini
+ // should be sent/received over the network. from the config.ini.
+ bool networkedFrameSfxEnabled() const;
+ void setNetworkedFrameSfxEnabled(bool value);
+
+ // Returns the value of whether colored ic log should be a thing.
+ // from the config.ini.
+ bool colorLogEnabled() const;
+ void setColorLogEnabled(bool value);
+
+ // Returns the value of whether sticky sounds should be a thing.
+ // from the config.ini.
+ bool clearSoundsDropdownOnPlayEnabled() const;
+ void setClearSoundsDropdownOnPlayEnabled(bool value);
+
+ // Returns the value of whether sticky effects should be a thing.
+ // from the config.ini.
+ bool clearEffectsDropdownOnPlayEnabled() const;
+ void setClearEffectsDropdownOnPlayEnabled(bool value);
+
+ // Returns the value of whether sticky preanims should be a thing.
+ // from the config.ini.
+ bool clearPreOnPlayEnabled() const;
+ void setClearPreOnPlayEnabled(bool value);
+
+ // Returns the value of whether custom chatboxes should be a thing.
+ // from the config.ini.
+ // I am increasingly maddened by the lack of dynamic auto-generation system
+ // for settings.
+ bool customChatboxEnabled() const;
+ void setCustomChatboxEnabled(bool value);
+
+ // Returns the value of characer sticker (avatar) setting
+ bool characterStickerEnabled() const;
+ void setCharacterStickerEnabled(bool value);
+
+ // Returns the value of whether continuous playback should be used
+ // from the config.ini.
+ bool continuousPlaybackEnabled() const;
+ void setContinuousPlaybackEnabled(bool value);
+
+ // Returns the value of whether stopping music by double clicking category
+ // should be used from the config.ini.
+ bool stopMusicOnCategoryEnabled() const;
+ void setStopMusicOnCategoryEnabled(bool value);
+
+ // Returns the value of the maximum amount of lines the IC chatlog
+ // may contain, from config.ini.
+ int maxLogSize() const;
+ void setMaxLogSize(int value);
+
+ // Current wait time between messages for the queue system
+ int textStayTime() const;
+ void setTextStayTime(int value);
+
+ // Returns the letter display speed during text crawl in in-character messages
+ int textCrawlSpeed() const;
+ void setTextCrawlSpeed(int value);
+
+ // Returns Minimum amount of time (in miliseconds) that must pass before the
+ // next Enter key press will send your IC message. (new behaviour)
+ int chatRateLimit() const;
+ void setChatRateLimit(int value);
+
+ // Returns whether the log should go upwards (new behaviour)
+ // or downwards (vanilla behaviour).
+ bool logDirectionDownwards() const;
+ void setLogDirectionDownwards(bool value);
+
+ // Returns whether the log should separate name from text via newline or :
+ bool logNewline() const;
+ void setLogNewline(bool value);
+
+ // Get spacing between IC log entries.
+ int logMargin() const;
+ void setLogMargin(int value);
+
+ // Returns whether the log should have a timestamp.
+ bool logTimestampEnabled() const;
+ void setLogTimestampEnabled(bool value);
+
+ // Returns the format string for the log timestamp
+ QString logTimestampFormat() const;
+ void setLogTimestampFormat(QString value);
+
+ // Returns whether to log IC actions.
+ bool logIcActions() const;
+ void setLogIcActions(bool value);
+
+ // Returns the username the user may have set in config.ini.
+ QString username() const;
+ void setUsername(QString value);
+
+ // Returns the audio device used for the client.
+ QString audioOutputDevice() const;
+ void setAudioOutputDevice(QString value);
+
+ // Returns whether the user would like to have custom shownames on by default.
+ bool customShownameEnabled() const;
+ void setCustomShownameEnabled(bool value);
+
+ // Returns the showname the user may have set in config.ini.
+ QString shownameOnJoin() const;
+ void setShownameOnJoin(QString value);
+
+ // Get if text file logging is Enabled
+ bool logToTextFileEnabled() const;
+ void setLogToTextFileEnabled(bool value);
+
+ // Get if demo logging is Enabled
+ bool logToDemoFileEnabled() const;
+ void setLogToDemoFileEnabled(bool value);
+
+ // Get the subtheme from settings
+ QString subTheme() const;
+ QString settingsSubTheme() const;
+ void setSettingsSubTheme(QString value);
+
+ // Returns the server-
+ QString serverSubTheme() const;
+ void setServerSubTheme(QString value);
+
+ // Get if the theme is animated
+ bool animatedThemeEnabled() const;
+ void setAnimatedThemeEnabled(bool value);
+
+ // Get the default scaling method
+ QString defaultScalingMode() const;
+ void setDefaultScalingMode(QString value);
+
+ // Get a list of custom mount paths
+ QStringList mountPaths() const;
+ void setMountPaths(QStringList value);
+
+ // Get whether to opt out of player count metrics sent to the master server
+ bool playerCountOptout() const;
+ void setPlayerCountOptout(bool value);
+
+ // Get if sfx can be sent to play on idle
+ bool playSelectedSFXOnIdle() const;
+ void setPlaySelectedSFXOnIdle(bool value);
+
+ // Whether opening evidence requires a single or double click
+ bool evidenceDoubleClickEdit() const;
+ void setEvidenceDoubleClickEdit(bool value);
+
+ // Supplies an alternative masterserver URL
+ QString alternativeMasterserver() const;
+ void setAlternativeMasterserver(QString value);
+
+ // Language the client loads on start.
+ QString language() const;
+ void setLanguage(QString value);
+
+ // Callwords notify the user when the word/words are used in a game message.
+ QStringList callwords() const;
+ void setCallwords(QStringList value);
+
+ // Clears the configuration file. Essentially restoring it to default.
+ void clearConfig();
+
+ // Loads the favorite servers
+ QVector<server_type> favorites();
+ void setFavorites(QVector<server_type> value);
+
+ // Interactions with favorite servers
+ void removeFavorite(int index);
+ void addFavorite(server_type server);
+ void updateFavorite(server_type server, int index);
+
+ // Theming Nonesense!
+ QString getUIAsset(QString f_asset_name);
+};
+
+#endif // OPTIONS_H
diff --git a/include/widgets/add_server_dialog.h b/include/widgets/add_server_dialog.h
new file mode 100644
index 0000000..db999bf
--- /dev/null
+++ b/include/widgets/add_server_dialog.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#ifndef ADD_SERVER_DIALOG_H
+#define ADD_SERVER_DIALOG_H
+
+#include "interfaces/server_dialog.h"
+
+class QComboBox;
+class QDialogButton;
+class QDialogButtonBox;
+class QLabel;
+class QLineEdit;
+class QPlainTextEdit;
+class QPushButton;
+class QSpinBox;
+
+class AddServerDialog : public AttorneyOnline::UI::FavoriteServerDialog {
+ Q_OBJECT
+public:
+ AddServerDialog();
+ ~AddServerDialog() = default;
+
+private:
+ QWidget *ui_widget;
+
+ QLineEdit *ui_server_display_name_edit;
+ QLineEdit *ui_server_hostname_edit;
+ QSpinBox *ui_server_port_box;
+ QComboBox *ui_server_protocol_box;
+ QPlainTextEdit *ui_server_description_edit;
+ QDialogButtonBox *ui_server_dialog_button;
+
+ // Legacy Server UI
+ QLabel *ui_server_legacy_lbl;
+ QLineEdit *ui_server_legacy_edit;
+ QPushButton *ui_server_legacy_load_button;
+
+private slots:
+ void onSavePressed() override;
+ void onCancelPressed() override;
+ void parseLegacyServerEntry();
+};
+
+#endif // ADD_SERVER_DIALOG_H
diff --git a/include/widgets/aooptionsdialog.h b/include/widgets/aooptionsdialog.h
new file mode 100644
index 0000000..dcc66c1
--- /dev/null
+++ b/include/widgets/aooptionsdialog.h
@@ -0,0 +1,159 @@
+#ifndef AOOPTIONSDIALOG_H
+#define AOOPTIONSDIALOG_H
+
+#include "options.h"
+
+#include <QtCore/QVariant>
+#include <QtWidgets/QApplication>
+
+class QCheckBox;
+class QComboBox;
+class QDialogButtonBox;
+class QLineEdit;
+class QPlainTextEdit;
+class QScrollArea;
+class QSpinBox;
+class QTabWidget;
+class QLabel;
+class QAbstractButton;
+
+
+#include <QtWidgets/QDialog>
+#include <QDirIterator>
+#include <QListWidget>
+#include <QTextBrowser>
+#include <QTextStream>
+
+class AOApplication;
+
+struct OptionEntry {
+ std::function<void()> load;
+ std::function<void()> save;
+};
+
+class AOOptionsDialog : public QDialog {
+ Q_OBJECT
+public:
+ explicit AOOptionsDialog(QDialog *parent = nullptr,
+ AOApplication *p_ao_app = nullptr);
+
+private:
+ AOApplication *ao_app;
+
+ // Dialog interaction buttons. Save/Discard/Restore Defaults
+ QDialogButtonBox *ui_settings_buttons;
+
+ // The gameplay tab
+ QWidget *ui_settings_widget;
+ QComboBox *ui_theme_combobox;
+ QComboBox *ui_subtheme_combobox;
+ QPushButton *ui_theme_reload_button;
+ QPushButton *ui_theme_folder_button;
+ QCheckBox *ui_evidence_double_click_cb;
+ QCheckBox *ui_animated_theme_cb;
+ QSpinBox *ui_stay_time_spinbox;
+ QCheckBox *ui_instant_objection_cb;
+ QSpinBox *ui_text_crawl_spinbox;
+ QSpinBox *ui_chat_ratelimit_spinbox;
+ QFrame *ui_log_names_divider;
+ QLineEdit *ui_username_textbox;
+ QCheckBox *ui_showname_cb;
+ QLineEdit *ui_default_showname_textbox;
+ QFrame *ui_net_divider;
+ QLineEdit *ui_ms_textbox;
+ QCheckBox *ui_discord_cb;
+ QLabel *ui_language_label;
+ QComboBox *ui_language_combobox;
+ QLabel *ui_scaling_label;
+ QComboBox *ui_scaling_combobox;
+ QCheckBox *ui_shake_cb;
+ QCheckBox *ui_effects_cb;
+ QCheckBox *ui_framenetwork_cb;
+ QCheckBox *ui_colorlog_cb;
+ QCheckBox *ui_stickysounds_cb;
+ QCheckBox *ui_stickyeffects_cb;
+ QCheckBox *ui_stickypres_cb;
+ QCheckBox *ui_customchat_cb;
+ QCheckBox *ui_sticker_cb;
+ QCheckBox *ui_continuous_cb;
+ QCheckBox *ui_category_stop_cb;
+ QCheckBox *ui_sfx_on_idle_cb;
+
+ // The callwords tab
+ QPlainTextEdit *ui_callwords_textbox;
+ QCheckBox *ui_callwords_char_textbox;
+
+ // The audio tab
+ QWidget *ui_audio_tab;
+ QWidget *ui_audio_widget;
+ QComboBox *ui_audio_device_combobox;
+ QSpinBox *ui_suppress_audio_spinbox;
+ QFrame *ui_volume_blip_divider;
+ QSpinBox *ui_bliprate_spinbox;
+ QCheckBox *ui_blank_blips_cb;
+ QCheckBox *ui_loopsfx_cb;
+ QCheckBox *ui_objectmusic_cb;
+ QCheckBox *ui_disablestreams_cb;
+
+ // The asset tab
+ QListWidget *ui_mount_list;
+ QPushButton *ui_mount_add;
+ QPushButton *ui_mount_remove;
+ QPushButton *ui_mount_up;
+ QPushButton *ui_mount_down;
+ QPushButton *ui_mount_clear_cache;
+
+ // The logging tab
+ QCheckBox *ui_downwards_cb;
+ QSpinBox *ui_length_spinbox;
+ QCheckBox *ui_log_newline_cb;
+ QSpinBox *ui_log_margin_spinbox;
+ QLabel *ui_log_timestamp_format_lbl;
+ QCheckBox *ui_log_timestamp_cb;
+ QComboBox *ui_log_timestamp_format_combobox;
+ QCheckBox *ui_desync_logs_cb;
+ QCheckBox *ui_log_ic_actions_cb;
+ QCheckBox *ui_log_text_cb;
+ QCheckBox *ui_log_demo_cb;
+
+ /**
+ * Allows the AO2 master server hoster to go broke.
+ */
+ QWidget *ui_privacy_tab;
+ QCheckBox *ui_privacy_optout_cb;
+ QFrame *ui_privacy_separator;
+ QTextBrowser *ui_privacy_policy;
+
+ bool asset_cache_dirty = false;
+
+ bool needsDefaultAudioDevice();
+ void populateAudioDevices();
+ void updateValues();
+
+ QVector<OptionEntry> optionEntries;
+
+ template <typename T, typename V>
+ void setWidgetData(T *widget, const V &value);
+
+ template <typename T, typename V> V widgetData(T *widget) const;
+
+ template <typename T, typename V>
+ void registerOption(const QString &widgetName, V (Options::*getter)() const,
+ void (Options::*setter)(V));
+
+signals:
+ void reloadThemeRequest();
+
+private slots:
+ void savePressed();
+ void discardPressed();
+ void buttonClicked(QAbstractButton *button);
+ void onTimestampFormatEdited();
+ void timestampCbChanged(int state);
+ void onReloadThemeClicked();
+ void themeChanged(int i);
+ void setupUI();
+
+};
+
+#endif // AOOPTIONSDIALOG_H
diff --git a/include/widgets/direct_connect_dialog.h b/include/widgets/direct_connect_dialog.h
new file mode 100644
index 0000000..9317524
--- /dev/null
+++ b/include/widgets/direct_connect_dialog.h
@@ -0,0 +1,46 @@
+#ifndef DIRECT_CONNECT_DIALOG_H
+#define DIRECT_CONNECT_DIALOG_H
+
+#include <QDialog>
+#include <QTimer>
+#include <QRegularExpression>
+
+class QLabel;
+class QSpinBox;
+class QLineEdit;
+class QPushButton;
+class QComboBox;
+class QLabel;
+class NetworkManager;
+
+class DirectConnectDialog : public QDialog {
+ Q_OBJECT
+public:
+ DirectConnectDialog(NetworkManager* p_net_manager);
+ ~DirectConnectDialog() = default;
+
+private slots:
+ void onConnectPressed();
+ void onServerConnected();
+ void onConnectTimeout();
+
+private:
+ NetworkManager* net_manager;
+
+ QLineEdit* ui_direct_hostname_edit;
+
+ QLabel* ui_direct_connection_status_lbl;
+ QPushButton* ui_direct_connect_button;
+ QPushButton* ui_direct_cancel_button;
+
+ QWidget* ui_widget;
+ QTimer connect_timeout;
+
+ const int TCP_INDEX = 0;
+ const QRegularExpression SCHEME_PATTERN{"^\\w+://.+$"};
+ const int CONNECT_TIMEOUT = 5 * 1000;
+ const QString DEFAULT_UI = "direct_connect_dialog.ui";;
+
+};
+
+#endif // DIRECT_CONNECT_DIALOG_H
diff --git a/include/widgets/edit_server_dialog.h b/include/widgets/edit_server_dialog.h
new file mode 100644
index 0000000..3c4595e
--- /dev/null
+++ b/include/widgets/edit_server_dialog.h
@@ -0,0 +1,46 @@
+#pragma once
+
+#ifndef EDIT_SERVER_DIALOG_H
+#define EDIT_SERVER_DIALOG_H
+
+#include "interfaces/server_dialog.h"
+
+class QPushButton;
+class QDialogButton;
+class QLabel;
+class QLineEdit;
+class QComboBox;
+class QSpinBox;
+class QPlainTextEdit;
+class QDialogButtonBox;
+
+class EditServerDialog : public AttorneyOnline::UI::FavoriteServerDialog {
+ Q_OBJECT
+public:
+ EditServerDialog(int index);
+ ~EditServerDialog() = default;
+
+private:
+ QWidget *ui_widget;
+
+ QLineEdit *ui_server_display_name_edit;
+ QLineEdit *ui_server_hostname_edit;
+ QSpinBox *ui_server_port_box;
+ QComboBox *ui_server_protocol_box;
+ QPlainTextEdit *ui_server_description_edit;
+ QDialogButtonBox *ui_server_dialog_button;
+
+ // Legacy Server UI
+ QLabel *ui_server_legacy_lbl;
+ QLineEdit *ui_server_legacy_edit;
+ QPushButton *ui_server_legacy_load_button;
+
+ int index;
+ void loadEntry();
+
+private slots:
+ void onSavePressed() override;
+ void onCancelPressed() override;
+};
+
+#endif // EDIT_SERVER_DIALOG_H