Skip to content

Commit

Permalink
Utilise .ui file to create settings dialog (#858)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: stonedDiscord <[email protected]>

* 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 <[email protected]>
Co-authored-by: stonedDiscord <[email protected]>
Co-authored-by: oldmud0 <[email protected]>
Co-authored-by: Crystalwarrior <[email protected]>
  • Loading branch information
5 people authored Oct 30, 2022
1 parent f55cbe5 commit 5f115d2
Show file tree
Hide file tree
Showing 28 changed files with 4,361 additions and 3,930 deletions.
11 changes: 7 additions & 4 deletions Attorney_Online.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
QT += core gui widgets network websockets
QT += core gui widgets network websockets uitools

TARGET = Attorney_Online
TEMPLATE = app
Expand All @@ -10,8 +10,10 @@ DESTDIR = $$PWD/bin
OBJECTS_DIR = $$PWD/build
MOC_DIR = $$PWD/build

SOURCES += $$files($$PWD/src/*.cpp)
HEADERS += $$files($$PWD/include/*.h)
SOURCES += $$files($$PWD/src/*.cpp, true)
HEADERS += $$files($$PWD/include/*.h, true)

FORMS += $$files($$PWD/resource/ui/*.ui)

LIBS += -L$$PWD/lib
QMAKE_LFLAGS += -Wl,-rpath,"'\$$ORIGIN/lib'"
Expand Down Expand Up @@ -57,7 +59,8 @@ TRANSLATIONS = resource/translations/ao_en.ts \
resource/translations/ao_es.ts \
resource/translations/ao_pt.ts \
resource/translations/ao_pl.ts \
resource/translations/ao_it.ts
resource/translations/ao_it.ts \
ressource/ui/

win32:RC_ICONS = resource/logo_ao2.ico
macx:ICON = resource/logo_ao2.icns
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Attorney Online

![CI build](https://github.com/AttorneyOnline/AO2-Client/actions/workflows/build.yml/badge.svg?event=push) ![license](https://img.shields.io/github/license/AttorneyOnline/AO2-Client?color=blue) ![contributors](https://img.shields.io/github/contributors/AttorneyOnline/AO2-Client)<br>

[Attorney Online](https://aceattorneyonline.com) is an online version of the world-renowned courtroom drama simulator that allows you to create and play out cases in an off-the-cuff format.

**[Refer to the docs](https://github.com/AttorneyOnline/docs/blob/master/docs/index.md) for more information.**
Expand Down
201 changes: 4 additions & 197 deletions include/aoapplication.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef AOAPPLICATION_H
#define AOAPPLICATION_H

#include "widgets/aooptionsdialog.h"
#include "aopacket.h"
#include "datatypes.h"
#include "demoserver.h"
Expand Down Expand Up @@ -35,6 +36,7 @@
class NetworkManager;
class Lobby;
class Courtroom;
class Options;

class VPath : QString {
using QString::QString;
Expand Down Expand Up @@ -142,9 +144,6 @@ class AOApplication : public QApplication {
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();

Expand Down Expand Up @@ -174,147 +173,6 @@ class AOApplication : public QApplication {
////// 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);
Expand Down Expand Up @@ -506,62 +364,11 @@ class AOApplication : public QApplication {
// 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;
Expand Down
Loading

0 comments on commit 5f115d2

Please sign in to comment.