From faac191f0b9e99b82614ed3959ec5c67f56a1fc3 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 17 Apr 2020 21:48:34 -0500 Subject: [PATCH 01/30] Mega-merge of CR fork CR likely stands for "CentsRaidensnake." Like the Case Cafe mega-merge before it, this was not a clean merge, and it had to be split up into two parts: the actual changes, and the attempt it made to reformat the entire code via clang-format. This branch had a complicated set of changes that would be difficult to describe in this commit message. It would be better described in a proper changelog. --- .gitignore | 2 + include/aoapplication.h | 21 +- include/aomovie.h | 6 +- include/aooptionsdialog.h | 21 +- include/aoscene.h | 2 +- include/aotextarea.h | 3 +- include/chatlogpiece.h | 9 +- include/courtroom.h | 80 ++- include/lobby.h | 2 +- src/aoapplication.cpp | 1 + src/aocharmovie.cpp | 3 - src/aomovie.cpp | 105 +-- src/aooptionsdialog.cpp | 1067 +++++++++++++++++------------- src/aoscene.cpp | 71 +- src/aotextarea.cpp | 10 +- src/charselect.cpp | 133 ++-- src/chatlogpiece.cpp | 11 +- src/courtroom.cpp | 1234 +++++++++++++++++++++++------------ src/lobby.cpp | 13 +- src/packet_distribution.cpp | 103 ++- src/path_functions.cpp | 1 + src/text_file_functions.cpp | 95 ++- 22 files changed, 1846 insertions(+), 1147 deletions(-) diff --git a/.gitignore b/.gitignore index 8530700..3f8b3ae 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ discord/ moc* /Attorney_Online_CC_resource.rc /attorney_online_cc_plugin_import.cpp + +*.autosave diff --git a/include/aoapplication.h b/include/aoapplication.h index 03aa01a..3d4cc0e 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -182,10 +182,16 @@ public: // from the config.ini. bool is_shakeandflash_enabled(); + // Returns whether evidence should be maintained ic + bool is_keepevi_enabled(); + // Returns the value of the maximum amount of lines the IC chatlog // may contain, from config.ini. int get_max_log_size(); + // Gets the punctuation delay modifier + int get_pundelay(); + // Returns whether the log should go upwards (new behaviour) // or downwards (vanilla behaviour). bool get_log_goes_downwards(); @@ -238,7 +244,11 @@ public: //Figure out if we can opus this or if we should fall back to wav QString get_sfx_suffix(QString sound_to_check); - // Can we use APNG for this? If not, fall back to a gif. + // figure out if we can find what prefix this song uses + QString get_music_prefix(QString song_to_check); + + // Can we use APNG for this? If not, WEBP? if not, GIF? If not, fall back to a + // gif. QString get_image_suffix(QString path_to_check); //Returns the value of p_search_line within target_tag and terminator_tag @@ -341,6 +351,15 @@ public: // Get the message for the CM for casing alerts. QString get_casing_can_host_cases(); + // Get if html for ic log is enabled + bool get_colored_iclog_enabled(); + + // Get if ic log mirror is enabled + bool get_iclmir_enabled(); + + // Get if only inline coloring should be shown in log + bool colorlog_restricted_enabled(); + private: const int RELEASE = 2; const int MAJOR_VERSION = 7; diff --git a/include/aomovie.h b/include/aomovie.h index 1f278bf..7ffad25 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -15,13 +15,16 @@ public: AOMovie(QWidget *p_parent, AOApplication *p_ao_app); void set_play_once(bool p_play_once); - void play(QString p_gif, QString p_char = "", QString p_custom_theme = ""); + void start_timer(int delay); + void play(QString p_gif, QString p_char = "", QString p_custom_theme = "", + int default_duration = 0); void combo_resize(int w, int h); void stop(); private: QMovie *m_movie; AOApplication *ao_app; + QTimer *timer; bool play_once = true; signals: @@ -29,6 +32,7 @@ signals: private slots: void frame_change(int n_frame); + void timer_done(); }; #endif // AOMOVIE_H diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 233d079..90d3547 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -51,6 +51,8 @@ private: QCheckBox *ui_downwards_cb; QLabel *ui_length_lbl; QSpinBox *ui_length_spinbox; + QLabel *ui_pun_delay; + QSpinBox *ui_pun_delay_spinbox; QFrame *ui_log_names_divider; QLineEdit *ui_username_textbox; QLabel *ui_username_lbl; @@ -66,6 +68,12 @@ private: QLabel *ui_language_label; QComboBox *ui_language_combobox; + QLabel *ui_keepevi_lbl; + QCheckBox *ui_keepevi_cb; + + QLabel *ui_keepcobj_lbl; + QCheckBox *ui_keepcobj_cb; + QWidget *ui_callwords_tab; QWidget *ui_callwords_widget; QVBoxLayout *ui_callwords_layout; @@ -119,7 +127,18 @@ private: QLabel *ui_casing_cm_cases_lbl; QLineEdit *ui_casing_cm_cases_textbox; - bool needs_default_audiodev(); + QWidget *ui_other_tab; + QWidget *ui_other_widget; + QFormLayout *ui_other_layout; + QLabel *ui_other_fancy_icl_enabled_lb; + QCheckBox *ui_other_fancy_icl_enabled_cb; + QLabel *ui_other_mirror_icl_enabled_lb; + QCheckBox *ui_other_mirror_icl_enabled_cb; + + QLabel *ui_other_fancy_icl_limit_lb; + QCheckBox *ui_other_fancy_icl_limit_cb; + + bool needs_default_audiodev(); signals: diff --git a/include/aoscene.h b/include/aoscene.h index b58c0fd..29a44b0 100644 --- a/include/aoscene.h +++ b/include/aoscene.h @@ -21,7 +21,7 @@ private: QWidget *m_parent; QMovie *m_movie; AOApplication *ao_app; - + QString last_image; }; #endif // AOSCENE_H diff --git a/include/aotextarea.h b/include/aotextarea.h index d44596b..ae28564 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -12,7 +12,8 @@ class AOTextArea : public QTextBrowser public: AOTextArea(QWidget *p_parent = nullptr); - void append_chatmessage(QString p_name, QString p_message, QString p_colour); + void append_chatmessage(QString p_name, QString p_message, QString p_colour, + bool song); void append_error(QString p_message); private: diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index 34c5926..945a7bc 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -8,15 +8,17 @@ class chatlogpiece { public: chatlogpiece(); - chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song); - chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime); - + chatlogpiece(QString p_name, QString p_showname, QString p_message, + bool p_song, int color); + chatlogpiece(QString p_name, QString p_showname, QString p_message, + bool p_song, int color, QDateTime p_datetime); QString get_name(); QString get_showname(); QString get_message(); bool get_is_song(); QDateTime get_datetime(); QString get_datetime_as_string(); + int get_chat_color(); QString get_full(); @@ -26,6 +28,7 @@ private: QString message; QDateTime datetime; bool is_song; + int color; }; #endif // CHATLOGPIECE_H diff --git a/include/courtroom.h b/include/courtroom.h index 74374c9..26380aa 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -223,15 +223,18 @@ public: //This function filters out the common CC inline text trickery, for appending to //the IC chatlog. - QString filter_ic_text(QString p_text); + QString filter_ic_text(QString p_text, bool skip_filter, int chat_color); //adds text to the IC chatlog. p_name first as bold then p_text then a newlin //this function keeps the chatlog scrolled to the top unless there's text selected // or the user isn't already scrolled to the top - void append_ic_text(QString p_text, QString p_name = "", bool is_songchange = false); + void append_ic_text(QString p_text, QString p_name = "", + bool is_songchange = false, bool force_filter = false, + bool skip_filter = false, int chat_color = 0); - //prints who played the song to IC chat and plays said song(if found on local filesystem) - //takes in a list where the first element is the song name and the second is the char id of who played it + // prints who played the song to IC chat and plays said song(if found on local + // filesystem) takes in a list where the first element is the song name and + // the second is the char id of who played it void handle_song(QStringList *p_contents); void play_preanim(bool noninterrupting); @@ -251,6 +254,7 @@ public: void check_connection_received(); void doScreenShake(); void doRealization(); + void refresh_iclog(bool skiplast); ~Courtroom(); @@ -331,6 +335,8 @@ private: bool rainbow_appended = false; bool blank_blip = false; + // The cursor to write with in mirror mode + QTextCursor *mirror_cursor; // Used for getting the current maximum blocks allowed in the IC chatlog. int log_maximum_blocks = 0; @@ -346,28 +352,27 @@ private: //keeps track of how long realization is visible(it's just a white square and should be visible less than a second) QTimer *realization_timer; - //times how long the blinking testimony should be shown(green one in the corner) - QTimer *testimony_show_timer; - //times how long the blinking testimony should be hidden - QTimer *testimony_hide_timer; - //every time point in char.inis times this equals the final time const int time_mod = 40; + // the amount of time non-animated objection/hold it/takethat images stay + // onscreen for in ms + const int shout_stay_time = 724; + + // the amount of time non-animated guilty/not guilty images stay onscreen for + // in ms + const int verdict_stay_time = 3000; + + // the amount of time non-animated witness testimony/cross-examination images + // stay onscreen for in ms + const int wtce_stay_time = 1500; + static const int chatmessage_size = 28; QString m_chatmessage[chatmessage_size]; bool chatmessage_is_empty = false; QString previous_ic_message = ""; - bool testimony_in_progress = false; - - //in milliseconds - const int testimony_show_time = 1500; - - //in milliseconds - const int testimony_hide_time = 500; - //char id, muted or not QMap mute_map; @@ -381,10 +386,21 @@ private: //state of text ticking, 0 = not yet ticking, 1 = ticking in progress, 2 = ticking done int text_state = 2; - //character id, which index of the char_list the player is + // characters we consider punctuation + const QString punctuation_chars = ".,?!:;"; + + // amount by which we multiply the delay when we parse punctuation chars + int punctuation_modifier = 2; + + // character id, which index of the char_list the player is int m_cid = -1; + // cid and this may differ in cases of ini-editing + + QString char_name = ""; int objection_state = 0; + bool keep_custom_objection = false; + QString objection_custom = ""; int realization_state = 0; int screenshake_state = 0; int text_color = 0; @@ -429,6 +445,8 @@ private: //whether the ooc chat is server or master chat, true is server bool server_ooc = true; + // Is AFK enabled + bool isafk = false; QString current_background = "default"; AOMusicPlayer *music_player; @@ -454,10 +472,17 @@ private: AOImage *ui_vp_chatbox; QLabel *ui_vp_showname; QTextEdit *ui_vp_message; - AOImage *ui_vp_testimony; - AOImage *ui_vp_realization; + AOMovie *ui_vp_realization; + AOMovie *ui_vp_testimony; AOMovie *ui_vp_wtce; AOMovie *ui_vp_objection; + void realization_done(); + + bool colorf_iclog = false; + bool mirror_iclog = false; + bool colorf_limit = false; + + bool keep_evidence_display = false; QTextEdit *ui_ic_chatlog; @@ -466,7 +491,7 @@ private: QListWidget *ui_mute_list; QListWidget *ui_area_list; - QListWidget *ui_music_list; + QTreeWidget *ui_music_list; AOButton *ui_pair_button; QListWidget *ui_pair_list; @@ -480,6 +505,8 @@ private: //QLineEdit *ui_area_password; QLineEdit *ui_music_search; + QString music_search_par = ""; + QString area_search_par = ""; QWidget *ui_emotes; QVector ui_emote_list; @@ -527,6 +554,8 @@ private: AOButton *ui_screenshake; AOButton *ui_mute; + QMenu *custom_obj_menu; + AOButton *ui_defense_plus; AOButton *ui_defense_minus; @@ -589,11 +618,6 @@ public slots: void objection_done(); void preanim_done(); - void realization_done(); - - void show_testimony(); - void hide_testimony(); - void mod_called(QString p_ip); void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno, bool witness); @@ -611,8 +635,9 @@ private slots: void on_ooc_return_pressed(); + void on_music_search_keypr(); void on_music_search_edited(QString p_text); - void on_music_list_double_clicked(QModelIndex p_model); + void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); void on_area_list_double_clicked(QModelIndex p_model); void select_emote(int p_id); @@ -641,6 +666,7 @@ private slots: void on_objection_clicked(); void on_take_that_clicked(); void on_custom_objection_clicked(); + void ShowContextMenu(const QPoint &pos); void on_realization_clicked(); void on_screenshake_clicked(); diff --git a/include/lobby.h b/include/lobby.h index d32debe..0dca3d6 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -38,7 +38,7 @@ public: QString get_chatlog(); int get_selected_server(); void enable_connect_button(); - + void check_update(); void set_loading_value(int p_value); bool public_servers_selected = true; diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 6213acd..8546566 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -135,6 +135,7 @@ void AOApplication::server_disconnected() { if (courtroom_constructed) { + beep(); call_notice(tr("Disconnected from server.")); construct_lobby(); destruct_courtroom(); diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index ca0d152..f0dad42 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -154,9 +154,6 @@ void AOCharMovie::sfx_two_network_boogaloo() void AOCharMovie::movie_ticker() { - if(apng){ - ticker->start(m_movie->nextFrameDelay()); - } if(m_movie->currentFrameNumber() == m_movie->frameCount() - 1) { delete m_movie; diff --git a/src/aomovie.cpp b/src/aomovie.cpp index edf5bdb..bb8e53d 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -1,7 +1,7 @@ #include "aomovie.h" -#include "file_functions.h" #include "courtroom.h" +#include "file_functions.h" #include "misc_functions.h" AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) @@ -11,55 +11,80 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) m_movie = new QMovie(); this->setMovie(m_movie); - + timer = new QTimer(this); + timer->setTimerType(Qt::PreciseTimer); + timer->setSingleShot(true); connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(timer, SIGNAL(timeout()), this, SLOT(timer_done())); } 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) +void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme, + int duration) { + m_movie->stop(); + // this->timer_done(); + QString shout_path = p_gif; + QList pathlist; - QString gif_path; - - QString custom_path; - if (p_gif == "custom") - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); + if (ao_app->get_character_path(p_char, p_gif) + .contains( + "custom_objections")) // checks if the file is located within the + // folder of custom objections + pathlist << ao_app->get_character_path( + p_char, + p_gif); // get_image_suffix is unecessery as it is already given. + else if (p_gif == "custom") + pathlist << ao_app->get_image_suffix( + ao_app->get_character_path(p_char, p_gif)); else - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); + pathlist << ao_app->get_image_suffix( + ao_app->get_character_path(p_char, p_gif + "_bubble")); - QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble.gif"; - QString custom_theme_path = ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif"); + QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + + p_gif + "_bubble.gif"; + QString custom_theme_path = + ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif"); QString theme_path = ao_app->get_theme_path(p_gif + ".gif"); QString default_theme_path = ao_app->get_default_theme_path(p_gif + ".gif"); QString placeholder_path = ao_app->get_theme_path("placeholder.gif"); - QString default_placeholder_path = ao_app->get_default_theme_path("placeholder.gif"); + QString default_placeholder_path = + ao_app->get_default_theme_path("placeholder.gif"); - if (file_exists(custom_path)) - gif_path = custom_path; - else if (file_exists(misc_path)) - gif_path = misc_path; - else if (file_exists(custom_theme_path)) - gif_path = custom_theme_path; - else if (file_exists(theme_path)) - gif_path = theme_path; - else if (file_exists(default_theme_path)) - gif_path = default_theme_path; - else if (file_exists(placeholder_path)) - gif_path = placeholder_path; - else if (file_exists(default_placeholder_path)) - gif_path = default_placeholder_path; - else - gif_path = ""; + pathlist << ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + + p_custom_theme + "/" + p_gif + "_bubble") + << // Misc path + ao_app->get_image_suffix( + ao_app->get_custom_theme_path(p_custom_theme, p_gif)) + << // Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)) << // Theme path + ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif)) + << // Default theme path + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")) + << // Placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path( + "placeholder")); // Default placeholder path - m_movie->setFileName(gif_path); + for (QString path : pathlist) { + if (file_exists(path)) { + shout_path = path; + break; + } + } + m_movie->setFileName(shout_path); + if (m_movie->loopCount() == 0) + play_once = true; this->show(); m_movie->start(); + if (m_movie->frameCount() == 0 && duration > 0) + timer->start(duration); } void AOMovie::stop() @@ -70,16 +95,20 @@ void AOMovie::stop() void AOMovie::frame_change(int n_frame) { - if (n_frame == (m_movie->frameCount() - 1) && play_once) - { - //we need this or else the last frame wont show - delay(m_movie->nextFrameDelay()); + // If it's a "static movie" (only one frame - png image), we can't change + // frames - ignore this function (use timer instead). If the frame didn't + // reach the last frame or the movie is continuous, don't stop the movie. + if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || + !play_once) + return; + // we need this or else the last frame wont show + timer->start(m_movie->nextFrameDelay()); +} - this->stop(); - - //signal connected to courtroom object, let it figure out what to do - done(); - } +void AOMovie::timer_done() +{ + this->stop(); + done(); } void AOMovie::combo_resize(int w, int h) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 55f7583..3be8466 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -1,596 +1,731 @@ #include "aooptionsdialog.h" #include "aoapplication.h" -AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) : QDialog(parent) +AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) + : QDialog(parent) { - ao_app = p_ao_app; + ao_app = p_ao_app; + + // Setting up the basics. + // setAttribute(Qt::WA_DeleteOnClose); + setWindowTitle(tr("Settings")); + resize(398, 360); + + ui_settings_buttons = new QDialogButtonBox(this); + + QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed); + sizePolicy1.setHorizontalStretch(0); + sizePolicy1.setVerticalStretch(0); + sizePolicy1.setHeightForWidth( + ui_settings_buttons->sizePolicy().hasHeightForWidth()); + ui_settings_buttons->setSizePolicy(sizePolicy1); + ui_settings_buttons->setOrientation(Qt::Horizontal); + ui_settings_buttons->setStandardButtons(QDialogButtonBox::Cancel | + QDialogButtonBox::Save); - // Setting up the basics. - // setAttribute(Qt::WA_DeleteOnClose); - setWindowTitle(tr("Settings")); - resize(398, 320); + QObject::connect(ui_settings_buttons, SIGNAL(accepted()), this, + SLOT(save_pressed())); + QObject::connect(ui_settings_buttons, SIGNAL(rejected()), this, + SLOT(discard_pressed())); + + // We'll stop updates so that the window won't flicker while it's being made. + setUpdatesEnabled(false); - ui_settings_buttons = new QDialogButtonBox(this); + // First of all, we want a tabbed dialog, so let's add some layout. + ui_vertical_layout = new QVBoxLayout(this); + ui_settings_tabs = new QTabWidget(this); - QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Fixed); - sizePolicy1.setHorizontalStretch(0); - sizePolicy1.setVerticalStretch(0); - sizePolicy1.setHeightForWidth(ui_settings_buttons->sizePolicy().hasHeightForWidth()); - ui_settings_buttons->setSizePolicy(sizePolicy1); - ui_settings_buttons->setOrientation(Qt::Horizontal); - ui_settings_buttons->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Save); + ui_vertical_layout->addWidget(ui_settings_tabs); + ui_vertical_layout->addWidget(ui_settings_buttons); - QObject::connect(ui_settings_buttons, SIGNAL(accepted()), this, SLOT(save_pressed())); - QObject::connect(ui_settings_buttons, SIGNAL(rejected()), this, SLOT(discard_pressed())); + // Let's add the tabs one by one. + + // + // GAMEPLAY + // + + ui_gameplay_tab = new QWidget(); + ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); - // We'll stop updates so that the window won't flicker while it's being made. - setUpdatesEnabled(false); + ui_form_layout_widget = new QWidget(ui_gameplay_tab); + ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 240)); - // First of all, we want a tabbed dialog, so let's add some layout. - ui_vertical_layout = new QVBoxLayout(this); - ui_settings_tabs = new QTabWidget(this); + ui_gameplay_form = new QFormLayout(ui_form_layout_widget); + ui_gameplay_form->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_gameplay_form->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); + ui_gameplay_form->setContentsMargins(0, 0, 0, 0); - ui_vertical_layout->addWidget(ui_settings_tabs); - ui_vertical_layout->addWidget(ui_settings_buttons); + ui_theme_label = new QLabel(ui_form_layout_widget); + ui_theme_label->setText(tr("Theme:")); + ui_theme_label->setToolTip( + tr("Sets the theme used in-game. If the new theme changes " + "the lobby's look as well, you'll need to reload the " + "lobby for the changes to take effect, such as by joining " + "a server and leaving it.")); + ui_gameplay_form->setWidget(0, QFormLayout::LabelRole, ui_theme_label); - // Let's add the tabs one by one. - // First, we'll start with 'Gameplay'. - ui_gameplay_tab = new QWidget(); - ui_settings_tabs->addTab(ui_gameplay_tab, tr("Gameplay")); + ui_theme_combobox = new QComboBox(ui_form_layout_widget); - ui_form_layout_widget = new QWidget(ui_gameplay_tab); - ui_form_layout_widget->setGeometry(QRect(10, 10, 361, 211)); + // Fill the combobox with the names of the themes. + QDirIterator it(p_ao_app->get_base_path() + "themes", QDir::Dirs, + QDirIterator::NoIteratorFlags); + while (it.hasNext()) { + QString actualname = QDir(it.next()).dirName(); + if (actualname != "." && actualname != "..") + ui_theme_combobox->addItem(actualname); + if (actualname == p_ao_app->read_theme()) + ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count() - 1); + } - ui_gameplay_form = new QFormLayout(ui_form_layout_widget); - ui_gameplay_form->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - ui_gameplay_form->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); - ui_gameplay_form->setContentsMargins(0, 0, 0, 0); + ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox); - ui_theme_label = new QLabel(ui_form_layout_widget); - ui_theme_label->setText(tr("Theme:")); - ui_theme_label->setToolTip(tr("Sets the theme used in-game. If the new theme changes " - "the lobby's look as well, you'll need to reload the " - "lobby for the changes to take effect, such as by joining " - "a server and leaving it.")); - ui_gameplay_form->setWidget(0, QFormLayout::LabelRole, ui_theme_label); + ui_theme_log_divider = new QFrame(ui_form_layout_widget); + ui_theme_log_divider->setMidLineWidth(0); + ui_theme_log_divider->setFrameShape(QFrame::HLine); + ui_theme_log_divider->setFrameShadow(QFrame::Sunken); - ui_theme_combobox = new QComboBox(ui_form_layout_widget); + ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider); - // Fill the combobox with the names of the themes. - QDirIterator it(p_ao_app->get_base_path() + "themes", QDir::Dirs, QDirIterator::NoIteratorFlags); - while (it.hasNext()) - { - QString actualname = QDir(it.next()).dirName(); - if (actualname != "." && actualname != "..") - ui_theme_combobox->addItem(actualname); - if (actualname == p_ao_app->read_theme()) - ui_theme_combobox->setCurrentIndex(ui_theme_combobox->count()-1); - } + ui_downwards_lbl = new QLabel(ui_form_layout_widget); + ui_downwards_lbl->setText(tr("Log goes downwards:")); + ui_downwards_lbl->setToolTip( + tr("If ticked, new messages will appear at " + "the bottom (like the OOC chatlog). The traditional " + "(AO1) behaviour is equivalent to this being unticked.")); - ui_gameplay_form->setWidget(0, QFormLayout::FieldRole, ui_theme_combobox); + ui_gameplay_form->setWidget(2, QFormLayout::LabelRole, ui_downwards_lbl); - ui_theme_log_divider = new QFrame(ui_form_layout_widget); - ui_theme_log_divider->setMidLineWidth(0); - ui_theme_log_divider->setFrameShape(QFrame::HLine); - ui_theme_log_divider->setFrameShadow(QFrame::Sunken); + ui_downwards_cb = new QCheckBox(ui_form_layout_widget); + ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards()); - ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider); + ui_gameplay_form->setWidget(2, QFormLayout::FieldRole, ui_downwards_cb); - ui_downwards_lbl = new QLabel(ui_form_layout_widget); - ui_downwards_lbl->setText(tr("Log goes downwards:")); - ui_downwards_lbl->setToolTip(tr("If ticked, new messages will appear at " - "the bottom (like the OOC chatlog). The traditional " - "(AO1) behaviour is equivalent to this being unticked.")); + ui_length_lbl = new QLabel(ui_form_layout_widget); + ui_length_lbl->setText(tr("Log length:")); + ui_length_lbl->setToolTip(tr( + "The amount of messages the IC chatlog will keep before " + "deleting older messages. A value of 0 or below counts as 'infinite'.")); - ui_gameplay_form->setWidget(2, QFormLayout::LabelRole, ui_downwards_lbl); + ui_gameplay_form->setWidget(3, QFormLayout::LabelRole, ui_length_lbl); - ui_downwards_cb = new QCheckBox(ui_form_layout_widget); - ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards()); + ui_length_spinbox = new QSpinBox(ui_form_layout_widget); + ui_length_spinbox->setMaximum(10000); + ui_length_spinbox->setValue(p_ao_app->get_max_log_size()); + + ui_gameplay_form->setWidget(3, QFormLayout::FieldRole, ui_length_spinbox); - ui_gameplay_form->setWidget(2, QFormLayout::FieldRole, ui_downwards_cb); + ui_log_names_divider = new QFrame(ui_form_layout_widget); + ui_log_names_divider->setFrameShape(QFrame::HLine); + ui_log_names_divider->setFrameShadow(QFrame::Sunken); - ui_length_lbl = new QLabel(ui_form_layout_widget); - ui_length_lbl->setText(tr("Log length:")); - ui_length_lbl->setToolTip(tr("The amount of messages the IC chatlog will keep before " - "deleting older messages. A value of 0 or below counts as 'infinite'.")); + ui_gameplay_form->setWidget(4, QFormLayout::FieldRole, ui_log_names_divider); - ui_gameplay_form->setWidget(3, QFormLayout::LabelRole, ui_length_lbl); + ui_username_lbl = new QLabel(ui_form_layout_widget); + ui_username_lbl->setText(tr("Default username:")); + ui_username_lbl->setToolTip( + tr("Your OOC name will be automatically set to this value " + "when you join a server.")); - ui_length_spinbox = new QSpinBox(ui_form_layout_widget); - ui_length_spinbox->setMaximum(10000); - ui_length_spinbox->setValue(p_ao_app->get_max_log_size()); + ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_username_lbl); - ui_gameplay_form->setWidget(3, QFormLayout::FieldRole, ui_length_spinbox); + ui_username_textbox = new QLineEdit(ui_form_layout_widget); + ui_username_textbox->setMaxLength(30); + ui_username_textbox->setText(p_ao_app->get_default_username()); - ui_log_names_divider = new QFrame(ui_form_layout_widget); - ui_log_names_divider->setFrameShape(QFrame::HLine); - ui_log_names_divider->setFrameShadow(QFrame::Sunken); + ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_username_textbox); - ui_gameplay_form->setWidget(4, QFormLayout::FieldRole, ui_log_names_divider); + ui_showname_lbl = new QLabel(ui_form_layout_widget); + ui_showname_lbl->setText(tr("Custom shownames:")); + ui_showname_lbl->setToolTip( + tr("Gives the default value for the in-game 'Custom shownames' " + "tickbox, which in turn determines whether the client should " + "display custom in-character names.")); - ui_username_lbl = new QLabel(ui_form_layout_widget); - ui_username_lbl->setText(tr("Default username:")); - ui_username_lbl->setToolTip(tr("Your OOC name will be automatically set to this value " - "when you join a server.")); + ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_showname_lbl); + + ui_showname_cb = new QCheckBox(ui_form_layout_widget); + ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default()); + + ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_showname_cb); + + ui_net_divider = new QFrame(ui_form_layout_widget); + ui_net_divider->setFrameShape(QFrame::HLine); + ui_net_divider->setFrameShadow(QFrame::Sunken); + + ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_net_divider); + + ui_ms_lbl = new QLabel(ui_form_layout_widget); + ui_ms_lbl->setText(tr("Backup MS:")); + ui_ms_lbl->setToolTip( + tr("If the built-in server lookups fail, the game will try the " + "address given here and use it as a backup master server address.")); - ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_username_lbl); + ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_ms_lbl); - ui_username_textbox = new QLineEdit(ui_form_layout_widget); - ui_username_textbox->setMaxLength(30); - ui_username_textbox->setText(p_ao_app->get_default_username()); + QSettings *configini = ao_app->configini; + ui_ms_textbox = new QLineEdit(ui_form_layout_widget); + ui_ms_textbox->setText(configini->value("master", "").value()); - ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_username_textbox); + ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_ms_textbox); + + ui_discord_lbl = new QLabel(ui_form_layout_widget); + ui_discord_lbl->setText(tr("Discord:")); + ui_discord_lbl->setToolTip( + tr("Allows others on Discord to see what server you are in, " + "what character are you playing, and how long you have " + "been playing for.")); - ui_showname_lbl = new QLabel(ui_form_layout_widget); - ui_showname_lbl->setText(tr("Custom shownames:")); - ui_showname_lbl->setToolTip(tr("Gives the default value for the in-game 'Custom shownames' " - "tickbox, which in turn determines whether the client should " - "display custom in-character names.")); + ui_gameplay_form->setWidget(9, QFormLayout::LabelRole, ui_discord_lbl); - ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_showname_lbl); + ui_discord_cb = new QCheckBox(ui_form_layout_widget); + ui_discord_cb->setChecked(ao_app->is_discord_enabled()); - ui_showname_cb = new QCheckBox(ui_form_layout_widget); - ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default()); + ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb); - ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_showname_cb); + ui_epilepsy_lbl = new QLabel(ui_form_layout_widget); + ui_epilepsy_lbl->setText(tr("Allow Shake/Flash:")); + ui_epilepsy_lbl->setToolTip( + tr("Allows screenshaking and flashing. Disable this if you have concerns " + "or issues with photosensitivity and/or seizures.")); + + ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_epilepsy_lbl); + + ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget); + ui_epilepsy_cb->setChecked(ao_app->is_shakeandflash_enabled()); + + ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_epilepsy_cb); + + ui_language_label = new QLabel(ui_form_layout_widget); + ui_language_label->setText(tr("Language:")); + ui_language_label->setToolTip( + tr("Sets the language if you don't want to use your system language.")); + ui_gameplay_form->setWidget(11, QFormLayout::LabelRole, ui_language_label); + + ui_language_combobox = new QComboBox(ui_form_layout_widget); + ui_language_combobox->addItem( + configini->value("language", " ").value() + + " - Keep current setting"); + ui_language_combobox->addItem(" - Default"); + ui_language_combobox->addItem("en - English"); + ui_language_combobox->addItem("de - Deutsch"); + ui_language_combobox->addItem("es - Español"); + ui_language_combobox->addItem("pt - Português"); + ui_language_combobox->addItem("jp - 日本語"); + ui_language_combobox->addItem("ru - Русский"); + ui_gameplay_form->setWidget(11, QFormLayout::FieldRole, ui_language_combobox); + + // Here we start the callwords tab. + ui_callwords_tab = new QWidget(); + ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); + + ui_callwords_widget = new QWidget(ui_callwords_tab); + ui_callwords_widget->setGeometry(QRect(10, 10, 361, 211)); + + ui_callwords_layout = new QVBoxLayout(ui_callwords_widget); + ui_callwords_layout->setContentsMargins(0, 0, 0, 0); + + ui_callwords_textbox = new QPlainTextEdit(ui_callwords_widget); + QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + sizePolicy.setHorizontalStretch(0); + sizePolicy.setVerticalStretch(0); + sizePolicy.setHeightForWidth( + ui_callwords_textbox->sizePolicy().hasHeightForWidth()); + ui_callwords_textbox->setSizePolicy(sizePolicy); + + // Let's fill the callwords text edit with the already present callwords. + ui_callwords_textbox->document()->clear(); + foreach (QString callword, p_ao_app->get_call_words()) { + ui_callwords_textbox->appendPlainText(callword); + } + + ui_callwords_layout->addWidget(ui_callwords_textbox); + + ui_callwords_explain_lbl = new QLabel(ui_callwords_widget); + ui_callwords_explain_lbl->setWordWrap(true); + ui_callwords_explain_lbl->setText( + tr("Enter as many callwords as you would like. These " + "are case insensitive. Make sure to leave every callword in its own " + "line!
Do not leave a line with a space at the end -- you will be " + "alerted everytime someone uses a space in their " + "messages.")); + + ui_callwords_layout->addWidget(ui_callwords_explain_lbl); + + // The audio tab. + ui_audio_tab = new QWidget(); + ui_settings_tabs->addTab(ui_audio_tab, tr("Audio")); + + ui_audio_widget = new QWidget(ui_audio_tab); + ui_audio_widget->setGeometry(QRect(10, 10, 361, 211)); + + ui_audio_layout = new QFormLayout(ui_audio_widget); + ui_audio_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_audio_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); + ui_audio_layout->setContentsMargins(0, 0, 0, 0); + + ui_audio_device_lbl = new QLabel(ui_audio_widget); + ui_audio_device_lbl->setText(tr("Audio device:")); + ui_audio_device_lbl->setToolTip(tr("Sets the audio device for all sounds.")); + + ui_audio_layout->setWidget(0, QFormLayout::LabelRole, ui_audio_device_lbl); + + ui_audio_device_combobox = new QComboBox(ui_audio_widget); + + // Let's fill out the combobox with the available audio devices. Or don't if + // there is no audio + if (needs_default_audiodev()) { + + ui_audio_device_combobox->addItem("default"); + } +#ifdef BASSAUDIO + BASS_DEVICEINFO info; + int a = 0; + for (a = 0; BASS_GetDeviceInfo(a, &info); a++) { + ui_audio_device_combobox->addItem(info.name); + if (p_ao_app->get_audio_output_device() == info.name) + ui_audio_device_combobox->setCurrentIndex( + ui_audio_device_combobox->count() - 1); + } +#elif defined QTAUDIO + foreach (const QAudioDeviceInfo &deviceInfo, + QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) { + ui_audio_device_combobox->addItem(deviceInfo.deviceName()); + if (p_ao_app->get_audio_output_device() == deviceInfo.deviceName()) + ui_audio_device_combobox->setCurrentIndex( + ui_audio_device_combobox->count() - 1); + } +#endif + ui_audio_layout->setWidget(0, QFormLayout::FieldRole, + ui_audio_device_combobox); + + ui_audio_volume_divider = new QFrame(ui_audio_widget); + ui_audio_volume_divider->setFrameShape(QFrame::HLine); + ui_audio_volume_divider->setFrameShadow(QFrame::Sunken); + + ui_audio_layout->setWidget(1, QFormLayout::FieldRole, + ui_audio_volume_divider); + + ui_music_volume_lbl = new QLabel(ui_audio_widget); + ui_music_volume_lbl->setText(tr("Music:")); + ui_music_volume_lbl->setToolTip(tr("Sets the music's default volume.")); + + ui_audio_layout->setWidget(2, QFormLayout::LabelRole, ui_music_volume_lbl); + + ui_music_volume_spinbox = new QSpinBox(ui_audio_widget); + ui_music_volume_spinbox->setValue(p_ao_app->get_default_music()); + ui_music_volume_spinbox->setMaximum(100); + ui_music_volume_spinbox->setSuffix("%"); - ui_net_divider = new QFrame(ui_form_layout_widget); - ui_net_divider->setFrameShape(QFrame::HLine); - ui_net_divider->setFrameShadow(QFrame::Sunken); + ui_audio_layout->setWidget(2, QFormLayout::FieldRole, + ui_music_volume_spinbox); + + ui_sfx_volume_lbl = new QLabel(ui_audio_widget); + ui_sfx_volume_lbl->setText(tr("SFX:")); + ui_sfx_volume_lbl->setToolTip( + tr("Sets the SFX's default volume. " + "Interjections and actual sound effects count as 'SFX'.")); + + ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl); + + ui_sfx_volume_spinbox = new QSpinBox(ui_audio_widget); + ui_sfx_volume_spinbox->setValue(p_ao_app->get_default_sfx()); + ui_sfx_volume_spinbox->setMaximum(100); + ui_sfx_volume_spinbox->setSuffix("%"); + + ui_audio_layout->setWidget(3, QFormLayout::FieldRole, ui_sfx_volume_spinbox); + + ui_blips_volume_lbl = new QLabel(ui_audio_widget); + ui_blips_volume_lbl->setText(tr("Blips:")); + ui_blips_volume_lbl->setToolTip( + tr("Sets the volume of the blips, the talking sound effects.")); + + ui_audio_layout->setWidget(4, QFormLayout::LabelRole, ui_blips_volume_lbl); + + ui_blips_volume_spinbox = new QSpinBox(ui_audio_widget); + ui_blips_volume_spinbox->setValue(p_ao_app->get_default_blip()); + ui_blips_volume_spinbox->setMaximum(100); + ui_blips_volume_spinbox->setSuffix("%"); - ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_net_divider); + ui_audio_layout->setWidget(4, QFormLayout::FieldRole, + ui_blips_volume_spinbox); - ui_ms_lbl = new QLabel(ui_form_layout_widget); - ui_ms_lbl->setText(tr("Backup MS:")); - ui_ms_lbl->setToolTip(tr("If the built-in server lookups fail, the game will try the " - "address given here and use it as a backup master server address.")); + ui_volume_blip_divider = new QFrame(ui_audio_widget); + ui_volume_blip_divider->setFrameShape(QFrame::HLine); + ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); - ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_ms_lbl); + ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider); - QSettings* configini = ao_app->configini; - ui_ms_textbox = new QLineEdit(ui_form_layout_widget); - ui_ms_textbox->setText(configini->value("master", "").value()); + ui_bliprate_lbl = new QLabel(ui_audio_widget); + ui_bliprate_lbl->setText(tr("Blip rate:")); + ui_bliprate_lbl->setToolTip( + tr("Sets the delay between playing the blip sounds.")); - ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_ms_textbox); + ui_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl); - ui_discord_lbl = new QLabel(ui_form_layout_widget); - ui_discord_lbl->setText(tr("Discord:")); - ui_discord_lbl->setToolTip(tr("Allows others on Discord to see what server you are in, " - "what character are you playing, and how long you have " - "been playing for.")); + ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); + ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); + ui_bliprate_spinbox->setMinimum(1); - ui_gameplay_form->setWidget(9, QFormLayout::LabelRole, ui_discord_lbl); + ui_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox); - ui_discord_cb = new QCheckBox(ui_form_layout_widget); - ui_discord_cb->setChecked(ao_app->is_discord_enabled()); + ui_blank_blips_lbl = new QLabel(ui_audio_widget); + ui_blank_blips_lbl->setText(tr("Blank blips:")); + ui_blank_blips_lbl->setToolTip( + tr("If true, the game will play a blip sound even " + "when a space is 'being said'.")); - ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb); + ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl); - ui_epilepsy_lbl = new QLabel(ui_form_layout_widget); - ui_epilepsy_lbl->setText(tr("Allow Shake/Flash:")); - ui_epilepsy_lbl->setToolTip(tr("Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures.")); + ui_blank_blips_cb = new QCheckBox(ui_audio_widget); + ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip()); - ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_epilepsy_lbl); + ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb); - ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget); - ui_epilepsy_cb->setChecked(ao_app->is_shakeandflash_enabled()); + ui_loopsfx_lbl = new QLabel(ui_audio_widget); + ui_loopsfx_lbl->setText(tr("Enable Looping SFX:")); + ui_loopsfx_lbl->setToolTip(tr("If true, the game will allow looping sound " + "effects to play on preanimations.")); - ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_epilepsy_cb); + ui_audio_layout->setWidget(8, QFormLayout::LabelRole, ui_loopsfx_lbl); - ui_language_label = new QLabel(ui_form_layout_widget); - ui_language_label->setText(tr("Language:")); - ui_language_label->setToolTip(tr("Sets the language if you don't want to use your system language.")); - ui_gameplay_form->setWidget(11, QFormLayout::LabelRole, ui_language_label); + ui_loopsfx_cb = new QCheckBox(ui_audio_widget); + ui_loopsfx_cb->setChecked(p_ao_app->get_looping_sfx()); - ui_language_combobox = new QComboBox(ui_form_layout_widget); - ui_language_combobox->addItem(configini->value("language", " ").value() + " - Keep current setting"); - ui_language_combobox->addItem(" - Default"); - ui_language_combobox->addItem("en - English"); - ui_language_combobox->addItem("de - Deutsch"); - ui_language_combobox->addItem("es - Español"); - ui_language_combobox->addItem("pt - Português"); - ui_language_combobox->addItem("jp - 日本語"); - ui_language_combobox->addItem("ru - Русский"); - ui_gameplay_form->setWidget(11, QFormLayout::FieldRole, ui_language_combobox); + ui_audio_layout->setWidget(8, QFormLayout::FieldRole, ui_loopsfx_cb); - // Here we start the callwords tab. - ui_callwords_tab = new QWidget(); - ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); + ui_objectmusic_lbl = new QLabel(ui_audio_widget); + ui_objectmusic_lbl->setText(tr("Kill Music On Objection:")); + ui_objectmusic_lbl->setToolTip( + tr("If true, the game will stop music when someone objects, like in the " + "actual games.")); - ui_callwords_widget = new QWidget(ui_callwords_tab); - ui_callwords_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_audio_layout->setWidget(9, QFormLayout::LabelRole, ui_objectmusic_lbl); - ui_callwords_layout = new QVBoxLayout(ui_callwords_widget); - ui_callwords_layout->setContentsMargins(0,0,0,0); + ui_objectmusic_cb = new QCheckBox(ui_audio_widget); + ui_objectmusic_cb->setChecked(p_ao_app->get_objectmusic()); - ui_callwords_textbox = new QPlainTextEdit(ui_callwords_widget); - QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - sizePolicy.setHeightForWidth(ui_callwords_textbox->sizePolicy().hasHeightForWidth()); - ui_callwords_textbox->setSizePolicy(sizePolicy); + ui_audio_layout->setWidget(9, QFormLayout::FieldRole, ui_objectmusic_cb); - // Let's fill the callwords text edit with the already present callwords. - ui_callwords_textbox->document()->clear(); - foreach (QString callword, p_ao_app->get_call_words()) { - ui_callwords_textbox->appendPlainText(callword); - } + // + // CASING + // + ui_casing_tab = new QWidget(); + ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); - ui_callwords_layout->addWidget(ui_callwords_textbox); + ui_casing_widget = new QWidget(ui_casing_tab); + ui_casing_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_callwords_explain_lbl = new QLabel(ui_callwords_widget); - ui_callwords_explain_lbl->setWordWrap(true); - ui_callwords_explain_lbl->setText(tr("Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!
Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.")); + ui_casing_layout = new QFormLayout(ui_casing_widget); + ui_casing_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_casing_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); + ui_casing_layout->setContentsMargins(0, 0, 0, 0); - ui_callwords_layout->addWidget(ui_callwords_explain_lbl); + // -- SERVER SUPPORTS CASING - // The audio tab. - ui_audio_tab = new QWidget(); - ui_settings_tabs->addTab(ui_audio_tab, tr("Audio")); + ui_casing_supported_lbl = new QLabel(ui_casing_widget); + if (ao_app->casing_alerts_enabled) + ui_casing_supported_lbl->setText(tr("This server supports case alerts.")); + else + ui_casing_supported_lbl->setText( + tr("This server does not support case alerts.")); + ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory.")); - ui_audio_widget = new QWidget(ui_audio_tab); - ui_audio_widget->setGeometry(QRect(10, 10, 361, 211)); + ui_casing_layout->setWidget(0, QFormLayout::FieldRole, + ui_casing_supported_lbl); - ui_audio_layout = new QFormLayout(ui_audio_widget); - ui_audio_layout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - ui_audio_layout->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); - ui_audio_layout->setContentsMargins(0, 0, 0, 0); + // -- CASE ANNOUNCEMENTS - ui_audio_device_lbl = new QLabel(ui_audio_widget); - ui_audio_device_lbl->setText(tr("Audio device:")); - ui_audio_device_lbl->setToolTip(tr("Sets the audio device for all sounds.")); + ui_casing_enabled_lbl = new QLabel(ui_casing_widget); + ui_casing_enabled_lbl->setText(tr("Casing:")); + ui_casing_enabled_lbl->setToolTip( + tr("If checked, you will get alerts about case " + "announcements.")); - ui_audio_layout->setWidget(0, QFormLayout::LabelRole, ui_audio_device_lbl); + ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl); - ui_audio_device_combobox = new QComboBox(ui_audio_widget); + ui_casing_enabled_cb = new QCheckBox(ui_casing_widget); + ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled()); - // Let's fill out the combobox with the available audio devices. Or don't if there is no audio - if (needs_default_audiodev()) - { + ui_casing_layout->setWidget(1, QFormLayout::FieldRole, ui_casing_enabled_cb); - ui_audio_device_combobox->addItem("default"); + // -- DEFENSE ANNOUNCEMENTS - } - #ifdef BASSAUDIO - BASS_DEVICEINFO info; - int a = 0; - for (a = 0; BASS_GetDeviceInfo(a, &info); a++) - { - ui_audio_device_combobox->addItem(info.name); - if (p_ao_app->get_audio_output_device() == info.name) - ui_audio_device_combobox->setCurrentIndex(ui_audio_device_combobox->count()-1); - } - #elif defined QTAUDIO - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) - { - ui_audio_device_combobox->addItem(deviceInfo.deviceName()); - if (p_ao_app->get_audio_output_device() == deviceInfo.deviceName()) - ui_audio_device_combobox->setCurrentIndex(ui_audio_device_combobox->count()-1); - } - #endif - ui_audio_layout->setWidget(0, QFormLayout::FieldRole, ui_audio_device_combobox); + ui_casing_def_lbl = new QLabel(ui_casing_widget); + ui_casing_def_lbl->setText(tr("Defense:")); + ui_casing_def_lbl->setToolTip(tr("If checked, you will get alerts about case " + "announcements if a defense spot is open.")); - ui_audio_volume_divider = new QFrame(ui_audio_widget); - ui_audio_volume_divider->setFrameShape(QFrame::HLine); - ui_audio_volume_divider->setFrameShadow(QFrame::Sunken); + ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl); - ui_audio_layout->setWidget(1, QFormLayout::FieldRole, ui_audio_volume_divider); + ui_casing_def_cb = new QCheckBox(ui_casing_widget); + ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled()); - ui_music_volume_lbl = new QLabel(ui_audio_widget); - ui_music_volume_lbl->setText(tr("Music:")); - ui_music_volume_lbl->setToolTip(tr("Sets the music's default volume.")); + ui_casing_layout->setWidget(2, QFormLayout::FieldRole, ui_casing_def_cb); - ui_audio_layout->setWidget(2, QFormLayout::LabelRole, ui_music_volume_lbl); + // -- PROSECUTOR ANNOUNCEMENTS - ui_music_volume_spinbox = new QSpinBox(ui_audio_widget); - ui_music_volume_spinbox->setValue(p_ao_app->get_default_music()); - ui_music_volume_spinbox->setMaximum(100); - ui_music_volume_spinbox->setSuffix("%"); + ui_casing_pro_lbl = new QLabel(ui_casing_widget); + ui_casing_pro_lbl->setText(tr("Prosecution:")); + ui_casing_pro_lbl->setToolTip( + tr("If checked, you will get alerts about case " + "announcements if a prosecutor spot is open.")); - ui_audio_layout->setWidget(2, QFormLayout::FieldRole, ui_music_volume_spinbox); + ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl); - ui_sfx_volume_lbl = new QLabel(ui_audio_widget); - ui_sfx_volume_lbl->setText(tr("SFX:")); - ui_sfx_volume_lbl->setToolTip(tr("Sets the SFX's default volume. " - "Interjections and actual sound effects count as 'SFX'.")); + ui_casing_pro_cb = new QCheckBox(ui_casing_widget); + ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled()); - ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl); + ui_casing_layout->setWidget(3, QFormLayout::FieldRole, ui_casing_pro_cb); - ui_sfx_volume_spinbox = new QSpinBox(ui_audio_widget); - ui_sfx_volume_spinbox->setValue(p_ao_app->get_default_sfx()); - ui_sfx_volume_spinbox->setMaximum(100); - ui_sfx_volume_spinbox->setSuffix("%"); + // -- JUDGE ANNOUNCEMENTS - ui_audio_layout->setWidget(3, QFormLayout::FieldRole, ui_sfx_volume_spinbox); + ui_casing_jud_lbl = new QLabel(ui_casing_widget); + ui_casing_jud_lbl->setText(tr("Judge:")); + ui_casing_jud_lbl->setToolTip(tr("If checked, you will get alerts about case " + "announcements if the judge spot is open.")); - ui_blips_volume_lbl = new QLabel(ui_audio_widget); - ui_blips_volume_lbl->setText(tr("Blips:")); - ui_blips_volume_lbl->setToolTip(tr("Sets the volume of the blips, the talking sound effects.")); + ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl); - ui_audio_layout->setWidget(4, QFormLayout::LabelRole, ui_blips_volume_lbl); + ui_casing_jud_cb = new QCheckBox(ui_casing_widget); + ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled()); - ui_blips_volume_spinbox = new QSpinBox(ui_audio_widget); - ui_blips_volume_spinbox->setValue(p_ao_app->get_default_blip()); - ui_blips_volume_spinbox->setMaximum(100); - ui_blips_volume_spinbox->setSuffix("%"); + ui_casing_layout->setWidget(4, QFormLayout::FieldRole, ui_casing_jud_cb); - ui_audio_layout->setWidget(4, QFormLayout::FieldRole, ui_blips_volume_spinbox); + // -- JUROR ANNOUNCEMENTS - ui_volume_blip_divider = new QFrame(ui_audio_widget); - ui_volume_blip_divider->setFrameShape(QFrame::HLine); - ui_volume_blip_divider->setFrameShadow(QFrame::Sunken); + ui_casing_jur_lbl = new QLabel(ui_casing_widget); + ui_casing_jur_lbl->setText(tr("Juror:")); + ui_casing_jur_lbl->setToolTip(tr("If checked, you will get alerts about case " + "announcements if a juror spot is open.")); - ui_audio_layout->setWidget(5, QFormLayout::FieldRole, ui_volume_blip_divider); + ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl); - ui_bliprate_lbl = new QLabel(ui_audio_widget); - ui_bliprate_lbl->setText(tr("Blip rate:")); - ui_bliprate_lbl->setToolTip(tr("Sets the delay between playing the blip sounds.")); + ui_casing_jur_cb = new QCheckBox(ui_casing_widget); + ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled()); - ui_audio_layout->setWidget(6, QFormLayout::LabelRole, ui_bliprate_lbl); + ui_casing_layout->setWidget(5, QFormLayout::FieldRole, ui_casing_jur_cb); - ui_bliprate_spinbox = new QSpinBox(ui_audio_widget); - ui_bliprate_spinbox->setValue(p_ao_app->read_blip_rate()); - ui_bliprate_spinbox->setMinimum(1); + // -- STENO ANNOUNCEMENTS - ui_audio_layout->setWidget(6, QFormLayout::FieldRole, ui_bliprate_spinbox); + ui_casing_steno_lbl = new QLabel(ui_casing_widget); + ui_casing_steno_lbl->setText(tr("Stenographer:")); + ui_casing_steno_lbl->setToolTip( + tr("If checked, you will get alerts about case " + "announcements if a stenographer spot is open.")); - ui_blank_blips_lbl = new QLabel(ui_audio_widget); - ui_blank_blips_lbl->setText(tr("Blank blips:")); - ui_blank_blips_lbl->setToolTip(tr("If true, the game will play a blip sound even " - "when a space is 'being said'.")); + ui_casing_layout->setWidget(6, QFormLayout::LabelRole, ui_casing_steno_lbl); - ui_audio_layout->setWidget(7, QFormLayout::LabelRole, ui_blank_blips_lbl); + ui_casing_steno_cb = new QCheckBox(ui_casing_widget); + ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled()); - ui_blank_blips_cb = new QCheckBox(ui_audio_widget); - ui_blank_blips_cb->setChecked(p_ao_app->get_blank_blip()); + ui_casing_layout->setWidget(6, QFormLayout::FieldRole, ui_casing_steno_cb); - ui_audio_layout->setWidget(7, QFormLayout::FieldRole, ui_blank_blips_cb); + // -- CM ANNOUNCEMENTS - ui_loopsfx_lbl = new QLabel(ui_audio_widget); - ui_loopsfx_lbl->setText(tr("Enable Looping SFX:")); - ui_loopsfx_lbl->setToolTip(tr("If true, the game will allow looping sound effects to play on preanimations.")); + ui_casing_cm_lbl = new QLabel(ui_casing_widget); + ui_casing_cm_lbl->setText(tr("CM:")); + ui_casing_cm_lbl->setToolTip( + tr("If checked, you will appear amongst the potential " + "CMs on the server.")); - ui_audio_layout->setWidget(8, QFormLayout::LabelRole, ui_loopsfx_lbl); + ui_casing_layout->setWidget(7, QFormLayout::LabelRole, ui_casing_cm_lbl); - ui_loopsfx_cb = new QCheckBox(ui_audio_widget); - ui_loopsfx_cb->setChecked(p_ao_app->get_looping_sfx()); + ui_casing_cm_cb = new QCheckBox(ui_casing_widget); + ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled()); - ui_audio_layout->setWidget(8, QFormLayout::FieldRole, ui_loopsfx_cb); + ui_casing_layout->setWidget(7, QFormLayout::FieldRole, ui_casing_cm_cb); + ui_casing_wit_lbl = new QLabel(ui_casing_widget); + ui_casing_wit_lbl->setText(tr("Witness:")); + ui_casing_wit_lbl->setToolTip( + tr("If checked, you will appear amongst the potential " + "witnesses on the server.")); - ui_objectmusic_lbl = new QLabel(ui_audio_widget); - ui_objectmusic_lbl->setText(tr("Kill Music On Objection:")); - ui_objectmusic_lbl->setToolTip(tr("If true, the game will stop music when someone objects, like in the actual games.")); + ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_wit_lbl); - ui_audio_layout->setWidget(9, QFormLayout::LabelRole, ui_objectmusic_lbl); + ui_casing_wit_cb = new QCheckBox(ui_casing_widget); + ui_casing_wit_cb->setChecked(ao_app->get_casing_wit_enabled()); - ui_objectmusic_cb = new QCheckBox(ui_audio_widget); - ui_objectmusic_cb->setChecked(p_ao_app->get_objectmusic()); + ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_wit_cb); - ui_audio_layout->setWidget(9, QFormLayout::FieldRole, ui_objectmusic_cb); + // -- CM CASES ANNOUNCEMENTS - // The casing tab! - ui_casing_tab = new QWidget(); - ui_settings_tabs->addTab(ui_casing_tab, tr("Casing")); + ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget); + ui_casing_cm_cases_lbl->setText(tr("Hosting cases:")); + ui_casing_cm_cases_lbl->setToolTip( + tr("If you're a CM, enter what cases you are " + "willing to host.")); - ui_casing_widget = new QWidget(ui_casing_tab); - ui_casing_widget->setGeometry(QRect(10,10, 361, 211)); + ui_casing_layout->setWidget(9, QFormLayout::LabelRole, + ui_casing_cm_cases_lbl); - ui_casing_layout = new QFormLayout(ui_casing_widget); - ui_casing_layout->setLabelAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter); - ui_casing_layout->setFormAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop); - ui_casing_layout->setContentsMargins(0, 0, 0, 0); + ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget); + ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases()); - // -- SERVER SUPPORTS CASING + ui_casing_layout->setWidget(9, QFormLayout::FieldRole, + ui_casing_cm_cases_textbox); - ui_casing_supported_lbl = new QLabel(ui_casing_widget); - if (ao_app->casing_alerts_enabled) - ui_casing_supported_lbl->setText(tr("This server supports case alerts.")); - else - ui_casing_supported_lbl->setText(tr("This server does not support case alerts.")); - ui_casing_supported_lbl->setToolTip(tr("Pretty self-explanatory.")); + // ICLOG - ui_casing_layout->setWidget(0, QFormLayout::FieldRole, ui_casing_supported_lbl); + ui_other_tab = new QWidget(); + ui_settings_tabs->addTab(ui_other_tab, tr("IC_Log")); - // -- CASE ANNOUNCEMENTS + ui_other_widget = new QWidget(ui_other_tab); + ui_other_widget->setGeometry(QRect(10, 10, 361, 211)); - ui_casing_enabled_lbl = new QLabel(ui_casing_widget); - ui_casing_enabled_lbl->setText(tr("Casing:")); - ui_casing_enabled_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements.")); + ui_other_layout = new QFormLayout(ui_other_widget); + ui_other_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_other_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); + ui_other_layout->setContentsMargins(0, 0, 0, 0); - ui_casing_layout->setWidget(1, QFormLayout::LabelRole, ui_casing_enabled_lbl); + ui_other_fancy_icl_enabled_lb = new QLabel(ui_other_widget); + ui_other_fancy_icl_enabled_lb->setText(tr("Colorful IC log:")); + ui_other_fancy_icl_enabled_lb->setToolTip( + tr("Enables colored text in the log.")); + ui_other_layout->setWidget(1, QFormLayout::LabelRole, + ui_other_fancy_icl_enabled_lb); - ui_casing_enabled_cb = new QCheckBox(ui_casing_widget); - ui_casing_enabled_cb->setChecked(ao_app->get_casing_enabled()); + ui_other_fancy_icl_enabled_cb = new QCheckBox(ui_other_widget); + ui_other_fancy_icl_enabled_cb->setChecked( + ao_app->get_colored_iclog_enabled()); + ui_other_layout->setWidget(1, QFormLayout::FieldRole, + ui_other_fancy_icl_enabled_cb); - ui_casing_layout->setWidget(1, QFormLayout::FieldRole, ui_casing_enabled_cb); + ui_other_fancy_icl_limit_lb = new QLabel(ui_other_widget); + ui_other_fancy_icl_limit_lb->setText(tr("Only inline coloring:")); + ui_other_fancy_icl_limit_lb->setToolTip( + tr("Only inline coloring will be shown such as <>,|| etc")); + ui_other_layout->setWidget(2, QFormLayout::LabelRole, + ui_other_fancy_icl_limit_lb); + ui_other_fancy_icl_limit_cb = new QCheckBox(ui_other_widget); + ui_other_fancy_icl_limit_cb->setChecked( + ao_app->colorlog_restricted_enabled()); + ui_other_layout->setWidget(2, QFormLayout::FieldRole, + ui_other_fancy_icl_limit_cb); - // -- DEFENSE ANNOUNCEMENTS - - ui_casing_def_lbl = new QLabel(ui_casing_widget); - ui_casing_def_lbl->setText(tr("Defense:")); - ui_casing_def_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if a defense spot is open.")); - - ui_casing_layout->setWidget(2, QFormLayout::LabelRole, ui_casing_def_lbl); - - ui_casing_def_cb = new QCheckBox(ui_casing_widget); - ui_casing_def_cb->setChecked(ao_app->get_casing_defence_enabled()); - - ui_casing_layout->setWidget(2, QFormLayout::FieldRole, ui_casing_def_cb); - - // -- PROSECUTOR ANNOUNCEMENTS - - ui_casing_pro_lbl = new QLabel(ui_casing_widget); - ui_casing_pro_lbl->setText(tr("Prosecution:")); - ui_casing_pro_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if a prosecutor spot is open.")); - - ui_casing_layout->setWidget(3, QFormLayout::LabelRole, ui_casing_pro_lbl); - - ui_casing_pro_cb = new QCheckBox(ui_casing_widget); - ui_casing_pro_cb->setChecked(ao_app->get_casing_prosecution_enabled()); - - ui_casing_layout->setWidget(3, QFormLayout::FieldRole, ui_casing_pro_cb); - - // -- JUDGE ANNOUNCEMENTS - - ui_casing_jud_lbl = new QLabel(ui_casing_widget); - ui_casing_jud_lbl->setText(tr("Judge:")); - ui_casing_jud_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if the judge spot is open.")); - - ui_casing_layout->setWidget(4, QFormLayout::LabelRole, ui_casing_jud_lbl); - - ui_casing_jud_cb = new QCheckBox(ui_casing_widget); - ui_casing_jud_cb->setChecked(ao_app->get_casing_judge_enabled()); - - ui_casing_layout->setWidget(4, QFormLayout::FieldRole, ui_casing_jud_cb); - - // -- JUROR ANNOUNCEMENTS - - ui_casing_jur_lbl = new QLabel(ui_casing_widget); - ui_casing_jur_lbl->setText(tr("Juror:")); - ui_casing_jur_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if a juror spot is open.")); - - ui_casing_layout->setWidget(5, QFormLayout::LabelRole, ui_casing_jur_lbl); - - ui_casing_jur_cb = new QCheckBox(ui_casing_widget); - ui_casing_jur_cb->setChecked(ao_app->get_casing_juror_enabled()); - - ui_casing_layout->setWidget(5, QFormLayout::FieldRole, ui_casing_jur_cb); - - // -- STENO ANNOUNCEMENTS - - ui_casing_steno_lbl = new QLabel(ui_casing_widget); - ui_casing_steno_lbl->setText(tr("Stenographer:")); - ui_casing_steno_lbl->setToolTip(tr("If checked, you will get alerts about case " - "announcements if a stenographer spot is open.")); - - ui_casing_layout->setWidget(6, QFormLayout::LabelRole, ui_casing_steno_lbl); - - ui_casing_steno_cb = new QCheckBox(ui_casing_widget); - ui_casing_steno_cb->setChecked(ao_app->get_casing_steno_enabled()); - - ui_casing_layout->setWidget(6, QFormLayout::FieldRole, ui_casing_steno_cb); - - // -- CM ANNOUNCEMENTS - - ui_casing_cm_lbl = new QLabel(ui_casing_widget); - ui_casing_cm_lbl->setText(tr("CM:")); - ui_casing_cm_lbl->setToolTip(tr("If checked, you will appear amongst the potential " - "CMs on the server.")); - - ui_casing_layout->setWidget(7, QFormLayout::LabelRole, ui_casing_cm_lbl); - - ui_casing_cm_cb = new QCheckBox(ui_casing_widget); - ui_casing_cm_cb->setChecked(ao_app->get_casing_cm_enabled()); - - ui_casing_layout->setWidget(7, QFormLayout::FieldRole, ui_casing_cm_cb); - - ui_casing_wit_lbl = new QLabel(ui_casing_widget); - ui_casing_wit_lbl->setText(tr("Witness:")); - ui_casing_wit_lbl->setToolTip(tr("If checked, you will appear amongst the potential " - "witnesses on the server.")); - - ui_casing_layout->setWidget(8, QFormLayout::LabelRole, ui_casing_wit_lbl); - - ui_casing_wit_cb = new QCheckBox(ui_casing_widget); - ui_casing_wit_cb->setChecked(ao_app->get_casing_wit_enabled()); - - ui_casing_layout->setWidget(8, QFormLayout::FieldRole, ui_casing_wit_cb); - - // -- CM CASES ANNOUNCEMENTS - - ui_casing_cm_cases_lbl = new QLabel(ui_casing_widget); - ui_casing_cm_cases_lbl->setText(tr("Hosting cases:")); - ui_casing_cm_cases_lbl->setToolTip(tr("If you're a CM, enter what cases you are " - "willing to host.")); - - ui_casing_layout->setWidget(9, QFormLayout::LabelRole, ui_casing_cm_cases_lbl); - - ui_casing_cm_cases_textbox = new QLineEdit(ui_casing_widget); - ui_casing_cm_cases_textbox->setText(ao_app->get_casing_can_host_cases()); - - ui_casing_layout->setWidget(9, QFormLayout::FieldRole, ui_casing_cm_cases_textbox); - - // When we're done, we should continue the updates! - setUpdatesEnabled(true); + ui_other_mirror_icl_enabled_lb = new QLabel(ui_other_widget); + ui_other_mirror_icl_enabled_lb->setText(tr("Mirror IC log:")); + ui_other_mirror_icl_enabled_lb->setToolTip( + tr("IC log will mirror the IC box. " + "Meaning that if somebody gets interupted nobody will know what they " + "wanted to say. " + "Enable for a more realistic expierence")); + ui_other_layout->setWidget(3, QFormLayout::LabelRole, + ui_other_mirror_icl_enabled_lb); + ui_other_mirror_icl_enabled_cb = new QCheckBox(ui_other_widget); + ui_other_mirror_icl_enabled_cb->setChecked(ao_app->get_iclmir_enabled()); + ui_other_layout->setWidget(3, QFormLayout::FieldRole, + ui_other_mirror_icl_enabled_cb); + + ui_downwards_lbl = new QLabel(ui_other_widget); + ui_downwards_lbl->setText(tr("Log goes downwards:")); + ui_downwards_lbl->setToolTip( + tr("If ticked, new messages will appear at " + "the bottom (like the OOC chatlog). The traditional " + "(AO1) behaviour is equivalent to this being unticked.")); + + ui_other_layout->setWidget(4, QFormLayout::LabelRole, ui_downwards_lbl); + + ui_downwards_cb = new QCheckBox(ui_other_widget); + ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards()); + + ui_other_layout->setWidget(4, QFormLayout::FieldRole, ui_downwards_cb); + + ui_length_lbl = new QLabel(ui_other_widget); + ui_length_lbl->setText(tr("Log length:")); + ui_length_lbl->setToolTip(tr( + "The amount of messages the IC chatlog will keep before " + "deleting older messages. A value of 0 or below counts as 'infinite'.")); + + ui_other_layout->setWidget(5, QFormLayout::LabelRole, ui_length_lbl); + + ui_length_spinbox = new QSpinBox(ui_other_widget); + ui_length_spinbox->setMaximum(10000); + ui_length_spinbox->setValue(p_ao_app->get_max_log_size()); + + ui_other_layout->setWidget(5, QFormLayout::FieldRole, ui_length_spinbox); + + // When we're done, we should continue the updates! + setUpdatesEnabled(true); } void AOOptionsDialog::save_pressed() { - // Save everything into the config.ini. - QSettings* configini = ao_app->configini; + // Save everything into the config.ini. + QSettings *configini = ao_app->configini; - configini->setValue("theme", ui_theme_combobox->currentText()); - configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); - configini->setValue("log_maximum", ui_length_spinbox->value()); - configini->setValue("default_username", ui_username_textbox->text()); - configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); - configini->setValue("master", ui_ms_textbox->text()); - configini->setValue("discord", ui_discord_cb->isChecked()); - configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); - configini->setValue("language", ui_language_combobox->currentText().left(2)); - - QFile* callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); - - if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) - { - // Nevermind! - } - else - { - QTextStream out(callwordsini); - out << ui_callwords_textbox->toPlainText(); - callwordsini->close(); - } - - configini->setValue("default_audio_device", ui_audio_device_combobox->currentText()); - configini->setValue("default_music", ui_music_volume_spinbox->value()); - configini->setValue("default_sfx", ui_sfx_volume_spinbox->value()); - configini->setValue("default_blip", ui_blips_volume_spinbox->value()); - configini->setValue("blip_rate", ui_bliprate_spinbox->value()); - configini->setValue("blank_blip", ui_blank_blips_cb->isChecked()); - configini->setValue("looping_sfx", ui_loopsfx_cb->isChecked()); - configini->setValue("kill_music_on_object", ui_objectmusic_cb->isChecked()); - - configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked()); - configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked()); - configini->setValue("casing_prosecution_enabled", ui_casing_pro_cb->isChecked()); - configini->setValue("casing_judge_enabled", ui_casing_jud_cb->isChecked()); - configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked()); - configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked()); - configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked()); - configini->setValue("casing_wit_enabled", ui_casing_wit_cb->isChecked()); - configini->setValue("casing_can_host_cases", ui_casing_cm_cases_textbox->text()); + configini->setValue("theme", ui_theme_combobox->currentText()); + configini->setValue("log_goes_downwards", ui_downwards_cb->isChecked()); + configini->setValue("log_maximum", ui_length_spinbox->value()); + configini->setValue("default_username", ui_username_textbox->text()); + configini->setValue("show_custom_shownames", ui_showname_cb->isChecked()); + configini->setValue("master", ui_ms_textbox->text()); + configini->setValue("discord", ui_discord_cb->isChecked()); + configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); + configini->setValue("language", ui_language_combobox->currentText().left(2)); + configini->setValue("punctuation_delay", ui_pun_delay_spinbox->value()); + configini->setValue("keep_evidence", ui_keepevi_cb->isChecked()); + QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); + if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | + QIODevice::Text)) { + // Nevermind! + } + else { + QTextStream out(callwordsini); + out << ui_callwords_textbox->toPlainText(); callwordsini->close(); - done(0); + } + + configini->setValue("default_audio_device", + ui_audio_device_combobox->currentText()); + configini->setValue("default_music", ui_music_volume_spinbox->value()); + configini->setValue("default_sfx", ui_sfx_volume_spinbox->value()); + configini->setValue("default_blip", ui_blips_volume_spinbox->value()); + configini->setValue("blip_rate", ui_bliprate_spinbox->value()); + configini->setValue("blank_blip", ui_blank_blips_cb->isChecked()); + configini->setValue("looping_sfx", ui_loopsfx_cb->isChecked()); + configini->setValue("kill_music_on_object", ui_objectmusic_cb->isChecked()); + + configini->setValue("casing_enabled", ui_casing_enabled_cb->isChecked()); + configini->setValue("casing_defence_enabled", ui_casing_def_cb->isChecked()); + configini->setValue("casing_prosecution_enabled", + ui_casing_pro_cb->isChecked()); + configini->setValue("casing_judge_enabled", ui_casing_jud_cb->isChecked()); + configini->setValue("casing_juror_enabled", ui_casing_jur_cb->isChecked()); + configini->setValue("casing_steno_enabled", ui_casing_steno_cb->isChecked()); + configini->setValue("casing_cm_enabled", ui_casing_cm_cb->isChecked()); + configini->setValue("casing_wit_enabled", ui_casing_wit_cb->isChecked()); + configini->setValue("casing_can_host_cases", + ui_casing_cm_cases_textbox->text()); + + configini->setValue("color_iclog_enabled", + ui_other_fancy_icl_enabled_cb->isChecked()); + configini->setValue("mirror_iclog_enabled", + ui_other_mirror_icl_enabled_cb->isChecked()); + configini->setValue("mirror_iclog_restricted", + ui_other_fancy_icl_limit_cb->isChecked()); + + callwordsini->close(); + done(0); } -void AOOptionsDialog::discard_pressed() -{ - done(0); -} +void AOOptionsDialog::discard_pressed() { done(0); } -#if (defined (_WIN32) || defined (_WIN64)) -bool AOOptionsDialog::needs_default_audiodev() -{ - return true; -} -#elif (defined (LINUX) || defined (__linux__)) -bool AOOptionsDialog::needs_default_audiodev() -{ - return false; -} +#if (defined(_WIN32) || defined(_WIN64)) +bool AOOptionsDialog::needs_default_audiodev() { return true; } +#elif (defined(LINUX) || defined(__linux__)) +bool AOOptionsDialog::needs_default_audiodev() { return false; } #elif defined __APPLE__ -bool AOOptionsDialog::needs_default_audiodev() -{ - return true; -} +bool AOOptionsDialog::needs_default_audiodev() { return true; } #else #error This operating system is not supported. #endif diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 344522b..fc68633 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -7,16 +7,19 @@ AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) m_parent = parent; ao_app = p_ao_app; m_movie = new QMovie(this); + last_image = ""; } void AOScene::set_image(QString p_image) { - QString background_path = ao_app->get_background_path(p_image + ".png"); - QString animated_background_path = ao_app->get_background_path(p_image + ".gif"); - QString default_path = ao_app->get_default_background_path(p_image + ".png"); + QString background_path = + ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + if (!file_exists(background_path)) + background_path = ao_app->get_image_suffix( + ao_app->get_default_background_path(p_image)); // Default path - QPixmap background(background_path); - QPixmap default_bg(default_path); + if (file_exists(background_path) && background_path == last_image) + return; int w = this->width(); int h = this->height(); @@ -25,52 +28,58 @@ void AOScene::set_image(QString p_image) this->setMovie(nullptr); m_movie->stop(); - m_movie->setFileName(animated_background_path); + m_movie->setFileName(background_path); m_movie->setScaledSize(QSize(w, h)); - if (m_movie->isValid()) - { + if (m_movie->isValid()) { this->setMovie(m_movie); m_movie->start(); } - else if (file_exists(background_path)) - { + else { + QPixmap background(background_path); this->setPixmap(background.scaled(w, h)); } - else - { - this->setPixmap(default_bg.scaled(w, h)); - } + last_image = background_path; } void AOScene::set_legacy_desk(QString p_image) { - //vanilla desks vary in both width and height. in order to make that work with viewport rescaling, - //some INTENSE math is needed. - QString desk_path = ao_app->get_background_path(p_image); - QString default_path = ao_app->get_default_background_path(p_image); + QString desk_path = + ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + if (!file_exists(desk_path)) + desk_path = ao_app->get_image_suffix( + ao_app->get_default_background_path(p_image)); // Default path - QPixmap f_desk; + if (file_exists(desk_path) && desk_path == last_image) + return; + QPixmap f_desk(desk_path); - if (file_exists(desk_path)) - f_desk.load(desk_path); - else - f_desk.load(default_path); + // vanilla desks vary in both width and height. in order to make that work + // with viewport rescaling, some INTENSE math is needed. int vp_width = m_parent->width(); int vp_height = m_parent->height(); - //double y_modifier = 147 / 192; - //double w_modifier = vp_width / 256; double h_modifier = vp_height / 192; - //int final_y = y_modifier * vp_height; - //int final_w = w_modifier * f_desk.width(); int final_h = static_cast(h_modifier * f_desk.height()); - //this->resize(final_w, final_h); - //this->setPixmap(f_desk.scaled(final_w, final_h)); - this->resize(vp_width, final_h); - this->setPixmap(f_desk.scaled(vp_width, final_h)); + this->clear(); + this->setMovie(nullptr); + + m_movie->stop(); + m_movie->setFileName(desk_path); + + m_movie->setScaledSize(QSize(vp_width, final_h)); + + if (m_movie->isValid()) { + this->setMovie(m_movie); + m_movie->start(); + } + else { + this->resize(vp_width, final_h); + this->setPixmap(f_desk.scaled(vp_width, final_h)); + } + last_image = desk_path; } diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp index 5e14632..c741569 100644 --- a/src/aotextarea.cpp +++ b/src/aotextarea.cpp @@ -5,7 +5,8 @@ AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) } -void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour) +void AOTextArea::append_chatmessage(QString p_name, QString p_message, + QString p_colour, bool song) { const QTextCursor old_cursor = this->textCursor(); const int old_scrollbar_value = this->verticalScrollBar()->value(); @@ -14,7 +15,12 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p this->moveCursor(QTextCursor::End); this->append(""); - this->insertHtml("" + p_name.toHtmlEscaped() + ": "); + if (song) + this->insertHtml("" + + p_name.toHtmlEscaped() + " "); + else + this->insertHtml("" + + p_name.toHtmlEscaped() + ": "); //cheap workarounds ahoy p_message += " "; diff --git a/src/charselect.cpp b/src/charselect.cpp index d6ee044..e942fbe 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -8,55 +8,51 @@ class AOCharSelectGenerationThreading : public QRunnable { public: - Courtroom *thisCourtroom; - int char_num; - AOCharButton *char_button; - AOCharSelectGenerationThreading(Courtroom *my_courtroom, int character_number, AOCharButton *charbut){ - thisCourtroom = my_courtroom; - char_num = character_number; - char_button = charbut; - } - void run() - { - AOCharButton* thisCharacterButton = char_button; - thisCharacterButton->reset(); - thisCharacterButton->hide(); - thisCharacterButton->set_image(thisCourtroom->char_list.at(char_num).name); - thisCourtroom->ui_char_button_list.append(thisCharacterButton); + Courtroom *thisCourtroom; + int char_num; + AOCharButton *char_button; + AOCharSelectGenerationThreading(Courtroom *my_courtroom, int character_number) + { + thisCourtroom = my_courtroom; + char_num = character_number; + } + void run() + { + // we take the button we are supposed to mess with, and not whatever comes + // first + AOCharButton *thisCharacterButton = + thisCourtroom->ui_char_button_list.at(char_num); + thisCharacterButton->reset(); + thisCharacterButton->hide(); + thisCharacterButton->set_image(thisCourtroom->char_list.at(char_num).name); - thisCourtroom->connect(thisCharacterButton, SIGNAL(clicked()), thisCourtroom->char_button_mapper, SLOT(map())); - thisCourtroom->char_button_mapper->setMapping(thisCharacterButton, thisCourtroom->ui_char_button_list.size() - 1); - } + thisCourtroom->connect(thisCharacterButton, SIGNAL(clicked()), + thisCourtroom->char_button_mapper, SLOT(map())); + thisCourtroom->char_button_mapper->setMapping(thisCharacterButton, + char_num); + } }; -class AOCharSelectFilterThreading : public QRunnable +void AOCharSelectFilter(Courtroom *thisCourtroom, int char_num) { -public: - Courtroom *thisCourtroom; - int char_num; - AOCharSelectFilterThreading(Courtroom *my_courtroom, int character_number){ - thisCourtroom = my_courtroom; - char_num = character_number; - } - void run() - { - AOCharButton* current_char = thisCourtroom->ui_char_button_list.at(char_num); + AOCharButton *current_char = thisCourtroom->ui_char_button_list.at(char_num); - if (!thisCourtroom->ui_char_taken->isChecked() && thisCourtroom->char_list.at(char_num).taken) - return; + if (!thisCourtroom->ui_char_taken->isChecked() && + thisCourtroom->char_list.at(char_num).taken) + return; - if (!thisCourtroom->char_list.at(char_num).name.contains(thisCourtroom->ui_char_search->text(), Qt::CaseInsensitive)) - return; + if (!thisCourtroom->char_list.at(char_num).name.contains( + thisCourtroom->ui_char_search->text(), Qt::CaseInsensitive)) + return; - // We only really need to update the fact that a character is taken - // for the buttons that actually appear. - // You'd also update the passwordedness and etc. here later. - current_char->reset(); - current_char->set_taken(thisCourtroom->char_list.at(char_num).taken); + // We only really need to update the fact that a character is taken + // for the buttons that actually appear. + // You'd also update the passwordedness and etc. here later. + current_char->reset(); + current_char->set_taken(thisCourtroom->char_list.at(char_num).taken); - thisCourtroom->ui_char_button_list_filtered.append(current_char); - } -}; + thisCourtroom->ui_char_button_list_filtered.append(current_char); +} void Courtroom::construct_char_select() { @@ -246,39 +242,40 @@ void Courtroom::character_loading_finished() ui_char_button_list.clear(); } - // First, we'll make all the character buttons in the very beginning. - // We also hide them all, so they can't be accidentally clicked. - // Later on, we'll be revealing buttons as we need them. - for (int n = 0; n < char_list.size(); n++) - { - AOCharButton* characterButton = new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); - AOCharSelectGenerationThreading *char_generate = new AOCharSelectGenerationThreading(this, n, characterButton); - QThreadPool::globalInstance()->start(char_generate); - if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount()) - { - QThreadPool::globalInstance()->waitForDone(); - } + // First, we'll make all the character buttons in the very beginning. + // Since we can't trust what will happen during the multi threading process, + // we assign the buttons their locations in the list according to the + // character list. + for (int n = 0; n < char_list.size(); n++) { + AOCharButton *characterButton = + new AOCharButton(ui_char_buttons, ao_app, 0, 0, char_list.at(n).taken); + ui_char_button_list.append(characterButton); + } + + // We also hide them all, so they can't be accidentally clicked. + // Later on, we'll be revealing buttons as we need them. + for (int n = 0; n < char_list.size(); n++) { + AOCharSelectGenerationThreading *char_generate = + new AOCharSelectGenerationThreading(this, n); + QThreadPool::globalInstance()->start(char_generate); + if (QThreadPool::globalInstance()->activeThreadCount() == + QThreadPool::globalInstance()->maxThreadCount()) { + QThreadPool::globalInstance()->waitForDone(); } - QThreadPool::globalInstance()->waitForDone(); - filter_character_list(); + } + QThreadPool::globalInstance()->waitForDone(); + filter_character_list(); } void Courtroom::filter_character_list() { - ui_char_button_list_filtered.clear(); - for (int i = 0; i < char_list.size(); i++) - { - AOCharSelectFilterThreading *char_filter = new AOCharSelectFilterThreading(this, i); - QThreadPool::globalInstance()->start(char_filter); - if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount()) - { - QThreadPool::globalInstance()->waitForDone(); - } - } - QThreadPool::globalInstance()->waitForDone(); + ui_char_button_list_filtered.clear(); + for (int i = 0; i < char_list.size(); i++) { + AOCharSelectFilter(this, i); + } - current_char_page = 0; - set_char_select_page(); + current_char_page = 0; + set_char_select_page(); } void Courtroom::on_char_search_changed() diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index 6c861f0..b96d502 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -5,25 +5,31 @@ chatlogpiece::chatlogpiece() name = "UNKNOWN"; showname = "UNKNOWN"; message = "UNKNOWN"; + color = 0; is_song = false; datetime = QDateTime::currentDateTime().toUTC(); } -chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song) +chatlogpiece::chatlogpiece(QString p_name, QString p_showname, + QString p_message, bool p_song, int p_color) { name = p_name; showname = p_showname; message = p_message; is_song = p_song; + color = p_color; datetime = QDateTime::currentDateTime().toUTC(); } -chatlogpiece::chatlogpiece(QString p_name, QString p_showname, QString p_message, bool p_song, QDateTime p_datetime) +chatlogpiece::chatlogpiece(QString p_name, QString p_showname, + QString p_message, bool p_song, int p_color, + QDateTime p_datetime) { name = p_name; showname = p_showname; message = p_message; is_song = p_song; + color = p_color; datetime = p_datetime.toUTC(); } @@ -57,6 +63,7 @@ QString chatlogpiece::get_datetime_as_string() return datetime.toString(); } +int chatlogpiece::get_chat_color() { return color; } QString chatlogpiece::get_full() { diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 6e5397e..71910ab 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -57,12 +57,6 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() realization_timer = new QTimer(this); realization_timer->setSingleShot(true); - testimony_show_timer = new QTimer(this); - testimony_show_timer->setSingleShot(true); - - testimony_hide_timer = new QTimer(this); - testimony_hide_timer->setSingleShot(true); - char_button_mapper = new QSignalMapper(this); music_player = new AOMusicPlayer(this, ao_app); @@ -78,9 +72,11 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() misc_sfx_player->set_volume(0); frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); frame_emote_sfx_player->set_volume(0); - pair_frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); // todo: recode pair + pair_frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); pair_frame_emote_sfx_player->set_volume(0); + char_button_mapper = new QSignalMapper(this); + blip_player = new AOBlipPlayer(this, ao_app); blip_player->set_volume(0); @@ -113,8 +109,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_vp_message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui_vp_message->setReadOnly(true); - ui_vp_testimony = new AOImage(this, ao_app); - ui_vp_realization = new AOImage(this, ao_app); + ui_vp_testimony = new AOMovie(this, ao_app); + ui_vp_testimony->set_play_once(false); + ui_vp_realization = new AOMovie(this, ao_app); ui_vp_wtce = new AOMovie(this, ao_app); ui_vp_objection = new AOMovie(this, ao_app); @@ -134,8 +131,20 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_server_chatlog->setOpenExternalLinks(true); ui_area_list = new QListWidget(this); - ui_area_list->hide(); - ui_music_list = new QListWidget(this); + + ui_music_list = new QTreeWidget(this); + ui_music_list->setColumnCount(2); + ui_music_list->hideColumn(1); + ui_music_list->setHeaderHidden(true); + ui_music_list->setContextMenuPolicy(Qt::CustomContextMenu); + ui_music_list->setAutoFillBackground(true); + ui_music_list->setExpandsOnDoubleClick(true); + ui_music_list->setRootIsDecorated(true); + ui_music_list->header()->setStretchLastSection(false); + ui_music_list->header()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui_music_list->setContextMenuPolicy(Qt::CustomContextMenu); + + ui_music_list->hide(); ui_ic_chat_name = new QLineEdit(this); ui_ic_chat_name->setFrame(false); @@ -158,6 +167,12 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ooc_chat_name->setMaxLength(30); ui_ooc_chat_name->setText(p_ao_app->get_default_username()); + punctuation_modifier = p_ao_app->get_pundelay(); + colorf_iclog = p_ao_app->get_colored_iclog_enabled(); + mirror_iclog = p_ao_app->get_iclmir_enabled(); + colorf_limit = p_ao_app->colorlog_restricted_enabled(); + keep_evidence_display = p_ao_app->is_keepevi_enabled(); + //ui_area_password = new QLineEdit(this); //ui_area_password->setFrame(false); ui_music_search = new QLineEdit(this); @@ -233,6 +248,9 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_pre_non_interrupt->hide(); ui_custom_objection = new AOButton(this, ao_app); + ui_custom_objection->setContextMenuPolicy(Qt::CustomContextMenu); + custom_obj_menu = new QMenu; + ui_realization = new AOButton(this, ao_app); ui_screenshake = new AOButton(this, ao_app); ui_mute = new AOButton(this, ao_app); @@ -296,31 +314,34 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() connect(realization_timer, SIGNAL(timeout()), this, SLOT(realization_done())); - connect(testimony_show_timer, SIGNAL(timeout()), this, SLOT(hide_testimony())); - connect(testimony_hide_timer, SIGNAL(timeout()), this, SLOT(show_testimony())); connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); + connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, + SLOT(on_mute_list_clicked(QModelIndex))); - connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed())); connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed())); - - connect(ui_music_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_music_list_double_clicked(QModelIndex))); - connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_area_list_double_clicked(QModelIndex))); - + connect(ui_music_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), + this, SLOT(on_music_list_double_clicked(QTreeWidgetItem *, int))); + connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, + SLOT(on_area_list_double_clicked(QModelIndex))); connect(ui_hold_it, SIGNAL(clicked()), this, SLOT(on_hold_it_clicked())); connect(ui_objection, SIGNAL(clicked()), this, SLOT(on_objection_clicked())); connect(ui_take_that, SIGNAL(clicked()), this, SLOT(on_take_that_clicked())); - connect(ui_custom_objection, SIGNAL(clicked()), this, SLOT(on_custom_objection_clicked())); connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked())); connect(ui_screenshake, SIGNAL(clicked()), this, SLOT(on_screenshake_clicked())); + connect(ui_custom_objection, SIGNAL(clicked()), this, + SLOT(on_custom_objection_clicked())); + connect(ui_custom_objection, + SIGNAL(customContextMenuRequested(const QPoint &)), this, + SLOT(ShowContextMenu(const QPoint &))); connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked())); connect(ui_defense_minus, SIGNAL(clicked()), this, SLOT(on_defense_minus_clicked())); @@ -509,14 +530,10 @@ void Courtroom::set_widgets() "color: white"); ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_testimony->resize(ui_viewport->width(), ui_viewport->height()); - ui_vp_testimony->set_image("testimony.png"); - ui_vp_testimony->hide(); + ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height()); ui_vp_realization->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_realization->resize(ui_viewport->width(), ui_viewport->height()); - ui_vp_realization->set_image("realizationflash.png"); - ui_vp_realization->hide(); + ui_vp_realization->combo_resize(ui_viewport->width(), ui_viewport->height()); ui_vp_wtce->move(ui_viewport->x(), ui_viewport->y()); ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height()); @@ -543,6 +560,10 @@ void Courtroom::set_widgets() set_size_and_pos(ui_area_list, "music_list"); ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + ui_music_list->setStyleSheet("background-color: rgba(100, 103, 132, 225);"); + + ui_music_list->collapseAll(); + set_size_and_pos(ui_music_list, "music_list"); if (is_ao2_bg) @@ -802,7 +823,7 @@ void Courtroom::set_fonts() set_font(ui_ms_chatlog, "ms_chatlog"); set_font(ui_server_chatlog, "server_chatlog"); set_font(ui_music_list, "music_list"); - set_font(ui_area_list, "music_list"); + set_font(ui_area_list, "area_list"); // Set color of labels and checkboxes const QString design_file = "courtroom_fonts.ini"; @@ -918,7 +939,7 @@ void Courtroom::done_received() void Courtroom::set_background(QString p_background) { - testimony_in_progress = false; + ui_vp_testimony->stop(); current_background = p_background; @@ -1020,11 +1041,24 @@ void Courtroom::enter_courtroom(int p_cid) ui_prosecution_plus->hide(); } - if (ao_app->custom_objection_enabled && - (file_exists(ao_app->get_character_path(current_char, "custom.gif")) || - file_exists(ao_app->get_character_path(current_char, "custom.apng"))) && - file_exists(ao_app->get_character_path(current_char, "custom.wav"))) + if (ao_app->custom_objection_enabled && // if setting is enabled + (file_exists(ao_app->get_image_suffix( + ao_app->get_character_path(current_char, "custom"))) && + file_exists(ao_app->get_character_path(current_char, "custom.wav")))) { ui_custom_objection->show(); + if (dir_exists( + ao_app->get_character_path(current_char, "custom_objections"))) { + custom_obj_menu->clear(); + QDir directory( + ao_app->get_character_path(current_char, "custom_objections")); + QStringList custom_obj = directory.entryList(QStringList() << "*.gif" + << "*.apng", + QDir::Files); + for (const QString &filename : custom_obj) { + custom_obj_menu->addAction(filename); + } + } + } else ui_custom_objection->hide(); @@ -1049,7 +1083,11 @@ void Courtroom::enter_courtroom(int p_cid) pair_frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); blip_player->set_volume(ui_blip_slider->value()); - testimony_in_progress = false; + misc_sfx_player->set_volume(ui_sfx_slider->value()); + frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); + pair_frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); + + ui_vp_testimony->stop(); set_widgets(); @@ -1064,7 +1102,6 @@ void Courtroom::enter_courtroom(int p_cid) void Courtroom::list_music() { ui_music_list->clear(); - music_row_to_number.clear(); QString f_file = "courtroom_design.ini"; @@ -1073,25 +1110,55 @@ void Courtroom::list_music() int n_listed_songs = 0; - for (int n_song = 0 ; n_song < music_list.size() ; ++n_song) - { + QTreeWidgetItem *parent = nullptr; + for (int n_song = 0; n_song < music_list.size(); ++n_song) { QString i_song = music_list.at(n_song); + QString i_song_listname = i_song.left(i_song.lastIndexOf(".")); + i_song_listname = i_song_listname.right( + i_song_listname.length() - (i_song_listname.lastIndexOf("/") + 1)); - if (i_song.toLower().contains(ui_music_search->text().toLower())) + QTreeWidgetItem *treeItem; + if (i_song_listname != i_song && parent != nullptr && + i_song.toLower().contains( + ui_music_search->text().toLower())) // not a category, parent exists { - ui_music_list->addItem(i_song); - music_row_to_number.append(n_song); + treeItem = new QTreeWidgetItem(parent); + treeItem->setText(0, i_song_listname); + treeItem->setText(1, i_song); + + QString song_path = ao_app->get_music_path(i_song); + + if (file_exists(song_path)) + treeItem->setBackground(0, found_brush); + else + treeItem->setBackground(0, missing_brush); + + if (i_song_listname == + i_song) // Not supposed to be a song to begin with - a category? + parent = treeItem; + ++n_listed_songs; + } + else if (i_song_listname == i_song) { + treeItem = new QTreeWidgetItem(ui_music_list); + treeItem->setText(0, i_song_listname); + treeItem->setText(1, i_song); QString song_path = ao_app->get_music_path(i_song); if (file_exists(song_path)) - ui_music_list->item(n_listed_songs)->setBackground(found_brush); + treeItem->setBackground(0, found_brush); else - ui_music_list->item(n_listed_songs)->setBackground(missing_brush); + treeItem->setBackground(0, missing_brush); + if (i_song_listname == + i_song) // Not supposed to be a song to begin with - a category? + parent = treeItem; ++n_listed_songs; } } + ui_music_list->expandAll(); // Needs to somehow remember which categories were + // expanded/collapsed if the music list didn't + // change since last time } void Courtroom::list_areas() @@ -1192,7 +1259,7 @@ void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QSt append_server_chatmessage("CLIENT", tr("You were granted the Disable Modcalls button."), "1"); } - ui_server_chatlog->append_chatmessage(p_name, p_message, colour); + ui_server_chatlog->append_chatmessage(p_name, p_message, colour, false); } void Courtroom::detect_fallback_text() @@ -1344,11 +1411,9 @@ void Courtroom::on_chat_return_pressed() int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote); //needed or else legacy won't understand what we're saying - if (objection_state > 0) - { - if (ui_pre->isChecked()) - { - if (f_emote_mod == 5) + if (objection_state > 0) { + if (ui_pre->isChecked()) { + if (f_emote_mod == 5 || f_emote_mod == 4) f_emote_mod = 6; else f_emote_mod = 2; @@ -1379,6 +1444,11 @@ void Courtroom::on_chat_return_pressed() if ((objection_state == 4 && !ao_app->custom_objection_enabled) || (objection_state < 0)) f_obj_state = "0"; + else if (objection_custom != "" && objection_state == 4) { + f_obj_state = QString::number(objection_state) + "&" + + objection_custom; // we add the name of the objection so the + // packet is like: 4&(name of custom obj) + } else f_obj_state = QString::number(objection_state); @@ -1496,8 +1566,9 @@ void Courtroom::on_chat_return_pressed() threading_flash = preemote_flash; for(int i=0; i < frame_emote_checker->frameCount(); i++){ - AOFrameThreadingPre *testfuck = new AOFrameThreadingPre(this, i); - QThreadPool::globalInstance()->start(testfuck); + AOFrameThreadingPre *frame_thread = new AOFrameThreadingPre(this, i); + QThreadPool::globalInstance()->start(frame_thread); + frame_thread->setAutoDelete(true); } QThreadPool::globalInstance()->waitForDone(); preemote_sfx = threading_sfx; @@ -1525,8 +1596,9 @@ void Courtroom::on_chat_return_pressed() threading_prefix = QString("(b)"); for(int i=0; i < frame_emote_checker->frameCount(); i++){ - AOFrameThreading *testfuck = new AOFrameThreading(this, i); - QThreadPool::globalInstance()->start(testfuck); + AOFrameThreading *frame_thread = new AOFrameThreading(this, i); + QThreadPool::globalInstance()->start(frame_thread); + frame_thread->setAutoDelete(true); } QThreadPool::globalInstance()->waitForDone(); @@ -1554,8 +1626,9 @@ void Courtroom::on_chat_return_pressed() threading_flash = idleemote_flash; threading_prefix = QString("(a)"); for(int i=0; i < frame_emote_checker->frameCount(); i++){ - AOFrameThreading *testfuck = new AOFrameThreading(this, i); - QThreadPool::globalInstance()->start(testfuck); + AOFrameThreading *frame_thread = new AOFrameThreading(this, i); + QThreadPool::globalInstance()->start(frame_thread); + frame_thread->setAutoDelete(true); } QThreadPool::globalInstance()->waitForDone(); idleemote_sfx = threading_sfx; @@ -1578,7 +1651,8 @@ void Courtroom::on_chat_return_pressed() packet_contents.append(frame_screenshake); packet_contents.append(frame_realization); packet_contents.append(frame_sfx); - } + } // Honestly this is a copy paste dump and I have no idea what this does. If + // this breaks blame aov thanks ao_app->send_server_packet(new AOPacket("MS", packet_contents)); } void Courtroom::handle_chatmessage(QStringList *p_contents) @@ -1635,7 +1709,9 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) text_state = 0; anim_state = 0; ui_vp_objection->stop(); + // ui_vp_player_char->stop(); chat_tick_timer->stop(); + if (keep_evidence_display) ui_vp_evidence_display->reset(); chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; @@ -1644,6 +1720,8 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) { ui_ic_chat_message->clear(); objection_state = 0; + objection_custom = ""; + char_name = m_chatmessage[CHAR_NAME]; realization_state = 0; screenshake_state = 0; is_presenting_evidence = false; @@ -1655,47 +1733,78 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_realization->set_image("realization.png"); ui_screenshake->set_image("screenshake.png"); ui_evidence_present->set_image("present_disabled.png"); + ui_screenshake->set_image("screenshake.png"); } - chatlogpiece* temp = new chatlogpiece(ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false); + QString tmpmsg = ""; + chatlogpiece *temp = new chatlogpiece( + ao_app->get_showname(char_list.at(f_char_id).name), f_showname, + ": " + m_chatmessage[MESSAGE], false, m_chatmessage[TEXT_COLOR].toInt()); + ic_chatlog_history.append(*temp); while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { ic_chatlog_history.removeFirst(); } + refresh_iclog(true); - append_ic_text(": " + m_chatmessage[MESSAGE], f_showname); + if (f_showname == "") + f_showname = m_chatmessage[CHAR_NAME]; + if (!mirror_iclog) + append_ic_text(": " + m_chatmessage[MESSAGE], f_showname, false, true, + false, m_chatmessage[TEXT_COLOR].toInt()); previous_ic_message = f_message; - - int objection_mod = m_chatmessage[OBJECTION_MOD].toInt(); - QString f_char = m_chatmessage[CHAR_NAME]; + bool ok; + int objection_mod = m_chatmessage[OBJECTION_MOD].toInt( + &ok, 10); // checks if its a custom obj. + QString custom_objection = ""; + if (!ok && m_chatmessage[OBJECTION_MOD].contains("4&")) { + objection_mod = 4; + custom_objection = m_chatmessage[OBJECTION_MOD].split( + "4&")[1]; // takes the name of custom objection. + } + QString f_char = char_name; + f_char = m_chatmessage[CHAR_NAME]; QString f_custom_theme = ao_app->get_char_shouts(f_char); - + ui_vp_message->clear(); + ui_vp_chatbox->hide(); //if an objection is used if (objection_mod <= 4 && objection_mod >= 1) { switch (objection_mod) { case 1: - ui_vp_objection->play("holdit", f_char, f_custom_theme); + ui_vp_objection->play("holdit", f_char, f_custom_theme, shout_stay_time); objection_player->play("holdit.wav", f_char, f_custom_theme); break; case 2: - ui_vp_objection->play("objection", f_char, f_custom_theme); + ui_vp_objection->play("objection", f_char, f_custom_theme, + shout_stay_time); objection_player->play("objection.wav", f_char, f_custom_theme); if(ao_app->get_objectmusic()) music_player->kill_loop(); break; case 3: - ui_vp_objection->play("takethat", f_char, f_custom_theme); + ui_vp_objection->play("takethat", f_char, f_custom_theme, + shout_stay_time); objection_player->play("takethat.wav", f_char, f_custom_theme); break; //case 4 is AO2 only case 4: - ui_vp_objection->play("custom", f_char, f_custom_theme); + if (custom_objection != "") { + ui_vp_objection->play("custom_objections/" + custom_objection, f_char, + f_custom_theme, shout_stay_time); + objection_player->play("custom_objections/" + + custom_objection.split('.')[0] + ".wav", + f_char, f_custom_theme); + } + else { + ui_vp_objection->play("custom", f_char, f_custom_theme, + shout_stay_time); objection_player->play("custom.wav", f_char, f_custom_theme); + } break; default: qDebug() << "W: Logic error in objection switch statement!"; @@ -1718,16 +1827,18 @@ void Courtroom::objection_done() void Courtroom::handle_chatmessage_2() { ui_vp_speedlines->stop(); - ui_vp_player_char->stop(); + // ui_vp_player_char->stop(); ui_vp_player_char->frame_sfx_hellstring = m_chatmessage[FRAME_SFX]; - ui_vp_player_char->frame_realization_hellstring = m_chatmessage[FRAME_REALIZATION]; - ui_vp_player_char->frame_screenshake_hellstring = m_chatmessage[FRAME_SCREENSHAKE]; + ui_vp_player_char->frame_realization_hellstring = + m_chatmessage[FRAME_REALIZATION]; + ui_vp_player_char->frame_screenshake_hellstring = + m_chatmessage[FRAME_SCREENSHAKE]; ui_vp_player_char->use_networked_framehell = true; if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; - QString f_showname = ao_app->get_showname(real_name); + QString f_showname = ao_app->get_showname(m_chatmessage[CHAR_NAME]); ui_vp_showname->setText(f_showname); } @@ -1736,10 +1847,8 @@ void Courtroom::handle_chatmessage_2() ui_vp_showname->setText(m_chatmessage[SHOWNAME]); } - ui_vp_message->clear(); - ui_vp_chatbox->hide(); - - QString chatbox = ao_app->get_chat(m_chatmessage[CHAR_NAME]); + QString f_char = m_chatmessage[CHAR_NAME]; + QString chatbox = ao_app->get_chat(f_char); if (chatbox == "") ui_vp_chatbox->set_image("chatmed.png"); @@ -1795,6 +1904,8 @@ void Courtroom::handle_chatmessage_2() ui_vp_player_char->set_flipped(false); QString side = m_chatmessage[SIDE]; + if (side != "wit") + ui_vp_testimony->stop(); // Making the second character appear. if (m_chatmessage[OTHER_CHARID].isEmpty()) @@ -1952,6 +2063,7 @@ void Courtroom::handle_chatmessage_2() qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); } } +void Courtroom::realization_done() { ui_vp_realization->hide(); } void Courtroom::doScreenShake() { @@ -2004,8 +2116,40 @@ void Courtroom::doScreenShake() void Courtroom::handle_chatmessage_3() { - start_chat_ticking(); + if (!log_goes_downwards && mirror_iclog) + ui_ic_chatlog->moveCursor(QTextCursor::Start); + else if (mirror_iclog) + ui_ic_chatlog->moveCursor(QTextCursor::End); + + ui_ic_chatlog->setTextInteractionFlags(Qt::TextSelectableByMouse); + if (mirror_iclog) { + if (!ui_showname_enable->isChecked() || m_chatmessage[SHOWNAME] == "") { + if (first_message_sent && log_goes_downwards) + ui_ic_chatlog->textCursor().insertHtml("
"); + else + first_message_sent = true; + + ui_ic_chatlog->textCursor().insertHtml("" + m_chatmessage[CHAR_NAME] + + ": "); + } + else { + if (first_message_sent && log_goes_downwards) + ui_ic_chatlog->textCursor().insertHtml("
"); + else + first_message_sent = true; + + ui_ic_chatlog->textCursor().insertHtml("" + m_chatmessage[SHOWNAME] + + ": "); + } + + QScrollBar *scroll = ui_vp_message->verticalScrollBar(); + scroll->setValue(scroll->maximum()); + if (chatmessage_is_empty && log_goes_downwards) { + ui_ic_chatlog->moveCursor(QTextCursor::End); + } + } + start_chat_ticking(); int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); QString f_side = m_chatmessage[SIDE]; @@ -2062,7 +2206,9 @@ void Courtroom::handle_chatmessage_3() return; ui_vp_player_char->stop(); - QString f_char = m_chatmessage[CHAR_NAME]; + + QString f_char = ""; + f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; if (f_anim_state == 2) { @@ -2091,11 +2237,12 @@ void Courtroom::handle_chatmessage_3() } -QString Courtroom::filter_ic_text(QString p_text) +QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, + int chat_color) { + // BMKCOMMENT // Get rid of centering. - if(p_text.startsWith(": ~~")) - { + if (p_text.startsWith(": ~~")) { // Don't forget, the p_text part actually everything after the name! // Hence why we check for ': ~~'. @@ -2108,139 +2255,243 @@ QString Courtroom::filter_ic_text(QString p_text) // Get rid of the inline-colouring. // I know, I know, excessive code duplication. // Nobody looks in here, I'm fine. - int trick_check_pos = 0; + int trick_check_pos = 1; bool ic_next_is_not_special = false; QString f_character = p_text.at(trick_check_pos); std::stack ic_colour_stack; - while (trick_check_pos < p_text.size()) - { + QString final_text = ": "; + bool delay_pop = false; + while (trick_check_pos < p_text.size()) { f_character = p_text.at(trick_check_pos); - + if (!skip_filter) { + if (f_character == "<") + f_character = "<"; + else if (f_character == ">") + f_character = ">"; + } // Escape character. - if (f_character == "\\" and !ic_next_is_not_special) - { + if (f_character == "\\" and !ic_next_is_not_special) { ic_next_is_not_special = true; p_text.remove(trick_check_pos,1); + f_character = ""; + if (p_text[trick_check_pos] == 'n') { + p_text[trick_check_pos] = ' '; + f_character = " "; + } } // Text speed modifier. - else if (f_character == "{" and !ic_next_is_not_special) - { + else if ((f_character == "{" || f_character == "}") && + !ic_next_is_not_special) { p_text.remove(trick_check_pos,1); + f_character = ""; } - else if (f_character == "}" and !ic_next_is_not_special) - { + else if (f_character == "$" and !ic_next_is_not_special) { p_text.remove(trick_check_pos,1); + f_character = ""; } - - else if (f_character == "$" and !ic_next_is_not_special) - { + else if (f_character == "@" and !ic_next_is_not_special) { p_text.remove(trick_check_pos,1); + f_character = ""; } - else if (f_character == "@" and !ic_next_is_not_special) - { - p_text.remove(trick_check_pos,1); - } - - // Orange inline colourisation. - else if (f_character == "|" and !ic_next_is_not_special) - { - if (!ic_colour_stack.empty()) - { - if (ic_colour_stack.top() == INLINE_ORANGE) - { + else if (f_character == "|" and !ic_next_is_not_special) { + if (!ic_colour_stack.empty()) { + if (ic_colour_stack.top() == INLINE_ORANGE) { ic_colour_stack.pop(); p_text.remove(trick_check_pos,1); } - else - { + else { ic_colour_stack.push(INLINE_ORANGE); p_text.remove(trick_check_pos,1); } } - else - { + else { ic_colour_stack.push(INLINE_ORANGE); p_text.remove(trick_check_pos,1); } + f_character = ""; } // Blue inline colourisation. - else if (f_character == "(" and !ic_next_is_not_special) - { + else if (f_character == "(" and !ic_next_is_not_special) { ic_colour_stack.push(INLINE_BLUE); + if (!colorf_iclog) trick_check_pos++; } - else if (f_character == ")" and !ic_next_is_not_special - and !ic_colour_stack.empty()) - { - if (ic_colour_stack.top() == INLINE_BLUE) - { - ic_colour_stack.pop(); + else if (f_character == ")" and !ic_next_is_not_special and + !ic_colour_stack.empty()) { + if (ic_colour_stack.top() == INLINE_BLUE) { + // ic_colour_stack.pop(); + delay_pop = true; + if (!colorf_iclog) trick_check_pos++; } - else - { + else { ic_next_is_not_special = true; } } // Grey inline colourisation. - else if (f_character == "[" and !ic_next_is_not_special) - { + else if (f_character == "[" and !ic_next_is_not_special) { ic_colour_stack.push(INLINE_GREY); + if (!colorf_iclog) trick_check_pos++; } - else if (f_character == "]" and !ic_next_is_not_special - and !ic_colour_stack.empty()) - { - if (ic_colour_stack.top() == INLINE_GREY) - { - ic_colour_stack.pop(); + else if (f_character == "]" and !ic_next_is_not_special and + !ic_colour_stack.empty()) { + if (ic_colour_stack.top() == INLINE_GREY) { + // ic_colour_stack.pop(); + delay_pop = true; + if (!colorf_iclog) trick_check_pos++; } - else - { + else { ic_next_is_not_special = true; } } // Green inline colourisation. - else if (f_character == "`" and !ic_next_is_not_special) - { - if (!ic_colour_stack.empty()) - { - if (ic_colour_stack.top() == INLINE_GREEN) - { + else if (f_character == "`" and !ic_next_is_not_special) { + if (!ic_colour_stack.empty()) { + if (ic_colour_stack.top() == INLINE_GREEN) { ic_colour_stack.pop(); p_text.remove(trick_check_pos,1); } - else - { + else { ic_colour_stack.push(INLINE_GREEN); p_text.remove(trick_check_pos,1); } } - else - { + else { ic_colour_stack.push(INLINE_GREEN); p_text.remove(trick_check_pos,1); } + f_character = ""; } - else - { - trick_check_pos++; + + if (colorf_iclog && f_character != "") { ic_next_is_not_special = false; + if (!ic_colour_stack.empty()) { + // p_text.remove(trick_check_pos,1); + trick_check_pos++; + switch (ic_colour_stack.top()) { + case INLINE_ORANGE: + final_text += "" + + f_character + ""; + break; + case INLINE_BLUE: + final_text += "" + + f_character + ""; + break; + case INLINE_GREEN: + final_text += "" + + f_character + ""; + break; + case INLINE_GREY: + final_text += "" + + f_character + ""; + break; + } + if (delay_pop) { + ic_colour_stack.pop(); + delay_pop = false; + } + } + else if (!(chat_color == WHITE || chat_color == RAINBOW) && + !colorf_limit) { + trick_check_pos++; + QString html_color; + switch (chat_color) { + case 1: + html_color = get_text_color(QString::number(GREEN)).name(); + break; + case 2: + html_color = get_text_color(QString::number(RED)).name(); + break; + case 3: + html_color = get_text_color(QString::number(ORANGE)).name(); + break; + case 4: + html_color = get_text_color(QString::number(BLUE)).name(); + break; + case 5: + html_color = get_text_color(QString::number(YELLOW)).name(); + break; + case 7: + html_color = get_text_color(QString::number(PINK)).name(); + break; + case 8: + html_color = get_text_color(QString::number(CYAN)).name(); + break; + } + final_text += + "" + f_character + ""; + } + else if (chat_color == RAINBOW && !colorf_limit) { + QString html_color; + + switch (rainbow_counter) { + case 0: + html_color = get_text_color(QString::number(RED)).name(); + break; + case 1: + html_color = get_text_color(QString::number(ORANGE)).name(); + break; + case 2: + html_color = get_text_color(QString::number(YELLOW)).name(); + break; + case 3: + html_color = get_text_color(QString::number(GREEN)).name(); + break; + default: + html_color = get_text_color(QString::number(BLUE)).name(); + rainbow_counter = -1; + } + + ++rainbow_counter; + final_text += + "" + f_character + ""; + trick_check_pos++; + } + + else { + final_text += f_character; + trick_check_pos++; + } + } + else if (f_character != "") { + trick_check_pos++; } } + if (colorf_iclog) + return final_text; + else { return p_text; } +} +/* + * Appends text to the ic log. + * \param p_text The text to be appended + * \param p_name The name of the character/entity who sent said text + * \param is_songchange Whether we are appending a song entry + * \param force_filter If we are sending plain text and we want to force the + * filtering regardless of its status (e.g chat entry, song change etc) \param + * skip_filter If we are sending appending text such as html so we skip the + * filter \param chat_color The color of the message sent + */ -void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchange) +void Courtroom::append_ic_text(QString p_text, QString p_name, + bool is_songchange, bool force_filter, + bool skip_filter, int chat_color) { + QTextCharFormat bold; QTextCharFormat normal; QTextCharFormat italics; @@ -2250,97 +2501,138 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchang const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); - if (!is_songchange) - p_text = filter_ic_text(p_text); + if ((!is_songchange && !mirror_iclog) || force_filter) + p_text = filter_ic_text(p_text, skip_filter, chat_color); - if (log_goes_downwards) - { - const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); + if (log_goes_downwards) { + const bool is_scrolled_down = + old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); ui_ic_chatlog->moveCursor(QTextCursor::End); - + if (!(is_songchange && mirror_iclog)) { + // The only case where no new log entry should be made is when there is a + // music entry while mirror log is active This is to protect the log, as + // if there is a songchange during a new message being typed, then they + // will destructively interfere with eachother + + // If the first message hasn't been sent, and we are handling basic + // text, we put the name without the newline. if (!first_message_sent) - { ui_ic_chatlog->textCursor().insertText(p_name, bold); - first_message_sent = true; - } - else - { + + else if (force_filter || is_songchange || !mirror_iclog) { + // Otherwise we just add the plaintext with the new line. ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); } + first_message_sent = true; - if (is_songchange) - { + if (is_songchange) { + // If its a song with mirror mode enabled, we do not need to repeat it + // as it is already shown in the ooc. ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); } - else - { - ui_ic_chatlog->textCursor().insertText(p_text, normal); + + else if (colorf_iclog && (!mirror_iclog || force_filter)) { + // if we are handling already formatted text and we have enabled colors + // in the iclog, then we insert the text + ui_ic_chatlog->textCursor().insertHtml(p_text); } + else if ((!colorf_iclog && !mirror_iclog) || force_filter) { + // If html is not enabled then we insert it as plain text. + ui_ic_chatlog->textCursor().insertText(p_text, normal); + } + } // If we got too many blocks in the current log, delete some from the top. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) - { + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && + log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); ui_ic_chatlog->textCursor().removeSelectedText(); ui_ic_chatlog->textCursor().deleteChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << + // log_maximum_blocks; } - if (old_cursor.hasSelection() || !is_scrolled_down) - { - // The user has selected text or scrolled away from the bottom: maintain position. + if (old_cursor.hasSelection() || !is_scrolled_down) { + // The user has selected text or scrolled away from the bottom: maintain + // position. ui_ic_chatlog->setTextCursor(old_cursor); ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); } - else - { - // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. + else { + // The user hasn't selected any text and the scrollbar is at the bottom: + // scroll to the bottom. ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); + ui_ic_chatlog->verticalScrollBar()->setValue( + ui_ic_chatlog->verticalScrollBar()->maximum()); } } - else - { - const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); + else { + const bool is_scrolled_up = + old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); ui_ic_chatlog->moveCursor(QTextCursor::Start); + if (!(is_songchange && mirror_iclog)) { + // The only case where no new log entry should be made is when there is a + // music entry while mirror log is active This is to protect the log, as + // if there is a songchange during a new message being typed, then they + // will destructively interfere with eachother + + if ((force_filter || !mirror_iclog || is_songchange)) { + + if (mirror_iclog) + // If mirror is enabled we need to make space on the top so the text + // can be inserted without any interuptions If mirror mode is not + // enabled, then we do not need to clear out the top line as the new + // entry pushes it automatically down. + p_name = '\n' + p_name; + + if (!first_message_sent) + first_message_sent = true; ui_ic_chatlog->textCursor().insertText(p_name, bold); + } - if (is_songchange) - { + if (is_songchange) { ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); } - else - { - ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); - } - // If we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) - { + else if (colorf_iclog && (!mirror_iclog || force_filter)) { + ui_ic_chatlog->textCursor().insertHtml(p_text); + } + else if ((!colorf_iclog && !mirror_iclog) || force_filter) { + ui_ic_chatlog->textCursor().insertText(p_text, normal); + } + if (!mirror_iclog) + ui_ic_chatlog->textCursor().insertHtml("
"); + } + // If we got too many blocks in the current log, delete some from the + // bottom. + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && + log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); ui_ic_chatlog->textCursor().removeSelectedText(); ui_ic_chatlog->textCursor().deletePreviousChar(); - //qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << log_maximum_blocks; + // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << + // log_maximum_blocks; } - if (old_cursor.hasSelection() || !is_scrolled_up) - { - // The user has selected text or scrolled away from the top: maintain position. + if (old_cursor.hasSelection() || !is_scrolled_up) { + // The user has selected text or scrolled away from the top: maintain + // position. ui_ic_chatlog->setTextCursor(old_cursor); ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); } - else - { - // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. + else { + // The user hasn't selected any text and the scrollbar is at the top: + // scroll to the top. ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); + ui_ic_chatlog->verticalScrollBar()->setValue( + ui_ic_chatlog->verticalScrollBar()->minimum()); } } } @@ -2395,18 +2687,12 @@ void Courtroom::preanim_done() handle_chatmessage_3(); } -void Courtroom::realization_done() -{ - ui_vp_realization->hide(); -} - void Courtroom::doRealization() { + realization_timer->stop(); if(!ao_app->is_shakeandflash_enabled()) return; - realization_timer->start(60); - ui_vp_realization->show(); - + ui_vp_realization->play("realizationflash", "", "", 90); } void Courtroom::start_chat_ticking() @@ -2455,7 +2741,8 @@ void Courtroom::start_chat_ticking() current_display_speed = 3; chat_tick_timer->start(message_display_speed[current_display_speed]); - QString f_gender = ao_app->get_gender(m_chatmessage[CHAR_NAME]); + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_gender = ao_app->get_gender(f_char); blip_player->set_blips(ao_app->get_sfx_suffix("sfx-blip" + f_gender)); @@ -2467,12 +2754,15 @@ void Courtroom::chat_tick() { //note: this is called fairly often(every 60 ms when char is talking) //do not perform heavy operations here - + QString timem = QString::number(realization_timer->remainingTime()); + qDebug() << "TIME: " << timem; QString f_message = m_chatmessage[MESSAGE]; + // f_message.remove(0, tick_pos); SAFECHECK + // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); - + int msg_delay = message_display_speed[current_display_speed]; // Stops blips from playing when we have a formatting option. bool formatting_char = false; @@ -2482,205 +2772,266 @@ void Courtroom::chat_tick() { f_message.remove(0,2); } + QString f_char = m_chatmessage[CHAR_NAME]; + if (log_goes_downwards && mirror_iclog) + ui_ic_chatlog->moveCursor(QTextCursor::End); + else if (!log_goes_downwards && mirror_iclog) + // ui_ic_chatlog->setTextCursor(); + ui_ic_chatlog->moveCursor(QTextCursor::EndOfLine); - if (tick_pos >= f_message.size()) - { + if (tick_pos >= f_message.size()) { text_state = 2; - if (anim_state != 4) - { + if (mirror_iclog) { + // After we are finished printing the text we log it in the ic log. + append_ic_text(m_chatmessage[MESSAGE], m_chatmessage[CHAR_NAME], false); + if (log_goes_downwards) + ui_ic_chatlog->moveCursor(QTextCursor::End); + else + ui_ic_chatlog->moveCursor(QTextCursor::Start); + } + if (anim_state != 4) { anim_state = 3; - ui_vp_player_char->play_idle(m_chatmessage[CHAR_NAME], m_chatmessage[EMOTE]); + ui_vp_player_char->play_idle(f_char, m_chatmessage[EMOTE]); } } - else - { + else { QString f_character = f_message.at(tick_pos); + f_character = f_character.toHtmlEscaped(); + if (punctuation_chars.contains(f_character)) { + msg_delay *= punctuation_modifier; + // ui_vp_message->insertPlainText(f_character); + } - if (f_character == " ") + if (f_character == " ") { ui_vp_message->insertPlainText(" "); + if (mirror_iclog) + ui_ic_chatlog->insertPlainText(" "); + } + else if (f_character == "@" and !next_character_is_not_special) { + this->doScreenShake(); + formatting_char = true; + } + else if (f_character == "^" and !next_character_is_not_special) { + this->doRealization(); + + formatting_char = true; + } // Escape character. - else if (f_character == "\\" and !next_character_is_not_special) - { + else if (f_character == "\\") { + if (f_message[tick_pos + 1] == 'n') { + ui_vp_message->insertHtml("
"); + ui_ic_chatlog->insertPlainText(" "); + + tick_pos += 1; + next_character_is_not_special = false; + formatting_char = true; + } + else next_character_is_not_special = true; formatting_char = true; + msg_delay++; } // Text speed modifier. - else if (f_character == "{" and !next_character_is_not_special) - { + else if (f_character == "{" and !next_character_is_not_special) { // ++, because it INCREASES delay! current_display_speed++; + msg_delay++; formatting_char = true; } - else if (f_character == "}" and !next_character_is_not_special) - { + else if (f_character == "}" and !next_character_is_not_special) { current_display_speed--; + msg_delay++; formatting_char = true; } - else if (f_character == "@" and !next_character_is_not_special) - { + else if (f_character == "@" and !next_character_is_not_special) { this->doScreenShake(); formatting_char = true; } - else if (f_character == "$" and !next_character_is_not_special) - { + else if (f_character == "$" and !next_character_is_not_special) { this->doRealization(); formatting_char = true; } // Orange inline colourisation. - else if (f_character == "|" and !next_character_is_not_special) - { - if (!inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_ORANGE) - { + else if (f_character == "|" and !next_character_is_not_special) { + if (!inline_colour_stack.empty()) { + if (inline_colour_stack.top() == INLINE_ORANGE) { inline_colour_stack.pop(); } - else - { + else { inline_colour_stack.push(INLINE_ORANGE); } } - else - { + else { inline_colour_stack.push(INLINE_ORANGE); } formatting_char = true; + msg_delay++; } // Blue inline colourisation. - else if (f_character == "(" and !next_character_is_not_special) + else if (f_character == "(" and + !next_character_is_not_special) // EXAMPLE HERE { inline_colour_stack.push(INLINE_BLUE); - ui_vp_message->insertHtml("" + f_character + ""); - + ui_vp_message->insertHtml("" + f_character + ""); + if (mirror_iclog && colorf_iclog) + ui_ic_chatlog->insertHtml("" + f_character + ""); // Increase how deep we are in inline blues. inline_blue_depth++; // Here, we check if the entire message is blue. // If it isn't, we stop talking. - if (!entire_message_is_blue and anim_state != 4) - { - QString f_char = m_chatmessage[CHAR_NAME]; + if (!entire_message_is_blue and anim_state != 4) { + f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; ui_vp_player_char->play_idle(f_char, f_emote); } } - else if (f_character == ")" and !next_character_is_not_special - and !inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_BLUE) - { + else if (f_character == ")" and !next_character_is_not_special and + !inline_colour_stack.empty()) { + if (inline_colour_stack.top() == INLINE_BLUE) { inline_colour_stack.pop(); - ui_vp_message->insertHtml("" + f_character + ""); - + ui_vp_message->insertHtml("" + f_character + ""); + if (mirror_iclog && colorf_iclog) + ui_ic_chatlog->insertHtml( + "" + f_character + ""); // Decrease how deep we are in inline blues. // Just in case, we do a check if we're above zero, but we should be. - if (inline_blue_depth > 0) - { + if (inline_blue_depth > 0) { inline_blue_depth--; // Here, we check if the entire message is blue. - // If it isn't, we start talking if we have completely climbed out of inline blues. - if (!entire_message_is_blue) - { - // We should only go back to talking if we're out of inline blues, not during a non. int. pre, and not on the last character. - if (inline_blue_depth == 0 and anim_state != 4 and !(tick_pos+1 >= f_message.size())) - { - QString f_char = m_chatmessage[CHAR_NAME]; + // If it isn't, we start talking if we have completely climbed out of + // inline blues. + if (!entire_message_is_blue) { + // We should only go back to talking if we're out of inline blues, + // not during a non. int. pre, and not on the last character. + if (inline_blue_depth == 0 and anim_state != 4 and + !(tick_pos + 1 >= f_message.size())) { + QString f_char = char_name; + f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; ui_vp_player_char->play_talking(f_char, f_emote); } } } } - else - { + else { next_character_is_not_special = true; tick_pos--; } } // Grey inline colourisation. - else if (f_character == "[" and !next_character_is_not_special) - { + else if (f_character == "[" and !next_character_is_not_special) { inline_colour_stack.push(INLINE_GREY); - ui_vp_message->insertHtml("" + f_character + ""); - } - else if (f_character == "]" and !next_character_is_not_special - and !inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_GREY) - { + ui_vp_message->insertHtml("" + + f_character + ""); + if (mirror_iclog && colorf_iclog) + ui_ic_chatlog->insertHtml("" + f_character + ""); + } + else if (f_character == "]" and !next_character_is_not_special and + !inline_colour_stack.empty()) { + if (inline_colour_stack.top() == INLINE_GREY) { inline_colour_stack.pop(); - ui_vp_message->insertHtml("" + f_character + ""); - } - else - { + ui_vp_message->insertHtml("" + f_character + ""); + if (mirror_iclog && colorf_iclog) + ui_ic_chatlog->insertHtml("" + f_character + ""); + } + else { next_character_is_not_special = true; tick_pos--; } } // Green inline colourisation. - else if (f_character == "`" and !next_character_is_not_special) - { - if (!inline_colour_stack.empty()) - { - if (inline_colour_stack.top() == INLINE_GREEN) - { + else if (f_character == "`" and !next_character_is_not_special) { + if (!inline_colour_stack.empty()) { + if (inline_colour_stack.top() == INLINE_GREEN) { inline_colour_stack.pop(); - formatting_char = true; } - else - { + else { inline_colour_stack.push(INLINE_GREEN); - formatting_char = true; } } - else - { + else { inline_colour_stack.push(INLINE_GREEN); - formatting_char = true; } + msg_delay++; + formatting_char = true; } - else - { + else { + next_character_is_not_special = false; - if (!inline_colour_stack.empty()) - { + if (!inline_colour_stack.empty()) { switch (inline_colour_stack.top()) { case INLINE_ORANGE: - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml( + "" + + f_character + ""); + if (mirror_iclog && colorf_iclog) + ui_ic_chatlog->insertHtml( + "" + + f_character + ""); break; case INLINE_BLUE: - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml( + "" + f_character + ""); + if (mirror_iclog && colorf_iclog) + ui_ic_chatlog->insertHtml( + "" + + f_character + ""); break; case INLINE_GREEN: - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml( + "" + f_character + ""); + if (mirror_iclog && colorf_iclog) + ui_ic_chatlog->insertHtml( + "" + + f_character + ""); break; case INLINE_GREY: - ui_vp_message->insertHtml("" + f_character + ""); - break; - default: - ui_vp_message->insertHtml(f_character); + ui_vp_message->insertHtml("" + f_character + ""); + if (mirror_iclog && colorf_iclog) + ui_ic_chatlog->insertHtml("" + f_character + ""); break; } - } - else - { - if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW) - { + else { + if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW) { QString html_color; - switch (rainbow_counter) - { + switch (rainbow_counter) { case 0: html_color = get_text_color(QString::number(RED)).name(); break; @@ -2700,18 +3051,39 @@ void Courtroom::chat_tick() ++rainbow_counter; - ui_vp_message->insertHtml("" + f_character + ""); + ui_vp_message->insertHtml("" + + f_character + ""); + if (mirror_iclog && colorf_iclog && !colorf_limit) + ui_ic_chatlog->insertHtml("" + + f_character + ""); + } + else { + ui_vp_message->insertHtml(f_character); + if (mirror_iclog && colorf_iclog && + ((m_chatmessage[TEXT_COLOR].toInt() == WHITE) || colorf_limit)) + ui_ic_chatlog->insertHtml(f_character); + } + + if (!(m_chatmessage[TEXT_COLOR].toInt() == WHITE) && + !(m_chatmessage[TEXT_COLOR].toInt() == RAINBOW) && !colorf_limit) { + + QString html_color = + get_text_color(QString::number(m_chatmessage[TEXT_COLOR].toInt())) + .name(); + + if (mirror_iclog && colorf_iclog) + ui_ic_chatlog->insertHtml("" + + f_character + ""); } - else - ui_vp_message->insertHtml(f_character); } - if (message_is_centered) - { + if (mirror_iclog && !colorf_iclog) { + ui_ic_chatlog->textCursor().insertHtml(f_character); + } + if (message_is_centered) { ui_vp_message->setAlignment(Qt::AlignCenter); } - else - { + else { ui_vp_message->setAlignment(Qt::AlignLeft); } } @@ -2722,11 +3094,9 @@ void Courtroom::chat_tick() if(blank_blip) qDebug() << "blank_blip found true"; - if (f_message.at(tick_pos) != ' ' || blank_blip) - { + if (f_message.at(tick_pos) != ' ' || blank_blip) { - if (blip_pos % blip_rate == 0 && !formatting_char) - { + if (blip_pos % blip_rate == 0 && !formatting_char) { blip_pos = 0; blip_player->blip_tick(); } @@ -2736,49 +3106,20 @@ void Courtroom::chat_tick() ++tick_pos; - // Restart the timer, but according to the newly set speeds, if there were any. - // Keep the speed at bay. - if (current_display_speed < 0) - { + // Restart the timer, but according to the newly set speeds, if there were + // any. Keep the speed at bay. + if (current_display_speed < 0) { current_display_speed = 0; } - if (current_display_speed > 6) - { + if (current_display_speed > 6) { current_display_speed = 6; } - - // If we had a formatting char, we shouldn't wait so long again, as it won't appear! - if (formatting_char) - { + if (formatting_char) { chat_tick_timer->start(1); } - else - { - chat_tick_timer->start(message_display_speed[current_display_speed]); - } - - } -} - -void Courtroom::show_testimony() -{ - if (!testimony_in_progress || m_chatmessage[SIDE] != "wit") - return; - - ui_vp_testimony->show(); - - testimony_show_timer->start(testimony_show_time); -} - -void Courtroom::hide_testimony() -{ - ui_vp_testimony->hide(); - - if (!testimony_in_progress) - return; - - testimony_hide_timer->start(testimony_hide_time); + else { + chat_tick_timer->start(msg_delay); } void Courtroom::play_sfx() @@ -2793,8 +3134,6 @@ void Courtroom::play_sfx() void Courtroom::set_scene() { - if (testimony_in_progress) - show_testimony(); //witness is default if pos is invalid QString f_background = "witnessempty"; @@ -2833,15 +3172,14 @@ void Courtroom::set_scene() f_background = "prohelperstand"; f_desk_image = "prohelperdesk"; } - else if (f_side == "jur" && (file_exists(ao_app->get_background_path("jurystand.png")) || - file_exists(ao_app->get_background_path("jurystand.gif")))) - { + else if (f_side == "jur" && (file_exists(ao_app->get_image_suffix( + ao_app->get_background_path("jurystand"))))) { f_background = "jurystand"; f_desk_image = "jurydesk"; } - else if (f_side == "sea" && (file_exists(ao_app->get_background_path("seancestand.png")) || - file_exists(ao_app->get_background_path("seancestand.gif")))) - { + else if (f_side == "sea" && + (file_exists(ao_app->get_image_suffix( + ao_app->get_background_path("seancestand"))))) { f_background = "seancestand"; f_desk_image = "seancedesk"; } @@ -2889,7 +3227,9 @@ void Courtroom::set_scene() void Courtroom::set_text_color() { - QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], ao_app->get_chat(m_chatmessage[CHAR_NAME])); + QString f_char = m_chatmessage[CHAR_NAME]; + QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], + ao_app->get_chat(f_char)); ui_vp_message->setTextBackgroundColor(QColor(0,0,0,0)); ui_vp_message->setTextColor(textcolor); @@ -2908,7 +3248,8 @@ void Courtroom::set_text_color() QColor Courtroom::get_text_color(QString color) { - return ao_app->get_chat_color(color, ao_app->get_chat(m_chatmessage[CHAR_NAME])); + QString f_char = m_chatmessage[CHAR_NAME]; + return ao_app->get_chat_color(color, ao_app->get_chat(f_char)); } void Courtroom::set_ip_list(QString p_list) @@ -2962,12 +3303,10 @@ void Courtroom::handle_song(QStringList *p_contents) qDebug() << "playing song "+ao_app->get_music_path(f_song); - if (n_char < 0 || n_char >= char_list.size()) - { - music_player->play(f_song); + if (n_char < 0 || n_char >= char_list.size()) { + music_player->play(ao_app->get_music_prefix(f_song)); } - else - { + else { QString str_char = char_list.at(n_char).name; QString str_show = char_list.at(n_char).name; @@ -2989,58 +3328,60 @@ void Courtroom::handle_song(QStringList *p_contents) music_player->enable_looping = true; } } - if (!mute_map.value(n_char)) - { - chatlogpiece* temp = new chatlogpiece(str_char, str_show, f_song, true); + if (!mute_map.value(n_char)) { + chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true, + m_chatmessage[TEXT_COLOR].toInt()); ic_chatlog_history.append(*temp); - while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) - { + while (ic_chatlog_history.size() > log_maximum_blocks && + log_maximum_blocks > 0) { ic_chatlog_history.removeFirst(); } - - append_ic_text(f_song, str_show, true); - music_player->play(f_song); + if (mirror_iclog) // If mirror is enabled, we display the song in the ooc + // chat rather than ic log for a more realistic + // expierence. + { + ui_server_chatlog->append_chatmessage( + str_show, " has played a song: " + f_song_clear + ".", + ao_app->get_color("ooc_server_color", "courtroom_design.ini") + .name(), + true); + } + append_ic_text(f_song_clear, str_show, true); + music_player->play(ao_app->get_music_prefix(f_song)); } } } - void Courtroom::handle_failed_login() { modcall_player->play("./music/failed_login"); // aov memes } - void Courtroom::handle_wtce(QString p_wtce, int variant) { QString sfx_file = "courtroom_sounds.ini"; //witness testimony - if (p_wtce == "testimony1") - { + if (p_wtce == "testimony1") { misc_sfx_player->play(ao_app->get_sfx("witness_testimony")); - ui_vp_wtce->play("witnesstestimony"); - testimony_in_progress = true; - show_testimony(); + ui_vp_wtce->play("witnesstestimony", "", "", wtce_stay_time); + ui_vp_testimony->play("testimony"); } //cross examination - else if (p_wtce == "testimony2") - { + else if (p_wtce == "testimony2") { misc_sfx_player->play(ao_app->get_sfx("cross_examination")); - ui_vp_wtce->play("crossexamination"); - testimony_in_progress = false; + ui_vp_wtce->play("crossexamination", "", "", wtce_stay_time); + ui_vp_testimony->stop(); } - else if (p_wtce == "judgeruling") - { - if (variant == 0) - { + else if (p_wtce == "judgeruling") { + if (variant == 0) { misc_sfx_player->play(ao_app->get_sfx("not_guilty")); - ui_vp_wtce->play("notguilty"); - testimony_in_progress = false; + ui_vp_wtce->play("notguilty", "", "", verdict_stay_time); + ui_vp_testimony->stop(); } else if (variant == 1) { misc_sfx_player->play(ao_app->get_sfx("guilty")); - ui_vp_wtce->play("guilty"); - testimony_in_progress = false; + ui_vp_wtce->play("guilty", "", "", verdict_stay_time); + ui_vp_testimony->stop(); } } } @@ -3379,10 +3720,19 @@ void Courtroom::on_ooc_return_pressed() casefile.endGroup(); } casefile.sync(); - append_server_chatmessage("CLIENT", tr("Succesfully saved, edit doc and cmdoc link on the ini!"), "1"); + append_server_chatmessage( + "CLIENT", tr("Succesfully saved, edit doc and cmdoc link on the ini!"), + "1"); + } + else if (ooc_message.startsWith("/clearooc")) { + ui_server_chatlog->clear(); + ui_ooc_chat_message->clear(); + return; + } + else if (ooc_message.startsWith("/version")) { + append_server_chatmessage("CLIENT", ao_app->get_version_string(), "1"); ui_ooc_chat_message->clear(); return; - } QStringList packet_contents; @@ -3429,6 +3779,13 @@ void Courtroom::on_ooc_toggle_clicked() } } +void Courtroom::on_music_search_keypr() +{ + if (ui_music_search->text() == "") { + ui_music_list->collapseAll(); + } +} + void Courtroom::on_music_search_edited(QString p_text) { //preventing compiler warnings @@ -3572,20 +3929,24 @@ void Courtroom::on_pair_list_clicked(QModelIndex p_index) } } -void Courtroom::on_music_list_double_clicked(QModelIndex p_model) +void Courtroom::on_music_list_double_clicked(QTreeWidgetItem *p_item, + int column) { if (is_muted) return; - QString p_song = music_list.at(music_row_to_number.at(p_model.row())); - - if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) - { - ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#" + ui_ic_chat_name->text() + "#%"), false); + column = 1; // Column 1 is always the metadata (which we want) + QString p_song = p_item->text(column); + if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) { + ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + + QString::number(m_cid) + "#" + + ui_ic_chat_name->text() + "#%"), + false); } - else - { - ao_app->send_server_packet(new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false); + else { + ao_app->send_server_packet( + new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), + false); } } @@ -3661,6 +4022,7 @@ void Courtroom::on_custom_objection_clicked() { ui_custom_objection->set_image("custom.png"); objection_state = 0; + objection_custom = ""; } else { @@ -3675,10 +4037,23 @@ void Courtroom::on_custom_objection_clicked() ui_ic_chat_message->setFocus(); } -void Courtroom::on_realization_clicked() +void Courtroom::ShowContextMenu(const QPoint &pos) { - if (realization_state == 0) + QPoint globalPos = ui_custom_objection->mapToGlobal(pos); + QAction *selecteditem = custom_obj_menu->exec(globalPos); + if (selecteditem) { + ui_objection->set_image("objection.png"); + ui_take_that->set_image("takethat.png"); + ui_hold_it->set_image("holdit.png"); + ui_custom_objection->set_image("custom_selected.png"); + objection_custom = selecteditem->text(); + objection_state = 4; + } +} + +void Courtroom::on_realization_clicked() { + if (realization_state == 0) { realization_state = 1; ui_realization->set_image("realization_pressed.png"); } @@ -3868,7 +4243,11 @@ void Courtroom::on_change_character_clicked() void Courtroom::on_reload_theme_clicked() { ao_app->reload_theme(); - + punctuation_modifier = ao_app->get_pundelay(); + colorf_iclog = ao_app->get_colored_iclog_enabled(); + mirror_iclog = ao_app->get_iclmir_enabled(); + colorf_limit = ao_app->colorlog_restricted_enabled(); + keep_evidence_display = ao_app->is_keepevi_enabled(); //to update status on the background set_background(current_background); //to update fallback text bools @@ -3967,26 +4346,8 @@ void Courtroom::on_guard_clicked() void Courtroom::on_showname_enable_clicked() { - ui_ic_chatlog->clear(); - first_message_sent = false; - - foreach (chatlogpiece item, ic_chatlog_history) { - if (ui_showname_enable->isChecked()) - { - if (item.get_is_song()) - append_ic_text(item.get_message(), item.get_showname(), true); - else - append_ic_text(item.get_message(), item.get_showname()); - } - else - { - if (item.get_is_song()) - append_ic_text(item.get_message(), item.get_name(), true); - else - append_ic_text(item.get_message(), item.get_name()); - } - } + refresh_iclog(false); ui_ic_chat_message->setFocus(); } @@ -4005,13 +4366,16 @@ void Courtroom::on_evidence_button_clicked() void Courtroom::on_switch_area_music_clicked() { - if (ui_area_list->isHidden()) - { + + if (ui_area_list->isHidden()) { + music_search_par = ui_music_search->text(); + ui_music_search->setText(area_search_par); ui_area_list->show(); ui_music_list->hide(); } - else - { + else { + area_search_par = ui_music_search->text(); + ui_music_search->setText(music_search_par); ui_area_list->hide(); ui_music_list->show(); } @@ -4072,12 +4436,33 @@ Courtroom::~Courtroom() delete blip_player; } -#ifdef BASSAUDIO -#if (defined (_WIN32) || defined (_WIN64)) -void Courtroom::load_bass_opus_plugin() -{ - BASS_PluginLoad("bassopus.dll", 0); +void Courtroom::refresh_iclog(bool skiplast) +{ + ui_ic_chatlog->clear(); + first_message_sent = false; + + foreach (chatlogpiece item, ic_chatlog_history) { + if (skiplast && ic_chatlog_history.last().get_full() == item.get_full()) { + break; + } + if (ui_showname_enable->isChecked()) { + if (item.get_is_song()) + append_ic_text(item.get_message(), item.get_showname(), true, false, + false); + else + append_ic_text(item.get_message(), item.get_showname(), false, true, + true, item.get_chat_color()); } + else { + if (item.get_is_song()) + append_ic_text(item.get_message(), item.get_name(), true, false, true); + else + append_ic_text(item.get_message(), item.get_name(), false, true, false, + item.get_chat_color()); + } + } +} + #elif (defined (LINUX) || defined (__linux__)) void Courtroom::load_bass_opus_plugin() { @@ -4094,3 +4479,6 @@ void Courtroom::load_bass_opus_plugin() #error This operating system is unsupported for bass plugins. #endif #endif +#ifdef BASSAUDIO +#if (defined(_WIN32) || defined(_WIN64)) +void Courtroom::load_bass_opus_plugin() { BASS_PluginLoad("bassopus.dll", 0); } diff --git a/src/lobby.cpp b/src/lobby.cpp index d817266..c590ad5 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -272,17 +272,19 @@ void Lobby::on_connect_released() void Lobby::on_about_clicked() { - QString msg = tr("

Attorney Online %1

" + QString msg = + tr("

Attorney Online %1

" "The courtroom drama simulator" "

Source code: " "" "https://github.com/AttorneyOnline/AO2-Client" "

Major development:
" - "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter" + "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, " + "Cents02" "

Special thanks:
" "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " - "Noevain, Cronnicossy") + "Noevain, Cronnicossy, Raidensnake") .arg(ao_app->get_version_string()); QMessageBox::about(this, "About", msg); } @@ -380,7 +382,10 @@ void Lobby::list_favorites() void Lobby::append_chatmessage(QString f_name, QString f_message) { - ui_chatbox->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); + ui_chatbox->append_chatmessage( + f_name, f_message, + ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(), + false); } void Lobby::append_error(QString f_message) diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index b14cd57..d6518a3 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -7,34 +7,19 @@ #include "hardware_functions.h" #include "debug_functions.h" -class AOPacketLoadMusicThreading : public QRunnable -{ -public: - AOApplication *myapp; - QString filename; - bool ismusic; - AOPacketLoadMusicThreading(AOApplication *my_app, QString file_name, bool is_music){ - myapp = my_app; - filename = file_name; - ismusic = is_music; - } - void run() - { - if(ismusic) +void AOPacketLoadMusic(AOApplication *my_app, QString file_name, bool is_music) { - myapp->w_courtroom->append_music(filename); + if (is_music) { + my_app->w_courtroom->append_music(file_name); } - else - { - myapp->w_courtroom->append_area(filename); - myapp->area_count++; + else { + my_app->w_courtroom->append_area(file_name); + my_app->area_count++; } - for (int area_n = 0; area_n < myapp->area_count; area_n++) - { - myapp->w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown"); + for (int area_n = 0; area_n < my_app->area_count; area_n++) { + my_app->w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown"); } } -}; void AOApplication::ms_packet_received(AOPacket *p_packet) { @@ -438,26 +423,6 @@ void AOApplication::server_packet_received(AOPacket *p_packet) w_lobby->set_loading_text(tr("Loading music:\n%1/%2").arg(QString::number(loaded_music)).arg(QString::number(music_list_size))); - if (musiclist_start) - { - w_courtroom->append_music(f_music); - } - else - { - if (is_music_track(f_music)) - { - musiclist_start = true; - areas--; - //w_courtroom->fix_last_area(); - w_courtroom->append_music(f_music); - } - else - { - w_courtroom->append_area(f_music); - areas++; - } - } - for (int area_n = 0; area_n < areas; area_n++) { w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown"); @@ -515,38 +480,43 @@ void AOApplication::server_packet_received(AOPacket *p_packet) send_server_packet(new AOPacket("RM#%")); } - else if (header == "SM" || header == "FM") - { + + else if (header == "SM") { if (!courtroom_constructed) goto end; - w_courtroom->clear_music(); - w_courtroom->clear_areas(); - - bool musiclist_start = false; + bool musics_time = false; area_count = 0; - for (int n_element = 0 ; n_element < f_contents.size() ; ++n_element) - { - if (!musiclist_start && is_music_track(f_contents.at(n_element))) - { - musiclist_start = true; - continue; + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { + int element2check = n_element + 1; + if (element2check > f_contents.size()) { + element2check = n_element; // I know this is very lazy code but cba + } + if (!musics_time && (f_contents.at(n_element).startsWith("==") || + f_contents.at(element2check).endsWith(".wav") || + f_contents.at(element2check).endsWith(".mp3") || + f_contents.at(element2check).endsWith(".mp4") || + f_contents.at(element2check).endsWith(".ogg") || + f_contents.at(element2check).endsWith(".opus"))) { + musics_time = true; } - AOPacketLoadMusicThreading *music_load = new AOPacketLoadMusicThreading(this, f_contents.at(n_element), musiclist_start); - QThreadPool::globalInstance()->start(music_load); + + // Not everything needs to have a thread. + AOPacketLoadMusic(this, f_contents.at(n_element), musics_time); ++loaded_music; - 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(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(total_loading_size)) * + 100); w_lobby->set_loading_value(loading_value); - w_lobby->set_loading_text(tr("Loading music:\n%1/%2").arg(QString::number(loaded_music)).arg(QString::number(music_list_size))); - if(QThreadPool::globalInstance()->activeThreadCount() == QThreadPool::globalInstance()->maxThreadCount()) - { - QThreadPool::globalInstance()->waitForDone(); //out of order music is bad - } + w_lobby->set_loading_text(tr("Loading music:\n%1/%2") + .arg(QString::number(loaded_music)) + .arg(QString::number(music_list_size))); } - QThreadPool::globalInstance()->waitForDone(); - if (header == "SM") + send_server_packet(new AOPacket("RD#%")); } else if (header == "DONE") @@ -761,6 +731,7 @@ void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded) } else { + qDebug() << "S:" << f_packet; #ifdef DEBUG_NETWORK qDebug() << "S:" << f_packet; #endif diff --git a/src/path_functions.cpp b/src/path_functions.cpp index 72b7acc..3723192 100644 --- a/src/path_functions.cpp +++ b/src/path_functions.cpp @@ -125,6 +125,7 @@ QString AOApplication::get_music_path(QString p_song) } #ifndef CASE_SENSITIVE_FILESYSTEM return get_base_path() + "sounds/music/" + p_song + ".wav"; + ; #else return get_case_sensitive_path(get_base_path() + "sounds/music/" + p_song + ".wav"); #endif diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 1e1c474..1fbb0b5 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -46,6 +46,15 @@ int AOApplication::get_max_log_size() return result; } +int AOApplication::get_pundelay() +{ + int result = configini->value("punctuation_delay", 2).toInt(); + if (result < 1 || result > 3) { + result = 2; + } + return result; +} + bool AOApplication::get_log_goes_downwards() { QString result = configini->value("log_goes_downwards", "false").value(); @@ -154,6 +163,26 @@ QString AOApplication::read_design_ini(QString p_identifier, QString p_design_pa { QSettings settings(p_design_path, QSettings::IniFormat); QVariant value = settings.value(p_identifier); + if (value.isNull()) // Since the value wasn't found, maybe it uses the proper + // config system + { + int last_underscore_index = p_identifier.lastIndexOf( + '_'); // we will use this in order to check wether it is just showname + // or showname_something + if (last_underscore_index != -1) { + p_identifier.replace( + last_underscore_index, 1, + '/'); // we replace the last dash in order to access the category, e.g + // from showname_font -> showname/font + value = settings.value(p_identifier); + } + else if (!settings.value(p_identifier + "/size") + .isNull()) // This is to check whether showname/size exists, + // because size is defined as widgetname = x + { + value = settings.value(p_identifier + "/size"); + } + } if (value.type() == QVariant::StringList) { return value.toStringList().join(","); } else { @@ -368,8 +397,27 @@ QString AOApplication::get_sfx(QString p_identifier) return return_sfx; } +QString AOApplication::get_music_prefix(QString song_to_check) +{ + if (!file_exists(get_music_path(song_to_check))) { + QString mp3_check = get_music_path(song_to_check + ".mp3"); + QString opus_check = get_music_path(song_to_check + ".opus"); + if (file_exists(opus_check)) { + return song_to_check + ".opus"; + } + else if (file_exists(mp3_check)) { + return song_to_check + ".mp3"; + } + return song_to_check + ".wav"; + } + else { + return song_to_check; + } +} + QString AOApplication::get_sfx_suffix(QString sound_to_check) { + 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)) @@ -381,16 +429,21 @@ QString AOApplication::get_sfx_suffix(QString sound_to_check) return sound_to_check + ".mp3"; } return sound_to_check + ".wav"; -} + } + else { + return sound_to_check; + } +} QString AOApplication::get_image_suffix(QString path_to_check) { - QString apng_check = path_to_check + ".apng"; - if (file_exists(apng_check)) - { - return apng_check; - } + if (file_exists(path_to_check + ".webp")) + return path_to_check + ".webp"; + if (file_exists(path_to_check + ".apng")) + return path_to_check + ".apng"; + if (file_exists(path_to_check + ".gif")) return path_to_check + ".gif"; + return path_to_check + ".png"; } @@ -655,9 +708,9 @@ bool AOApplication::is_discord_enabled() return result.startsWith("true"); } -bool AOApplication::is_shakeandflash_enabled() +bool AOApplication::is_keepevi_enabled() { - QString result = configini->value("shakeandflash", "true").value(); + QString result = configini->value("keep_evidence", "false").value(); return result.startsWith("true"); } @@ -715,3 +768,29 @@ QString AOApplication::get_casing_can_host_cases() QString result = configini->value("casing_can_host_cases", "Turnabout Check Your Settings").value(); return result; } + +bool AOApplication::get_colored_iclog_enabled() +{ + QString result = + configini->value("color_iclog_enabled", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_iclmir_enabled() +{ + QString result = + configini->value("mirror_iclog_enabled", "false").value(); + return result.startsWith("true"); +} +bool AOApplication::colorlog_restricted_enabled() +{ + QString result = + configini->value("mirror_iclog_restricted", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::is_shakeandflash_enabled() +{ + QString result = configini->value("shakeandflash", "true").value(); + return result.startsWith("true"); +} From 13942345c6a3e7e1625c6c26cc2f2f368a3bff23 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Fri, 17 Apr 2020 21:57:16 -0500 Subject: [PATCH 02/30] 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. --- Attorney_Online.pro | 1 + include/aoapplication.h | 758 ++-- include/aoblipplayer.h | 12 +- include/aobutton.h | 5 +- include/aocaseannouncerdialog.h | 13 +- include/aocharbutton.h | 8 +- include/aocharmovie.h | 31 +- include/aoemotebutton.h | 13 +- include/aoevidencebutton.h | 10 +- include/aoevidencedisplay.h | 7 +- include/aoimage.h | 7 +- include/aolineedit.h | 5 +- include/aomovie.h | 3 +- include/aomusicplayer.h | 16 +- include/aooptionsdialog.h | 284 +- include/aopacket.h | 9 +- include/aoscene.h | 5 +- include/aosfxplayer.h | 15 +- include/aotextarea.h | 14 +- include/aotextedit.h | 4 +- include/bass.h | 2214 +++++----- include/chatlogpiece.h | 5 +- include/courtroom.h | 1468 +++--- include/datatypes.h | 40 +- include/debug_functions.h | 2 +- include/discord-rpc.h | 64 +- include/discord_register.h | 26 +- include/discord_rich_presence.h | 12 +- include/discord_rpc.h | 66 +- include/encryption_functions.h | 8 +- include/file_functions.h | 2 +- include/hex_functions.h | 13 +- include/lobby.h | 15 +- include/misc_functions.h | 2 +- include/networkmanager.h | 11 +- include/text_file_functions.h | 8 +- scripts/configure_ubuntu.sh | 1 + src/aoapplication.cpp | 85 +- src/aoblipplayer.cpp | 38 +- src/aobutton.cpp | 9 +- src/aocaseannouncerdialog.cpp | 41 +- src/aocharbutton.cpp | 32 +- src/aocharmovie.cpp | 212 +- src/aoemotebutton.cpp | 18 +- src/aoevidencebutton.cpp | 19 +- src/aoevidencedisplay.cpp | 37 +- src/aoimage.cpp | 11 +- src/aolineedit.cpp | 5 +- src/aomovie.cpp | 233 +- src/aomusicplayer.cpp | 79 +- src/aopacket.cpp | 29 +- src/aosfxplayer.cpp | 76 +- src/aotextarea.cpp | 43 +- src/aotextedit.cpp | 8 +- src/charselect.cpp | 146 +- src/chatlogpiece.cpp | 31 +- src/courtroom.cpp | 7346 +++++++++++++++---------------- src/debug_functions.cpp | 16 +- src/discord_rich_presence.cpp | 37 +- src/emotes.cpp | 43 +- src/encryption_functions.cpp | 19 +- src/evidence.cpp | 100 +- src/file_functions.cpp | 3 +- src/hardware_functions.cpp | 54 +- src/hex_functions.cpp | 23 +- src/lobby.cpp | 795 ++-- src/main.cpp | 53 +- src/misc_functions.cpp | 2 +- src/networkmanager.cpp | 138 +- src/packet_distribution.cpp | 1379 +++--- src/path_functions.cpp | 380 +- src/text_file_functions.cpp | 1450 +++--- 72 files changed, 9033 insertions(+), 9134 deletions(-) diff --git a/Attorney_Online.pro b/Attorney_Online.pro index ea5473f..c773fb3 100644 --- a/Attorney_Online.pro +++ b/Attorney_Online.pro @@ -16,6 +16,7 @@ HEADERS += $$files($$PWD/include/*.h) LIBS += -L$$PWD/lib + #DEFINES += DISCORD contains(DEFINES, DISCORD) { diff --git a/include/aoapplication.h b/include/aoapplication.h index 3d4cc0e..a07bf74 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -1,381 +1,381 @@ -#ifndef AOAPPLICATION_H -#define AOAPPLICATION_H - -#include "aopacket.h" -#include "datatypes.h" -#include "discord_rich_presence.h" - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#ifdef QTAUDIO -#include -#endif - -#include -#include -#include -#include - -class NetworkManager; -class Lobby; -class Courtroom; - -class AOApplication : public QApplication -{ - Q_OBJECT - -public: - AOApplication(int &argc, char **argv); - ~AOApplication(); - - NetworkManager *net_manager; - Lobby *w_lobby; - Courtroom *w_courtroom; - AttorneyOnline::Discord *discord; - - bool lobby_constructed = false; - bool courtroom_constructed = false; - - void construct_lobby(); - void destruct_lobby(); - - void construct_courtroom(); - void destruct_courtroom(); - - bool is_music_track(QString trackname); - - void ms_packet_received(AOPacket *p_packet); - void server_packet_received(AOPacket *p_packet); - - void send_ms_packet(AOPacket *p_packet); - void send_server_packet(AOPacket *p_packet, bool encoded = true); - - void call_settings_menu(); - void call_announce_menu(Courtroom *court); - - /////////////////server metadata////////////////// - - unsigned int s_decryptor = 5; - bool encryption_needed = true; - - bool yellow_text_enabled = false; - bool prezoom_enabled = false; - bool flipping_enabled = false; - bool custom_objection_enabled = false; - bool improved_loading_enabled = false; - bool desk_mod_enabled = false; - bool evidence_enabled = false; - bool cccc_ic_support_enabled = false; - bool arup_enabled = false; - bool casing_alerts_enabled = false; - bool modcall_reason_enabled = false; - bool looping_sfx_support_enabled = false; - - ///////////////loading info/////////////////// - - //player number, it's hardly used but might be needed for some old servers - int s_pv = 0; - - QString server_software = ""; - - int char_list_size = 0; - int loaded_chars = 0; - int generated_chars = 0; - int evidence_list_size = 0; - int loaded_evidence = 0; - int music_list_size = 0; - int loaded_music = 0; - int area_count = 0; - - bool courtroom_loaded = false; - - //////////////////versioning/////////////// - - int get_release() const { return RELEASE; } - int get_major_version() const { return MAJOR_VERSION; } - int get_minor_version() const { return MINOR_VERSION; } - QString get_version_string(); - - /////////////////////////////////////////// - - void set_favorite_list(); - QVector& get_favorite_list() {return favorite_list;} - void add_favorite_server(int p_server); - - void set_server_list(); - QVector& 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(); - QString get_data_path(); - QString get_theme_path(QString p_file); - QString get_default_theme_path(QString p_file); - QString get_custom_theme_path(QString p_theme, QString p_file); - QString get_character_path(QString p_char, QString p_file); - QString get_sounds_path(QString p_file); - QString get_music_path(QString p_song); - QString get_background_path(QString p_file); - QString get_default_background_path(QString p_file); - QString get_evidence_path(QString p_file); - QString get_case_sensitive_path(QString p_file); - - ////// 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 - 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 kill music on object is enabled in the config.ini - bool get_objectmusic(); - - //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 whether Discord should be enabled on startup - // from the config.ini. - bool is_discord_enabled(); - - // Returns the value of whether shaking and flashing should be enabled. - // from the config.ini. - bool is_shakeandflash_enabled(); - - // Returns whether evidence should be maintained ic - bool is_keepevi_enabled(); - - // Returns the value of the maximum amount of lines the IC chatlog - // may contain, from config.ini. - int get_max_log_size(); - - // Gets the punctuation delay modifier - int get_pundelay(); - - // Returns whether the log should go upwards (new behaviour) - // or downwards (vanilla behaviour). - bool get_log_goes_downwards(); - - // 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(); - #ifdef QTAUDIO - QAudioDeviceInfo QtAudioDevice; - #endif - - // Returns whether the user would like to have custom shownames on by default. - bool get_showname_enabled_by_default(); - - //Returns the list of words in callwords.ini - QStringList get_call_words(); - - //Appends the argument string to serverlist.txt - void write_to_serverlist_txt(QString p_line); - - //Returns the contents of serverlist.txt - QVector read_serverlist_txt(); - - //Returns the value of p_identifier in the design.ini file in p_design_path - QString read_design_ini(QString p_identifier, QString p_design_path); - - //Returns the coordinates of widget with p_identifier from p_file - QPoint get_button_spacing(QString p_identifier, QString p_file); - - //Returns the dimensions of widget with specified identifier from p_file - pos_size_type get_element_dimensions(QString p_identifier, QString p_file); - - //Returns the name of the font with p_identifier from p_file - QString get_font_name(QString p_identifier, QString p_file); - - //Returns the value of font_size with p_identifier from p_file - int get_font_size(QString p_identifier, QString p_file); - - //Returns the color with p_identifier from p_file - QColor get_color(QString p_identifier, QString p_file); - - // Returns the colour from the misc folder. - QColor get_chat_color(QString p_identifier, QString p_chat); - - //Returns the sfx with p_identifier from sounds.ini in the current theme path - QString get_sfx(QString p_identifier); - - //Figure out if we can opus this or if we should fall back to wav - QString get_sfx_suffix(QString sound_to_check); - - // figure out if we can find what prefix this song uses - QString get_music_prefix(QString song_to_check); - +#ifndef AOAPPLICATION_H +#define AOAPPLICATION_H + +#include "aopacket.h" +#include "datatypes.h" +#include "discord_rich_presence.h" + +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#ifdef QTAUDIO +#include +#endif + +#include +#include +#include +#include + +class NetworkManager; +class Lobby; +class Courtroom; +class AOApplication : public QApplication { + Q_OBJECT + +public: + AOApplication(int &argc, char **argv); + ~AOApplication(); + + NetworkManager *net_manager; + Lobby *w_lobby; + Courtroom *w_courtroom; + AttorneyOnline::Discord *discord; + + bool lobby_constructed = false; + bool courtroom_constructed = false; + + void construct_lobby(); + void destruct_lobby(); + + void construct_courtroom(); + void destruct_courtroom(); + + bool is_music_track(QString trackname); + + void ms_packet_received(AOPacket *p_packet); + void server_packet_received(AOPacket *p_packet); + + void send_ms_packet(AOPacket *p_packet); + void send_server_packet(AOPacket *p_packet, bool encoded = true); + + void call_settings_menu(); + void call_announce_menu(Courtroom *court); + + /////////////////server metadata////////////////// + + unsigned int s_decryptor = 5; + bool encryption_needed = true; + + bool yellow_text_enabled = false; + bool prezoom_enabled = false; + bool flipping_enabled = false; + bool custom_objection_enabled = false; + bool improved_loading_enabled = false; + bool desk_mod_enabled = false; + bool evidence_enabled = false; + bool cccc_ic_support_enabled = false; + bool arup_enabled = false; + bool casing_alerts_enabled = false; + bool modcall_reason_enabled = false; + bool looping_sfx_support_enabled = false; + + ///////////////loading info/////////////////// + + // player number, it's hardly used but might be needed for some old servers + int s_pv = 0; + + QString server_software = ""; + + int char_list_size = 0; + int loaded_chars = 0; + int generated_chars = 0; + int evidence_list_size = 0; + int loaded_evidence = 0; + int music_list_size = 0; + int loaded_music = 0; + int area_count = 0; + bool courtroom_loaded = false; + + //////////////////versioning/////////////// + + int get_release() const { return RELEASE; } + int get_major_version() const { return MAJOR_VERSION; } + int get_minor_version() const { return MINOR_VERSION; } + QString get_version_string(); + + /////////////////////////////////////////// + + void set_favorite_list(); + QVector &get_favorite_list() { return favorite_list; } + void add_favorite_server(int p_server); + + void set_server_list(); + QVector &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(); + QString get_data_path(); + QString get_theme_path(QString p_file); + QString get_default_theme_path(QString p_file); + QString get_custom_theme_path(QString p_theme, QString p_file); + QString get_character_path(QString p_char, QString p_file); + QString get_sounds_path(QString p_file); + QString get_music_path(QString p_song); + QString get_background_path(QString p_file); + QString get_default_background_path(QString p_file); + QString get_evidence_path(QString p_file); + QString get_case_sensitive_path(QString p_file); + + ////// 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 + 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 kill music on object is enabled in the config.ini + bool get_objectmusic(); + + // 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 whether Discord should be enabled on startup + // from the config.ini. + bool is_discord_enabled(); + + // Returns the value of whether shaking and flashing should be enabled. + // from the config.ini. + bool is_shakeandflash_enabled(); + + // Returns whether evidence should be maintained ic + bool is_keepevi_enabled(); + + // Returns the value of the maximum amount of lines the IC chatlog + // may contain, from config.ini. + int get_max_log_size(); + + // Gets the punctuation delay modifier + int get_pundelay(); + + // Returns whether the log should go upwards (new behaviour) + // or downwards (vanilla behaviour). + bool get_log_goes_downwards(); + + // 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(); +#ifdef QTAUDIO + QAudioDeviceInfo QtAudioDevice; +#endif + + // Returns whether the user would like to have custom shownames on by default. + bool get_showname_enabled_by_default(); + + // Returns the list of words in callwords.ini + QStringList get_call_words(); + + // Appends the argument string to serverlist.txt + void write_to_serverlist_txt(QString p_line); + + // Returns the contents of serverlist.txt + QVector read_serverlist_txt(); + + // Returns the value of p_identifier in the design.ini file in p_design_path + QString read_design_ini(QString p_identifier, QString p_design_path); + + // Returns the coordinates of widget with p_identifier from p_file + QPoint get_button_spacing(QString p_identifier, QString p_file); + + // Returns the dimensions of widget with specified identifier from p_file + pos_size_type get_element_dimensions(QString p_identifier, QString p_file); + + // Returns the name of the font with p_identifier from p_file + QString get_font_name(QString p_identifier, QString p_file); + + // Returns the value of font_size with p_identifier from p_file + int get_font_size(QString p_identifier, QString p_file); + + // Returns the color with p_identifier from p_file + QColor get_color(QString p_identifier, QString p_file); + + // Returns the colour from the misc folder. + QColor get_chat_color(QString p_identifier, QString p_chat); + + // Returns the sfx with p_identifier from sounds.ini in the current theme path + QString get_sfx(QString p_identifier); + + // Figure out if we can opus this or if we should fall back to wav + QString get_sfx_suffix(QString sound_to_check); + + // figure out if we can find what prefix this song uses + QString get_music_prefix(QString song_to_check); + // Can we use APNG for this? If not, WEBP? if not, GIF? If not, fall back to a // gif. - QString get_image_suffix(QString path_to_check); - - //Returns the value of p_search_line within target_tag and terminator_tag - QString read_char_ini(QString p_char, QString p_search_line, QString target_tag); - - //Returns the side of the p_char character from that characters ini file - QString get_char_side(QString p_char); - - //Returns the showname from the ini of p_char - QString get_showname(QString p_char); - - //Returns the value of chat from the specific p_char's ini file - QString get_chat(QString p_char); - - //Returns the value of shouts from the specified p_char's ini file - QString get_char_shouts(QString p_char); - - //Returns the preanim duration of p_char's p_emote - 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) - int get_ao2_preanim_duration(QString p_char, QString p_emote); - - //Not in use - int get_text_delay(QString p_char, QString p_emote); - - // Returns the custom realisation used by the character. - QString get_custom_realization(QString p_char); - - //Returns the name of p_char - QString get_char_name(QString p_char); - - //Returns the total amount of emotes of p_char - int get_emote_number(QString p_char); - - //Returns the emote comment of p_char's p_emote - 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); - - //Returns if an emote has a frame specific SFX for it - QString get_frame_sfx_name(QString p_char, QString p_emote, int n_frame); - - //Returns if an emote has a frame specific SFX for it - QString get_realization_frame(QString p_char, QString p_emote, int n_frame); - - //Returns if an emote has a frame specific SFX for it - QString get_screenshake_frame(QString p_char, QString p_emote, int n_frame); - - //Not in use - int get_sfx_delay(QString p_char, int p_emote); - - //Returns the modifier for p_char's p_emote - int get_emote_mod(QString p_char, int p_emote); - - //Returns the desk modifier for p_char's p_emote - int get_desk_mod(QString p_char, int p_emote); - - //Returns p_char's gender - QString get_gender(QString p_char); - - // ====== - // 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(); - - // Same for witnesses. - bool get_casing_wit_enabled(); - - // Get the message for the CM for casing alerts. - QString get_casing_can_host_cases(); - - // Get if html for ic log is enabled - bool get_colored_iclog_enabled(); - - // Get if ic log mirror is enabled - bool get_iclmir_enabled(); - - // Get if only inline coloring should be shown in log - bool colorlog_restricted_enabled(); - -private: - const int RELEASE = 2; - const int MAJOR_VERSION = 7; - const int MINOR_VERSION = 0; - - QString current_theme = "default"; - - QVector server_list; - QVector favorite_list; - -private slots: - void ms_connect_finished(bool connected, bool will_retry); - -public slots: - void server_disconnected(); - void loading_cancelled(); -}; - -#endif // AOAPPLICATION_H + QString get_image_suffix(QString path_to_check); + + // Returns the value of p_search_line within target_tag and terminator_tag + QString read_char_ini(QString p_char, QString p_search_line, + QString target_tag); + + // Returns the side of the p_char character from that characters ini file + QString get_char_side(QString p_char); + + // Returns the showname from the ini of p_char + QString get_showname(QString p_char); + + // Returns the value of chat from the specific p_char's ini file + QString get_chat(QString p_char); + + // Returns the value of shouts from the specified p_char's ini file + QString get_char_shouts(QString p_char); + + // 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) + int get_ao2_preanim_duration(QString p_char, QString p_emote); + + // Not in use + int get_text_delay(QString p_char, QString p_emote); + + // Returns the custom realisation used by the character. + QString get_custom_realization(QString p_char); + + // Returns the name of p_char + QString get_char_name(QString p_char); + + // Returns the total amount of emotes of p_char + int get_emote_number(QString p_char); + + // Returns the emote comment of p_char's p_emote + QString get_emote_comment(QString p_char, int p_emote); + + // Returns if an emote loops it's SFX + QString get_sfx_looping(QString p_char, int p_emote); + + // Returns if an emote has a frame specific SFX for it + QString get_frame_sfx_name(QString p_char, QString p_emote, int n_frame); + + // Returns if an emote has a frame specific SFX for it + QString get_realization_frame(QString p_char, QString p_emote, int n_frame); + + // 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); + + // Returns the modifier for p_char's p_emote + int get_emote_mod(QString p_char, int p_emote); + + // Returns the desk modifier for p_char's p_emote + int get_desk_mod(QString p_char, int p_emote); + + // Returns p_char's gender + QString get_gender(QString p_char); + + // ====== + // 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 witnesses. + bool get_casing_wit_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 html for ic log is enabled + bool get_colored_iclog_enabled(); + + // Get if ic log mirror is enabled + bool get_iclmir_enabled(); + + // Get if only inline coloring should be shown in log + bool colorlog_restricted_enabled(); + +private: + const int RELEASE = 2; + const int MAJOR_VERSION = 7; + const int MINOR_VERSION = 0; + + QString current_theme = "default"; + + QVector server_list; + QVector favorite_list; + +private slots: + void ms_connect_finished(bool connected, bool will_retry); + +public slots: + void server_disconnected(); + void loading_cancelled(); +}; + +#endif // AOAPPLICATION_H diff --git a/include/aoblipplayer.h b/include/aoblipplayer.h index 44ca48b..4520120 100644 --- a/include/aoblipplayer.h +++ b/include/aoblipplayer.h @@ -9,13 +9,11 @@ #include "aoapplication.h" +#include #include #include -#include - -class AOBlipPlayer -{ +class AOBlipPlayer { public: AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app); @@ -32,11 +30,11 @@ private: void set_volume_internal(qreal p_volume); - #if defined(BASSAUDIO) +#if defined(BASSAUDIO) HSTREAM m_stream_list[5]; - #elif defined(QTAUDIO) +#elif defined(QTAUDIO) QSoundEffect m_blips; - #endif +#endif }; #endif // AOBLIPPLAYER_H diff --git a/include/aobutton.h b/include/aobutton.h index 4b7209a..f575885 100644 --- a/include/aobutton.h +++ b/include/aobutton.h @@ -3,11 +3,10 @@ #include "aoapplication.h" -#include #include +#include -class AOButton : public QPushButton -{ +class AOButton : public QPushButton { Q_OBJECT public: diff --git a/include/aocaseannouncerdialog.h b/include/aocaseannouncerdialog.h index da26fab..89080de 100644 --- a/include/aocaseannouncerdialog.h +++ b/include/aocaseannouncerdialog.h @@ -4,20 +4,21 @@ #include "aoapplication.h" #include "courtroom.h" -#include #include -#include -#include #include +#include +#include #include #include +#include -class AOCaseAnnouncerDialog : public QDialog -{ +class AOCaseAnnouncerDialog : public QDialog { Q_OBJECT public: - explicit AOCaseAnnouncerDialog(QWidget *parent = nullptr, AOApplication *p_ao_app = nullptr, Courtroom *p_court = nullptr); + explicit AOCaseAnnouncerDialog(QWidget *parent = nullptr, + AOApplication *p_ao_app = nullptr, + Courtroom *p_court = nullptr); private: AOApplication *ao_app; diff --git a/include/aocharbutton.h b/include/aocharbutton.h index f372cdf..dd27e62 100644 --- a/include/aocharbutton.h +++ b/include/aocharbutton.h @@ -4,17 +4,17 @@ #include "aoapplication.h" #include "aoimage.h" +#include #include #include #include -#include -class AOCharButton : public QPushButton -{ +class AOCharButton : public QPushButton { Q_OBJECT public: - AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken); + AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, + bool is_taken); AOApplication *ao_app; diff --git a/include/aocharmovie.h b/include/aocharmovie.h index 6c127a6..6db490b 100644 --- a/include/aocharmovie.h +++ b/include/aocharmovie.h @@ -1,19 +1,17 @@ #ifndef AOCHARMOVIE_H #define AOCHARMOVIE_H -#include -#include -#include -#include -#include -#include #include "include/aosfxplayer.h" #include "include/courtroom.h" - +#include +#include +#include +#include +#include +#include class AOApplication; -class AOCharMovie : public QLabel -{ +class AOCharMovie : public QLabel { Q_OBJECT public: @@ -24,12 +22,10 @@ public: void play_talking(QString p_char, QString p_emote); void play_idle(QString p_char, QString p_emote); - void set_flipped(bool p_flipped) {m_flipped = p_flipped;} + void set_flipped(bool p_flipped) { m_flipped = p_flipped; } void 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; diff --git a/include/aoemotebutton.h b/include/aoemotebutton.h index c99a73b..acf0b48 100644 --- a/include/aoemotebutton.h +++ b/include/aoemotebutton.h @@ -3,22 +3,21 @@ #include "aoapplication.h" -#include #include +#include -class AOEmoteButton : public QPushButton -{ +class AOEmoteButton : public QPushButton { Q_OBJECT public: AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y); - //void set_on(QString p_char, int p_emote); - //void set_off(QString p_char, int p_emote); + // void set_on(QString p_char, int p_emote); + // void set_off(QString p_char, int p_emote); void set_image(QString p_char, int p_emote, QString suffix); - void set_id(int p_id) {m_id = p_id;} - int get_id() {return m_id;} + void set_id(int p_id) { m_id = p_id; } + int get_id() { return m_id; } private: QWidget *parent; diff --git a/include/aoevidencebutton.h b/include/aoevidencebutton.h index 80b747c..b56bfb1 100644 --- a/include/aoevidencebutton.h +++ b/include/aoevidencebutton.h @@ -4,21 +4,21 @@ #include "aoapplication.h" #include "aoimage.h" +#include #include #include -#include -class AOEvidenceButton : public QPushButton -{ +class AOEvidenceButton : public QPushButton { Q_OBJECT public: - AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y); + AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, + int p_y); void reset(); void set_image(QString p_image); void set_theme_image(QString p_image); - void set_id(int p_id) {m_id = p_id;} + void set_id(int p_id) { m_id = p_id; } void set_selected(bool p_selected); diff --git a/include/aoevidencedisplay.h b/include/aoevidencedisplay.h index 13ca00d..1d6280d 100644 --- a/include/aoevidencedisplay.h +++ b/include/aoevidencedisplay.h @@ -4,19 +4,18 @@ #include "aoapplication.h" #include "aosfxplayer.h" +#include #include #include -#include -class AOEvidenceDisplay : public QLabel -{ +class AOEvidenceDisplay : public QLabel { Q_OBJECT public: AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app); void show_evidence(QString p_evidence_image, bool is_left_side, int p_volume); - QLabel* get_evidence_icon(); + QLabel *get_evidence_icon(); void reset(); private: diff --git a/include/aoimage.h b/include/aoimage.h index 4713be0..c4fdf2e 100644 --- a/include/aoimage.h +++ b/include/aoimage.h @@ -1,15 +1,14 @@ -//This class represents a static theme-dependent image +// This class represents a static theme-dependent image #ifndef AOIMAGE_H #define AOIMAGE_H #include "aoapplication.h" -#include #include +#include -class AOImage : public QLabel -{ +class AOImage : public QLabel { public: AOImage(QWidget *parent, AOApplication *p_ao_app); ~AOImage(); diff --git a/include/aolineedit.h b/include/aolineedit.h index ce17680..70f1f97 100644 --- a/include/aolineedit.h +++ b/include/aolineedit.h @@ -4,8 +4,7 @@ #include #include -class AOLineEdit : public QLineEdit -{ +class AOLineEdit : public QLineEdit { Q_OBJECT public: @@ -19,8 +18,6 @@ signals: private slots: void on_enter_pressed(); - - }; #endif // AOLINEEDIT_H diff --git a/include/aomovie.h b/include/aomovie.h index 7ffad25..caa1baa 100644 --- a/include/aomovie.h +++ b/include/aomovie.h @@ -7,8 +7,7 @@ class Courtroom; class AOApplication; -class AOMovie : public QLabel -{ +class AOMovie : public QLabel { Q_OBJECT public: diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h index 255cc45..5181630 100644 --- a/include/aomusicplayer.h +++ b/include/aomusicplayer.h @@ -9,15 +9,14 @@ #include "aoapplication.h" +#include +#include +#include #include #include -#include -#include -#include #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(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 90d3547..8580c34 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -1,150 +1,152 @@ -#ifndef AOOPTIONSDIALOG_H -#define AOOPTIONSDIALOG_H - -#include "aoapplication.h" - -#ifdef BASSAUDIO -#include "bass.h" -#elif defined QTAUDIO -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -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; - QFrame *ui_theme_log_divider; - QLabel *ui_downwards_lbl; - QCheckBox *ui_downwards_cb; - QLabel *ui_length_lbl; - QSpinBox *ui_length_spinbox; +#ifndef AOOPTIONSDIALOG_H +#define AOOPTIONSDIALOG_H + +#include "aoapplication.h" + +#ifdef BASSAUDIO +#include "bass.h" +#elif defined QTAUDIO +#include +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +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; + QFrame *ui_theme_log_divider; + QLabel *ui_downwards_lbl; + QCheckBox *ui_downwards_cb; + QLabel *ui_length_lbl; + QSpinBox *ui_length_spinbox; QLabel *ui_pun_delay; QSpinBox *ui_pun_delay_spinbox; - QFrame *ui_log_names_divider; - QLineEdit *ui_username_textbox; - QLabel *ui_username_lbl; - QLabel *ui_showname_lbl; - QCheckBox *ui_showname_cb; - QFrame *ui_net_divider; - QLabel *ui_ms_lbl; - QLineEdit *ui_ms_textbox; - QLabel *ui_discord_lbl; - QCheckBox *ui_discord_cb; - QLabel *ui_epilepsy_lbl; - QCheckBox *ui_epilepsy_cb; - QLabel *ui_language_label; - QComboBox *ui_language_combobox; - + QFrame *ui_log_names_divider; + QLineEdit *ui_username_textbox; + QLabel *ui_username_lbl; + QLabel *ui_showname_lbl; + QCheckBox *ui_showname_cb; + QFrame *ui_net_divider; + QLabel *ui_ms_lbl; + QLineEdit *ui_ms_textbox; + QLabel *ui_discord_lbl; + QLabel *ui_epilepsy_lbl; + QCheckBox *ui_epilepsy_cb; + + QCheckBox *ui_discord_cb; + QLabel *ui_language_label; + QComboBox *ui_language_combobox; + QLabel *ui_keepevi_lbl; QCheckBox *ui_keepevi_cb; QLabel *ui_keepcobj_lbl; QCheckBox *ui_keepcobj_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; - QLabel *ui_sfx_volume_lbl; - QLabel *ui_blips_volume_lbl; - QFrame *ui_volume_blip_divider; - QSpinBox *ui_bliprate_spinbox; - QLabel *ui_bliprate_lbl; - QCheckBox *ui_blank_blips_cb; - QLabel *ui_blank_blips_lbl; - QLabel *ui_loopsfx_lbl; - QCheckBox *ui_loopsfx_cb; - QLabel *ui_objectmusic_lbl; - QCheckBox *ui_objectmusic_cb; - QDialogButtonBox *ui_settings_buttons; - - QWidget *ui_casing_tab; - QWidget *ui_casing_widget; - QFormLayout *ui_casing_layout; - QLabel *ui_casing_supported_lbl; - QLabel *ui_casing_enabled_lbl; - QCheckBox *ui_casing_enabled_cb; - QLabel *ui_casing_def_lbl; - QCheckBox *ui_casing_def_cb; - QLabel *ui_casing_pro_lbl; - QCheckBox *ui_casing_pro_cb; - QLabel *ui_casing_jud_lbl; - QCheckBox *ui_casing_jud_cb; - QLabel *ui_casing_jur_lbl; - QCheckBox *ui_casing_jur_cb; - QLabel *ui_casing_steno_lbl; - QCheckBox *ui_casing_steno_cb; - QLabel *ui_casing_cm_lbl; - QCheckBox *ui_casing_cm_cb; - QLabel *ui_casing_wit_lbl; - QCheckBox *ui_casing_wit_cb; - QLabel *ui_casing_cm_cases_lbl; - QLineEdit *ui_casing_cm_cases_textbox; - - QWidget *ui_other_tab; - QWidget *ui_other_widget; - QFormLayout *ui_other_layout; - QLabel *ui_other_fancy_icl_enabled_lb; - QCheckBox *ui_other_fancy_icl_enabled_cb; - QLabel *ui_other_mirror_icl_enabled_lb; - QCheckBox *ui_other_mirror_icl_enabled_cb; - - QLabel *ui_other_fancy_icl_limit_lb; - QCheckBox *ui_other_fancy_icl_limit_cb; - + QWidget *ui_callwords_tab; + QWidget *ui_callwords_widget; + QVBoxLayout *ui_callwords_layout; + QPlainTextEdit *ui_callwords_textbox; + QLabel *ui_callwords_explain_lbl; + QCheckBox *ui_callwords_char_textbox; + + QWidget *ui_audio_tab; + QWidget *ui_audio_widget; + QFormLayout *ui_audio_layout; + QLabel *ui_audio_device_lbl; + QComboBox *ui_audio_device_combobox; + QFrame *ui_audio_volume_divider; + QSpinBox *ui_music_volume_spinbox; + QLabel *ui_music_volume_lbl; + QSpinBox *ui_sfx_volume_spinbox; + QLabel *ui_loopsfx_lbl; + QCheckBox *ui_loopsfx_cb; + QLabel *ui_objectmusic_lbl; + QCheckBox *ui_objectmusic_cb; + + QSpinBox *ui_blips_volume_spinbox; + QLabel *ui_sfx_volume_lbl; + QLabel *ui_blips_volume_lbl; + QFrame *ui_volume_blip_divider; + QSpinBox *ui_bliprate_spinbox; + QLabel *ui_bliprate_lbl; + QCheckBox *ui_blank_blips_cb; + QLabel *ui_blank_blips_lbl; + QDialogButtonBox *ui_settings_buttons; + + QWidget *ui_casing_tab; + QWidget *ui_casing_widget; + QFormLayout *ui_casing_layout; + QLabel *ui_casing_supported_lbl; + QLabel *ui_casing_enabled_lbl; + QCheckBox *ui_casing_enabled_cb; + QLabel *ui_casing_def_lbl; + QCheckBox *ui_casing_def_cb; + QLabel *ui_casing_pro_lbl; + QCheckBox *ui_casing_pro_cb; + QLabel *ui_casing_jud_lbl; + QCheckBox *ui_casing_jud_cb; + QLabel *ui_casing_jur_lbl; + QCheckBox *ui_casing_jur_cb; + QLabel *ui_casing_steno_lbl; + QCheckBox *ui_casing_steno_cb; + QLabel *ui_casing_cm_lbl; + QCheckBox *ui_casing_cm_cb; + QLabel *ui_casing_wit_lbl; + QCheckBox *ui_casing_wit_cb; + QLabel *ui_casing_cm_cases_lbl; + QLineEdit *ui_casing_cm_cases_textbox; + + QWidget *ui_other_tab; + QWidget *ui_other_widget; + QFormLayout *ui_other_layout; + QLabel *ui_other_fancy_icl_enabled_lb; + QCheckBox *ui_other_fancy_icl_enabled_cb; + QLabel *ui_other_mirror_icl_enabled_lb; + QCheckBox *ui_other_mirror_icl_enabled_cb; + + QLabel *ui_other_fancy_icl_limit_lb; + QCheckBox *ui_other_fancy_icl_limit_cb; + bool needs_default_audiodev(); - -signals: - -public slots: - void save_pressed(); - void discard_pressed(); -}; - -#endif // AOOPTIONSDIALOG_H + +signals: + +public slots: + void save_pressed(); + void discard_pressed(); +}; + +#endif // AOOPTIONSDIALOG_H diff --git a/include/aopacket.h b/include/aopacket.h index 21f6e0f..4097be8 100644 --- a/include/aopacket.h +++ b/include/aopacket.h @@ -1,19 +1,18 @@ #ifndef AOPACKET_H #define AOPACKET_H +#include #include #include -#include -class AOPacket -{ +class AOPacket { public: AOPacket(QString p_packet_string); AOPacket(QString header, QStringList &p_contents); ~AOPacket(); - QString get_header() {return m_header;} - QStringList &get_contents() {return m_contents;} + QString get_header() { return m_header; } + QStringList &get_contents() { return m_contents; } QString to_string(); void encrypt_header(unsigned int p_key); diff --git a/include/aoscene.h b/include/aoscene.h index 29a44b0..7c1ef6f 100644 --- a/include/aoscene.h +++ b/include/aoscene.h @@ -1,15 +1,14 @@ #ifndef AOSCENE_H #define AOSCENE_H -#include #include +#include #include class Courtroom; class AOApplication; -class AOScene : public QLabel -{ +class AOScene : public QLabel { Q_OBJECT public: explicit AOScene(QWidget *parent, AOApplication *p_ao_app); diff --git a/include/aosfxplayer.h b/include/aosfxplayer.h index 5b4d2ec..af3aef6 100644 --- a/include/aosfxplayer.h +++ b/include/aosfxplayer.h @@ -9,13 +9,12 @@ #include "aoapplication.h" -#include -#include #include #include +#include +#include -class AOSfxPlayer : public QObject -{ +class AOSfxPlayer : public QObject { Q_OBJECT public: AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app); @@ -33,11 +32,11 @@ private: void set_volume_internal(qreal p_volume); - #if defined(BASSAUDIO) +#if defined(BASSAUDIO) HSTREAM m_stream; - #elif defined(QTAUDIO) - QSoundEffect m_sfx; - #endif +#elif defined(QTAUDIO) + QSoundEffect m_sfx; +#endif }; #endif // AOSFXPLAYER_H diff --git a/include/aotextarea.h b/include/aotextarea.h index ae28564..b816089 100644 --- a/include/aotextarea.h +++ b/include/aotextarea.h @@ -1,14 +1,13 @@ #ifndef AOTEXTAREA_H #define AOTEXTAREA_H -#include -#include -#include -#include #include +#include +#include +#include +#include -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 diff --git a/include/aotextedit.h b/include/aotextedit.h index 85909c6..8d876f1 100644 --- a/include/aotextedit.h +++ b/include/aotextedit.h @@ -3,8 +3,7 @@ #include -class AOTextEdit : public QPlainTextEdit -{ +class AOTextEdit : public QPlainTextEdit { Q_OBJECT public: AOTextEdit(QWidget *parent); @@ -17,7 +16,6 @@ signals: private slots: void on_enter_pressed(); - }; #endif // AOTEXTEDIT_H diff --git a/include/bass.h b/include/bass.h index 1c50903..a3687b9 100644 --- a/include/bass.h +++ b/include/bass.h @@ -1,1139 +1,1217 @@ -/* - BASS 2.4 C/C++ header file - Copyright (c) 1999-2018 Un4seen Developments Ltd. - - See the BASS.CHM file for more detailed documentation -*/ - -#ifndef BASS_H -#define BASS_H - -#ifdef _WIN32 -#include -typedef unsigned __int64 QWORD; -#else -#include -#define WINAPI -#define CALLBACK -typedef uint8_t BYTE; -typedef uint16_t WORD; -typedef uint32_t DWORD; -typedef uint64_t QWORD; -#ifndef __OBJC__ -typedef int BOOL; -#endif -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif -#define LOBYTE(a) (BYTE)(a) -#define HIBYTE(a) (BYTE)((a)>>8) -#define LOWORD(a) (WORD)(a) -#define HIWORD(a) (WORD)((a)>>16) -#define MAKEWORD(a,b) (WORD)(((a)&0xff)|((b)<<8)) -#define MAKELONG(a,b) (DWORD)(((a)&0xffff)|((b)<<16)) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define BASSVERSION 0x204 // API version -#define BASSVERSIONTEXT "2.4" - -#ifndef BASSDEF -#define BASSDEF(f) WINAPI f -#else -#define NOBASSOVERLOADS -#endif - -typedef DWORD HMUSIC; // MOD music handle -typedef DWORD HSAMPLE; // sample handle -typedef DWORD HCHANNEL; // playing sample's channel handle -typedef DWORD HSTREAM; // sample stream handle -typedef DWORD HRECORD; // recording handle -typedef DWORD HSYNC; // synchronizer handle -typedef DWORD HDSP; // DSP handle -typedef DWORD HFX; // DX8 effect handle -typedef DWORD HPLUGIN; // Plugin handle - -// Error codes returned by BASS_ErrorGetCode -#define BASS_OK 0 // all is OK -#define BASS_ERROR_MEM 1 // memory error -#define BASS_ERROR_FILEOPEN 2 // can't open the file -#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver -#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost -#define BASS_ERROR_HANDLE 5 // invalid handle -#define BASS_ERROR_FORMAT 6 // unsupported sample format -#define BASS_ERROR_POSITION 7 // invalid position -#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called -#define BASS_ERROR_START 9 // BASS_Start has not been successfully called -#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available -#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever -#define BASS_ERROR_NOCHAN 18 // can't get a free channel -#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified -#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified -#define BASS_ERROR_NO3D 21 // no 3D support -#define BASS_ERROR_NOEAX 22 // no EAX support -#define BASS_ERROR_DEVICE 23 // illegal device number -#define BASS_ERROR_NOPLAY 24 // not playing -#define BASS_ERROR_FREQ 25 // illegal sample rate -#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream -#define BASS_ERROR_NOHW 29 // no hardware voices available -#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data -#define BASS_ERROR_NONET 32 // no internet connection could be opened -#define BASS_ERROR_CREATE 33 // couldn't create the file -#define BASS_ERROR_NOFX 34 // effects are not available -#define BASS_ERROR_NOTAVAIL 37 // requested data/action is not available -#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel" -#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed -#define BASS_ERROR_TIMEOUT 40 // connection timedout -#define BASS_ERROR_FILEFORM 41 // unsupported file format -#define BASS_ERROR_SPEAKER 42 // unavailable speaker -#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons) -#define BASS_ERROR_CODEC 44 // codec is not available/supported -#define BASS_ERROR_ENDED 45 // the channel/file has ended -#define BASS_ERROR_BUSY 46 // the device is busy -#define BASS_ERROR_UNKNOWN -1 // some other mystery problem - -// BASS_SetConfig options -#define BASS_CONFIG_BUFFER 0 -#define BASS_CONFIG_UPDATEPERIOD 1 -#define BASS_CONFIG_GVOL_SAMPLE 4 -#define BASS_CONFIG_GVOL_STREAM 5 -#define BASS_CONFIG_GVOL_MUSIC 6 -#define BASS_CONFIG_CURVE_VOL 7 -#define BASS_CONFIG_CURVE_PAN 8 -#define BASS_CONFIG_FLOATDSP 9 -#define BASS_CONFIG_3DALGORITHM 10 -#define BASS_CONFIG_NET_TIMEOUT 11 -#define BASS_CONFIG_NET_BUFFER 12 -#define BASS_CONFIG_PAUSE_NOPLAY 13 -#define BASS_CONFIG_NET_PREBUF 15 -#define BASS_CONFIG_NET_PASSIVE 18 -#define BASS_CONFIG_REC_BUFFER 19 -#define BASS_CONFIG_NET_PLAYLIST 21 -#define BASS_CONFIG_MUSIC_VIRTUAL 22 -#define BASS_CONFIG_VERIFY 23 -#define BASS_CONFIG_UPDATETHREADS 24 -#define BASS_CONFIG_DEV_BUFFER 27 -#define BASS_CONFIG_VISTA_TRUEPOS 30 -#define BASS_CONFIG_IOS_MIXAUDIO 34 -#define BASS_CONFIG_DEV_DEFAULT 36 -#define BASS_CONFIG_NET_READTIMEOUT 37 -#define BASS_CONFIG_VISTA_SPEAKERS 38 -#define BASS_CONFIG_IOS_SPEAKER 39 -#define BASS_CONFIG_MF_DISABLE 40 -#define BASS_CONFIG_HANDLES 41 -#define BASS_CONFIG_UNICODE 42 -#define BASS_CONFIG_SRC 43 -#define BASS_CONFIG_SRC_SAMPLE 44 +/* + BASS 2.4 C/C++ header file + Copyright (c) 1999-2018 Un4seen Developments Ltd. + + See the BASS.CHM file for more detailed documentation +*/ + +#ifndef BASS_H +#define BASS_H + +#ifdef _WIN32 +#include +typedef unsigned __int64 QWORD; +#else +#include +#define WINAPI +#define CALLBACK +typedef uint8_t BYTE; +typedef uint16_t WORD; +typedef uint32_t DWORD; +typedef uint64_t QWORD; +#ifndef __OBJC__ +typedef int BOOL; +#endif +#ifndef TRUE +#define TRUE 1 +#define FALSE 0 +#endif +#define LOBYTE(a) (BYTE)(a) +#define HIBYTE(a) (BYTE)((a) >> 8) +#define LOWORD(a) (WORD)(a) +#define HIWORD(a) (WORD)((a) >> 16) +#define MAKEWORD(a, b) (WORD)(((a)&0xff) | ((b) << 8)) +#define MAKELONG(a, b) (DWORD)(((a)&0xffff) | ((b) << 16)) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define BASSVERSION 0x204 // API version +#define BASSVERSIONTEXT "2.4" + +#ifndef BASSDEF +#define BASSDEF(f) WINAPI f +#else +#define NOBASSOVERLOADS +#endif + +typedef DWORD HMUSIC; // MOD music handle +typedef DWORD HSAMPLE; // sample handle +typedef DWORD HCHANNEL; // playing sample's channel handle +typedef DWORD HSTREAM; // sample stream handle +typedef DWORD HRECORD; // recording handle +typedef DWORD HSYNC; // synchronizer handle +typedef DWORD HDSP; // DSP handle +typedef DWORD HFX; // DX8 effect handle +typedef DWORD HPLUGIN; // Plugin handle + +// Error codes returned by BASS_ErrorGetCode +#define BASS_OK 0 // all is OK +#define BASS_ERROR_MEM 1 // memory error +#define BASS_ERROR_FILEOPEN 2 // can't open the file +#define BASS_ERROR_DRIVER 3 // can't find a free/valid driver +#define BASS_ERROR_BUFLOST 4 // the sample buffer was lost +#define BASS_ERROR_HANDLE 5 // invalid handle +#define BASS_ERROR_FORMAT 6 // unsupported sample format +#define BASS_ERROR_POSITION 7 // invalid position +#define BASS_ERROR_INIT 8 // BASS_Init has not been successfully called +#define BASS_ERROR_START 9 // BASS_Start has not been successfully called +#define BASS_ERROR_SSL 10 // SSL/HTTPS support isn't available +#define BASS_ERROR_ALREADY 14 // already initialized/paused/whatever +#define BASS_ERROR_NOCHAN 18 // can't get a free channel +#define BASS_ERROR_ILLTYPE 19 // an illegal type was specified +#define BASS_ERROR_ILLPARAM 20 // an illegal parameter was specified +#define BASS_ERROR_NO3D 21 // no 3D support +#define BASS_ERROR_NOEAX 22 // no EAX support +#define BASS_ERROR_DEVICE 23 // illegal device number +#define BASS_ERROR_NOPLAY 24 // not playing +#define BASS_ERROR_FREQ 25 // illegal sample rate +#define BASS_ERROR_NOTFILE 27 // the stream is not a file stream +#define BASS_ERROR_NOHW 29 // no hardware voices available +#define BASS_ERROR_EMPTY 31 // the MOD music has no sequence data +#define BASS_ERROR_NONET 32 // no internet connection could be opened +#define BASS_ERROR_CREATE 33 // couldn't create the file +#define BASS_ERROR_NOFX 34 // effects are not available +#define BASS_ERROR_NOTAVAIL 37 // requested data/action is not available +#define BASS_ERROR_DECODE 38 // the channel is/isn't a "decoding channel" +#define BASS_ERROR_DX 39 // a sufficient DirectX version is not installed +#define BASS_ERROR_TIMEOUT 40 // connection timedout +#define BASS_ERROR_FILEFORM 41 // unsupported file format +#define BASS_ERROR_SPEAKER 42 // unavailable speaker +#define BASS_ERROR_VERSION 43 // invalid BASS version (used by add-ons) +#define BASS_ERROR_CODEC 44 // codec is not available/supported +#define BASS_ERROR_ENDED 45 // the channel/file has ended +#define BASS_ERROR_BUSY 46 // the device is busy +#define BASS_ERROR_UNKNOWN -1 // some other mystery problem + +// BASS_SetConfig options +#define BASS_CONFIG_BUFFER 0 +#define BASS_CONFIG_UPDATEPERIOD 1 +#define BASS_CONFIG_GVOL_SAMPLE 4 +#define BASS_CONFIG_GVOL_STREAM 5 +#define BASS_CONFIG_GVOL_MUSIC 6 +#define BASS_CONFIG_CURVE_VOL 7 +#define BASS_CONFIG_CURVE_PAN 8 +#define BASS_CONFIG_FLOATDSP 9 +#define BASS_CONFIG_3DALGORITHM 10 +#define BASS_CONFIG_NET_TIMEOUT 11 +#define BASS_CONFIG_NET_BUFFER 12 +#define BASS_CONFIG_PAUSE_NOPLAY 13 +#define BASS_CONFIG_NET_PREBUF 15 +#define BASS_CONFIG_NET_PASSIVE 18 +#define BASS_CONFIG_REC_BUFFER 19 +#define BASS_CONFIG_NET_PLAYLIST 21 +#define BASS_CONFIG_MUSIC_VIRTUAL 22 +#define BASS_CONFIG_VERIFY 23 +#define BASS_CONFIG_UPDATETHREADS 24 +#define BASS_CONFIG_DEV_BUFFER 27 +#define BASS_CONFIG_VISTA_TRUEPOS 30 +#define BASS_CONFIG_IOS_MIXAUDIO 34 +#define BASS_CONFIG_DEV_DEFAULT 36 +#define BASS_CONFIG_NET_READTIMEOUT 37 +#define BASS_CONFIG_VISTA_SPEAKERS 38 +#define BASS_CONFIG_IOS_SPEAKER 39 +#define BASS_CONFIG_MF_DISABLE 40 +#define BASS_CONFIG_HANDLES 41 +#define BASS_CONFIG_UNICODE 42 +#define BASS_CONFIG_SRC 43 +#define BASS_CONFIG_SRC_SAMPLE 44 #define BASS_CONFIG_ASYNCFILE_BUFFER 45 -#define BASS_CONFIG_OGG_PRESCAN 47 -#define BASS_CONFIG_MF_VIDEO 48 -#define BASS_CONFIG_AIRPLAY 49 -#define BASS_CONFIG_DEV_NONSTOP 50 -#define BASS_CONFIG_IOS_NOCATEGORY 51 -#define BASS_CONFIG_VERIFY_NET 52 -#define BASS_CONFIG_DEV_PERIOD 53 -#define BASS_CONFIG_FLOAT 54 -#define BASS_CONFIG_NET_SEEK 56 -#define BASS_CONFIG_AM_DISABLE 58 -#define BASS_CONFIG_NET_PLAYLIST_DEPTH 59 -#define BASS_CONFIG_NET_PREBUF_WAIT 60 - -// BASS_SetConfigPtr options -#define BASS_CONFIG_NET_AGENT 16 -#define BASS_CONFIG_NET_PROXY 17 -#define BASS_CONFIG_IOS_NOTIFY 46 - -// BASS_Init flags -#define BASS_DEVICE_8BITS 1 // 8 bit -#define BASS_DEVICE_MONO 2 // mono -#define BASS_DEVICE_3D 4 // enable 3D functionality -#define BASS_DEVICE_16BITS 8 // limit output to 16 bit -#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct) -#define BASS_DEVICE_CPSPEAKERS 0x400 // detect speakers via Windows control panel -#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment -#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement -#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin -#define BASS_DEVICE_FREQ 0x4000 // set device sample rate -#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo -#define BASS_DEVICE_HOG 0x10000 // hog/exclusive mode -#define BASS_DEVICE_AUDIOTRACK 0x20000 // use AudioTrack output -#define BASS_DEVICE_DSOUND 0x40000 // use DirectSound output - -// DirectSound interfaces (for use with BASS_GetDSoundObject) -#define BASS_OBJECT_DS 1 // IDirectSound -#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener - -// Device info structure -typedef struct { -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // description - const wchar_t *driver; // driver -#else - const char *name; // description - const char *driver; // driver -#endif - DWORD flags; -} BASS_DEVICEINFO; - -// BASS_DEVICEINFO flags -#define BASS_DEVICE_ENABLED 1 -#define BASS_DEVICE_DEFAULT 2 -#define BASS_DEVICE_INIT 4 -#define BASS_DEVICE_LOOPBACK 8 - -#define BASS_DEVICE_TYPE_MASK 0xff000000 -#define BASS_DEVICE_TYPE_NETWORK 0x01000000 -#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000 -#define BASS_DEVICE_TYPE_LINE 0x03000000 -#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000 -#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000 -#define BASS_DEVICE_TYPE_HEADSET 0x06000000 -#define BASS_DEVICE_TYPE_HANDSET 0x07000000 -#define BASS_DEVICE_TYPE_DIGITAL 0x08000000 -#define BASS_DEVICE_TYPE_SPDIF 0x09000000 -#define BASS_DEVICE_TYPE_HDMI 0x0a000000 -#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000 - -// BASS_GetDeviceInfo flags -#define BASS_DEVICES_AIRPLAY 0x1000000 +#define BASS_CONFIG_OGG_PRESCAN 47 +#define BASS_CONFIG_MF_VIDEO 48 +#define BASS_CONFIG_AIRPLAY 49 +#define BASS_CONFIG_DEV_NONSTOP 50 +#define BASS_CONFIG_IOS_NOCATEGORY 51 +#define BASS_CONFIG_VERIFY_NET 52 +#define BASS_CONFIG_DEV_PERIOD 53 +#define BASS_CONFIG_FLOAT 54 +#define BASS_CONFIG_NET_SEEK 56 +#define BASS_CONFIG_AM_DISABLE 58 +#define BASS_CONFIG_NET_PLAYLIST_DEPTH 59 +#define BASS_CONFIG_NET_PREBUF_WAIT 60 -typedef struct { - DWORD flags; // device capabilities (DSCAPS_xxx flags) - DWORD hwsize; // size of total device hardware memory - DWORD hwfree; // size of free device hardware memory - DWORD freesam; // number of free sample slots in the hardware - DWORD free3d; // number of free 3D sample slots in the hardware - DWORD minrate; // min sample rate supported by the hardware - DWORD maxrate; // max sample rate supported by the hardware - BOOL eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) - DWORD minbuf; // recommended minimum buffer length in ms (requires BASS_DEVICE_LATENCY) - DWORD dsver; // DirectSound version - DWORD latency; // delay (in ms) before start of playback (requires BASS_DEVICE_LATENCY) - DWORD initflags; // BASS_Init "flags" parameter - DWORD speakers; // number of speakers available - DWORD freq; // current output rate -} BASS_INFO; - -// BASS_INFO flags (from DSOUND.H) -#define DSCAPS_CONTINUOUSRATE 0x00000010 // supports all sample rates between min/maxrate -#define DSCAPS_EMULDRIVER 0x00000020 // device does NOT have hardware DirectSound support -#define DSCAPS_CERTIFIED 0x00000040 // device driver has been certified by Microsoft -#define DSCAPS_SECONDARYMONO 0x00000100 // mono -#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo -#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit -#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit - -// Recording device info structure -typedef struct { - DWORD flags; // device capabilities (DSCCAPS_xxx flags) - DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags) - DWORD inputs; // number of inputs - BOOL singlein; // TRUE = only 1 input can be set at a time - DWORD freq; // current input rate -} 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 - -// defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H) -#ifndef WAVE_FORMAT_1M08 -#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */ -#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */ -#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */ -#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */ -#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */ -#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */ -#endif - -// Sample info structure -typedef struct { - DWORD freq; // default playback rate - float volume; // default volume (0-1) - float pan; // default pan (-1=left, 0=middle, 1=right) - DWORD flags; // BASS_SAMPLE_xxx flags - DWORD length; // length (in bytes) - DWORD max; // maximum simultaneous playbacks - DWORD origres; // original resolution - DWORD chans; // number of channels - DWORD mingap; // minimum gap (ms) between creating channels - DWORD mode3d; // BASS_3DMODE_xxx mode - float mindist; // minimum distance - float maxdist; // maximum distance - DWORD iangle; // angle of inside projection cone - DWORD oangle; // angle of outside projection cone - float outvol; // delta-volume outside the projection cone - DWORD vam; // voice allocation/management flags (BASS_VAM_xxx) - DWORD priority; // priority (0=lowest, 0xffffffff=highest) -} BASS_SAMPLE; - -#define BASS_SAMPLE_8BITS 1 // 8 bit -#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point -#define BASS_SAMPLE_MONO 2 // mono -#define BASS_SAMPLE_LOOP 4 // looped -#define BASS_SAMPLE_3D 8 // 3D functionality -#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing -#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only) -#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management -#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects -#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume -#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing -#define BASS_SAMPLE_OVER_DIST 0x30000 // override furthest from listener (3D only) - -#define BASS_STREAM_PRESCAN 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1) -#define BASS_STREAM_AUTOFREE 0x40000 // automatically free the stream when it stop/ends -#define BASS_STREAM_RESTRATE 0x80000 // restrict the download rate of internet file streams -#define BASS_STREAM_BLOCK 0x100000 // download/play internet file stream in small blocks -#define BASS_STREAM_DECODE 0x200000 // don't play the stream, only decode (BASS_ChannelGetData) -#define BASS_STREAM_STATUS 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC - -#define BASS_MP3_IGNOREDELAY 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info -#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN - -#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT -#define BASS_MUSIC_MONO BASS_SAMPLE_MONO -#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP -#define BASS_MUSIC_3D BASS_SAMPLE_3D -#define BASS_MUSIC_FX BASS_SAMPLE_FX -#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE -#define BASS_MUSIC_DECODE BASS_STREAM_DECODE -#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length -#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN -#define BASS_MUSIC_RAMP 0x200 // normal ramping -#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping -#define BASS_MUSIC_SURROUND 0x800 // surround sound -#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2) -#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files -#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does -#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does -#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing -#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing -#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position -#define BASS_MUSIC_POSRESETEX 0x400000 // stop all notes and reset bmp/etc when moving position -#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect -#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples - -// Speaker assignment flags -#define BASS_SPEAKER_FRONT 0x1000000 // front speakers -#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers -#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1) -#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1) -#define BASS_SPEAKER_N(n) ((n)<<24) // n'th pair of speakers (max 15) -#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left -#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right -#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE|BASS_SPEAKER_RIGHT -#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2|BASS_SPEAKER_LEFT -#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2|BASS_SPEAKER_RIGHT - -#define BASS_ASYNCFILE 0x40000000 -#define BASS_UNICODE 0x80000000 - -#define BASS_RECORD_PAUSE 0x8000 // start recording paused -#define BASS_RECORD_ECHOCANCEL 0x2000 -#define BASS_RECORD_AGC 0x4000 - -// DX7 voice allocation & management flags -#define BASS_VAM_HARDWARE 1 -#define BASS_VAM_SOFTWARE 2 -#define BASS_VAM_TERM_TIME 4 -#define BASS_VAM_TERM_DIST 8 -#define BASS_VAM_TERM_PRIO 16 - -// Channel info structure -typedef struct { - DWORD freq; // default playback rate - DWORD chans; // channels - DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags - DWORD ctype; // type of channel - DWORD origres; // original resolution - HPLUGIN plugin; // plugin - HSAMPLE sample; // sample - const char *filename; // filename -} BASS_CHANNELINFO; - -#define BASS_ORIGRES_FLOAT 0x10000 - -// BASS_CHANNELINFO types -#define BASS_CTYPE_SAMPLE 1 -#define BASS_CTYPE_RECORD 2 -#define BASS_CTYPE_STREAM 0x10000 -#define BASS_CTYPE_STREAM_OGG 0x10002 -#define BASS_CTYPE_STREAM_MP1 0x10003 -#define BASS_CTYPE_STREAM_MP2 0x10004 -#define BASS_CTYPE_STREAM_MP3 0x10005 -#define BASS_CTYPE_STREAM_AIFF 0x10006 -#define BASS_CTYPE_STREAM_CA 0x10007 -#define BASS_CTYPE_STREAM_MF 0x10008 -#define BASS_CTYPE_STREAM_AM 0x10009 -#define BASS_CTYPE_STREAM_DUMMY 0x18000 -#define BASS_CTYPE_STREAM_DEVICE 0x18001 -#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec -#define BASS_CTYPE_STREAM_WAV_PCM 0x50001 -#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003 -#define BASS_CTYPE_MUSIC_MOD 0x20000 -#define BASS_CTYPE_MUSIC_MTM 0x20001 -#define BASS_CTYPE_MUSIC_S3M 0x20002 -#define BASS_CTYPE_MUSIC_XM 0x20003 -#define BASS_CTYPE_MUSIC_IT 0x20004 -#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag - -typedef struct { - DWORD ctype; // channel type -#if defined(_WIN32_WCE) || (WINAPI_FAMILY && WINAPI_FAMILY!=WINAPI_FAMILY_DESKTOP_APP) - const wchar_t *name; // format description - const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...) -#else - const char *name; // format description - const char *exts; // file extension filter (*.ext1;*.ext2;etc...) -#endif -} BASS_PLUGINFORM; - -typedef struct { - DWORD version; // version (same form as BASS_GetVersion) - DWORD formatc; // number of formats - const BASS_PLUGINFORM *formats; // the array of formats -} BASS_PLUGININFO; - -// 3D vector (for 3D positions/velocities/orientations) -typedef struct BASS_3DVECTOR { -#ifdef __cplusplus - BASS_3DVECTOR() {}; - BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {}; -#endif - float x; // +=right, -=left - float y; // +=up, -=down - float z; // +=front, -=behind -} BASS_3DVECTOR; - -// 3D channel modes -#define BASS_3DMODE_NORMAL 0 // normal 3D processing -#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener -#define BASS_3DMODE_OFF 2 // no 3D processing - -// software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM) -#define BASS_3DALG_DEFAULT 0 -#define BASS_3DALG_OFF 1 -#define BASS_3DALG_FULL 2 -#define BASS_3DALG_LIGHT 3 - -// EAX environments, use with BASS_SetEAXParameters -enum -{ - EAX_ENVIRONMENT_GENERIC, - EAX_ENVIRONMENT_PADDEDCELL, - EAX_ENVIRONMENT_ROOM, - EAX_ENVIRONMENT_BATHROOM, - EAX_ENVIRONMENT_LIVINGROOM, - EAX_ENVIRONMENT_STONEROOM, - EAX_ENVIRONMENT_AUDITORIUM, - EAX_ENVIRONMENT_CONCERTHALL, - EAX_ENVIRONMENT_CAVE, - EAX_ENVIRONMENT_ARENA, - EAX_ENVIRONMENT_HANGAR, - EAX_ENVIRONMENT_CARPETEDHALLWAY, - EAX_ENVIRONMENT_HALLWAY, - EAX_ENVIRONMENT_STONECORRIDOR, - EAX_ENVIRONMENT_ALLEY, - EAX_ENVIRONMENT_FOREST, - EAX_ENVIRONMENT_CITY, - EAX_ENVIRONMENT_MOUNTAINS, - EAX_ENVIRONMENT_QUARRY, - EAX_ENVIRONMENT_PLAIN, - EAX_ENVIRONMENT_PARKINGLOT, - EAX_ENVIRONMENT_SEWERPIPE, - EAX_ENVIRONMENT_UNDERWATER, - EAX_ENVIRONMENT_DRUGGED, - EAX_ENVIRONMENT_DIZZY, - EAX_ENVIRONMENT_PSYCHOTIC, - - EAX_ENVIRONMENT_COUNT // total number of environments -}; - -// EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx) -#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC,0.5F,1.493F,0.5F -#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL,0.25F,0.1F,0.0F -#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM,0.417F,0.4F,0.666F -#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM,0.653F,1.499F,0.166F -#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM,0.208F,0.478F,0.0F -#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM,0.5F,2.309F,0.888F -#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM,0.403F,4.279F,0.5F -#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL,0.5F,3.961F,0.5F -#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE,0.5F,2.886F,1.304F -#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA,0.361F,7.284F,0.332F -#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR,0.5F,10.0F,0.3F -#define EAX_PRESET_CARPETEDHALLWAY EAX_ENVIRONMENT_CARPETEDHALLWAY,0.153F,0.259F,2.0F -#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY,0.361F,1.493F,0.0F -#define EAX_PRESET_STONECORRIDOR EAX_ENVIRONMENT_STONECORRIDOR,0.444F,2.697F,0.638F -#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY,0.25F,1.752F,0.776F -#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST,0.111F,3.145F,0.472F -#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY,0.111F,2.767F,0.224F -#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS,0.194F,7.841F,0.472F -#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY,1.0F,1.499F,0.5F -#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN,0.097F,2.767F,0.224F -#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT,0.208F,1.652F,1.5F -#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE,0.652F,2.886F,0.25F -#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER,1.0F,1.499F,0.0F -#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED,0.875F,8.392F,1.388F -#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY,0.139F,17.234F,0.666F -#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC,0.486F,7.563F,0.806F - -typedef DWORD (CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, void *user); -/* User stream callback function. NOTE: A stream function should obviously be as quick -as possible, other streams (and MOD musics) can't be mixed until it's finished. -handle : The stream that needs writing -buffer : Buffer to write the samples in -length : Number of bytes to write -user : The 'user' parameter value given when calling BASS_StreamCreate -RETURN : Number of bytes written. Set the BASS_STREAMPROC_END flag to end the stream. */ - -#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag - -// special STREAMPROCs -#define STREAMPROC_DUMMY (STREAMPROC*)0 // "dummy" stream -#define STREAMPROC_PUSH (STREAMPROC*)-1 // push stream -#define STREAMPROC_DEVICE (STREAMPROC*)-2 // device mix stream - -// BASS_StreamCreateFileUser file systems -#define STREAMFILE_NOBUFFER 0 -#define STREAMFILE_BUFFER 1 -#define STREAMFILE_BUFFERPUSH 2 - -// User file stream callback functions -typedef void (CALLBACK FILECLOSEPROC)(void *user); -typedef QWORD (CALLBACK FILELENPROC)(void *user); -typedef DWORD (CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user); -typedef BOOL (CALLBACK FILESEEKPROC)(QWORD offset, void *user); - -typedef struct { - FILECLOSEPROC *close; - FILELENPROC *length; - FILEREADPROC *read; - FILESEEKPROC *seek; -} BASS_FILEPROCS; - -// BASS_StreamPutFileData options -#define BASS_FILEDATA_END 0 // end & close the file - -// BASS_StreamGetFilePosition modes -#define BASS_FILEPOS_CURRENT 0 -#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT -#define BASS_FILEPOS_DOWNLOAD 1 -#define BASS_FILEPOS_END 2 -#define BASS_FILEPOS_START 3 -#define BASS_FILEPOS_CONNECTED 4 -#define BASS_FILEPOS_BUFFER 5 -#define BASS_FILEPOS_SOCKET 6 -#define BASS_FILEPOS_ASYNCBUF 7 -#define BASS_FILEPOS_SIZE 8 -#define BASS_FILEPOS_BUFFERING 9 - -typedef void (CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, void *user); -/* Internet stream download callback function. -buffer : Buffer containing the downloaded data... NULL=end of download -length : Number of bytes in the buffer -user : The 'user' parameter value given when calling BASS_StreamCreateURL */ - -// BASS_ChannelSetSync types -#define BASS_SYNC_POS 0 -#define BASS_SYNC_END 2 -#define BASS_SYNC_META 4 -#define BASS_SYNC_SLIDE 5 -#define BASS_SYNC_STALL 6 -#define BASS_SYNC_DOWNLOAD 7 -#define BASS_SYNC_FREE 8 -#define BASS_SYNC_SETPOS 11 -#define BASS_SYNC_MUSICPOS 10 -#define BASS_SYNC_MUSICINST 1 -#define BASS_SYNC_MUSICFX 3 -#define BASS_SYNC_OGG_CHANGE 12 -#define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime -#define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously - -typedef void (CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, void *user); -/* 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 -it's finished either. -handle : The sync that has occured -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); -/* 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. -handle : The DSP handle -channel: Channel that the DSP is being applied to -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); -/* Recording callback function. -handle : The recording handle -buffer : Buffer containing the recorded sample data -length : Number of bytes -user : The 'user' parameter value given when calling BASS_RecordStart -RETURN : TRUE = continue recording, FALSE = stop */ - -// BASS_ChannelIsActive return values -#define BASS_ACTIVE_STOPPED 0 -#define BASS_ACTIVE_PLAYING 1 -#define BASS_ACTIVE_STALLED 2 -#define BASS_ACTIVE_PAUSED 3 - -// Channel attributes -#define BASS_ATTRIB_FREQ 1 -#define BASS_ATTRIB_VOL 2 -#define BASS_ATTRIB_PAN 3 -#define BASS_ATTRIB_EAXMIX 4 -#define BASS_ATTRIB_NOBUFFER 5 -#define BASS_ATTRIB_VBR 6 -#define BASS_ATTRIB_CPU 7 -#define BASS_ATTRIB_SRC 8 -#define BASS_ATTRIB_NET_RESUME 9 -#define BASS_ATTRIB_SCANINFO 10 -#define BASS_ATTRIB_NORAMP 11 -#define BASS_ATTRIB_BITRATE 12 -#define BASS_ATTRIB_BUFFER 13 -#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100 -#define BASS_ATTRIB_MUSIC_PANSEP 0x101 -#define BASS_ATTRIB_MUSIC_PSCALER 0x102 -#define BASS_ATTRIB_MUSIC_BPM 0x103 -#define BASS_ATTRIB_MUSIC_SPEED 0x104 -#define BASS_ATTRIB_MUSIC_VOL_GLOBAL 0x105 -#define BASS_ATTRIB_MUSIC_ACTIVE 0x106 -#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel # -#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument # - -// BASS_ChannelSlideAttribute flags -#define BASS_SLIDE_LOG 0x1000000 - -// BASS_ChannelGetData flags -#define BASS_DATA_AVAILABLE 0 // query how much data is buffered -#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data -#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data -#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT -#define BASS_DATA_FFT512 0x80000001 // 512 FFT -#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT -#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT -#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT -#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT -#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT -#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT -#define BASS_DATA_FFT_INDIVIDUAL 0x10 // FFT flag: FFT for each channel, else all combined -#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window -#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias -#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data - -// BASS_ChannelGetLevelEx flags -#define BASS_LEVEL_MONO 1 -#define BASS_LEVEL_STEREO 2 -#define BASS_LEVEL_RMS 4 -#define BASS_LEVEL_VOLPAN 8 - -// BASS_ChannelGetTags types : what's returned -#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure -#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block -#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings -#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings -#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings -#define BASS_TAG_META 5 // ICY metadata : ANSI string -#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings -#define BASS_TAG_MP4 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings -#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings -#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string -#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string -#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure -#define BASS_TAG_MF 13 // Media Foundation tags : series of null-terminated UTF-8 strings -#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure -#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string -#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string -#define BASS_TAG_RIFF_INFO 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings -#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure -#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure -#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string -#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure -#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure -#define BASS_TAG_APE_BINARY 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure -#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string -#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string -#define BASS_TAG_MUSIC_ORDERS 0x10002 // MOD order list : BYTE array of pattern numbers -#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string -#define BASS_TAG_MUSIC_INST 0x10100 // + instrument #, MOD instrument name : ANSI string -#define BASS_TAG_MUSIC_SAMPLE 0x10300 // + sample #, MOD sample name : ANSI string +// BASS_SetConfigPtr options +#define BASS_CONFIG_NET_AGENT 16 +#define BASS_CONFIG_NET_PROXY 17 +#define BASS_CONFIG_IOS_NOTIFY 46 -// ID3v1 tag structure -typedef struct { - char id[3]; - char title[30]; - char artist[30]; - char album[30]; - char year[4]; - char comment[30]; - BYTE genre; -} TAG_ID3; +// BASS_Init flags +#define BASS_DEVICE_8BITS 1 // 8 bit +#define BASS_DEVICE_MONO 2 // mono +#define BASS_DEVICE_3D 4 // enable 3D functionality +#define BASS_DEVICE_16BITS 8 // limit output to 16 bit +#define BASS_DEVICE_LATENCY 0x100 // calculate device latency (BASS_INFO struct) +#define BASS_DEVICE_CPSPEAKERS \ + 0x400 // detect speakers via Windows control panel +#define BASS_DEVICE_SPEAKERS 0x800 // force enabling of speaker assignment +#define BASS_DEVICE_NOSPEAKER 0x1000 // ignore speaker arrangement +#define BASS_DEVICE_DMIX 0x2000 // use ALSA "dmix" plugin +#define BASS_DEVICE_FREQ 0x4000 // set device sample rate +#define BASS_DEVICE_STEREO 0x8000 // limit output to stereo +#define BASS_DEVICE_HOG 0x10000 // hog/exclusive mode +#define BASS_DEVICE_AUDIOTRACK 0x20000 // use AudioTrack output +#define BASS_DEVICE_DSOUND 0x40000 // use DirectSound output -// Binary APE tag structure +// DirectSound interfaces (for use with BASS_GetDSoundObject) +#define BASS_OBJECT_DS 1 // IDirectSound +#define BASS_OBJECT_DS3DL 2 // IDirectSound3DListener + +// Device info structure typedef struct { - const char *key; - const void *data; - DWORD length; +#if defined(_WIN32_WCE) || \ + (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) + const wchar_t *name; // description + const wchar_t *driver; // driver +#else + const char *name; // description + const char *driver; // driver +#endif + DWORD flags; +} BASS_DEVICEINFO; + +// BASS_DEVICEINFO flags +#define BASS_DEVICE_ENABLED 1 +#define BASS_DEVICE_DEFAULT 2 +#define BASS_DEVICE_INIT 4 +#define BASS_DEVICE_LOOPBACK 8 + +#define BASS_DEVICE_TYPE_MASK 0xff000000 +#define BASS_DEVICE_TYPE_NETWORK 0x01000000 +#define BASS_DEVICE_TYPE_SPEAKERS 0x02000000 +#define BASS_DEVICE_TYPE_LINE 0x03000000 +#define BASS_DEVICE_TYPE_HEADPHONES 0x04000000 +#define BASS_DEVICE_TYPE_MICROPHONE 0x05000000 +#define BASS_DEVICE_TYPE_HEADSET 0x06000000 +#define BASS_DEVICE_TYPE_HANDSET 0x07000000 +#define BASS_DEVICE_TYPE_DIGITAL 0x08000000 +#define BASS_DEVICE_TYPE_SPDIF 0x09000000 +#define BASS_DEVICE_TYPE_HDMI 0x0a000000 +#define BASS_DEVICE_TYPE_DISPLAYPORT 0x40000000 + +// BASS_GetDeviceInfo flags +#define BASS_DEVICES_AIRPLAY 0x1000000 + +typedef struct { + DWORD flags; // device capabilities (DSCAPS_xxx flags) + DWORD hwsize; // size of total device hardware memory + DWORD hwfree; // size of free device hardware memory + DWORD freesam; // number of free sample slots in the hardware + DWORD free3d; // number of free 3D sample slots in the hardware + DWORD minrate; // min sample rate supported by the hardware + DWORD maxrate; // max sample rate supported by the hardware + BOOL + eax; // device supports EAX? (always FALSE if BASS_DEVICE_3D was not used) + DWORD minbuf; // recommended minimum buffer length in ms (requires + // BASS_DEVICE_LATENCY) + DWORD dsver; // DirectSound version + DWORD latency; // delay (in ms) before start of playback (requires + // BASS_DEVICE_LATENCY) + DWORD initflags; // BASS_Init "flags" parameter + DWORD speakers; // number of speakers available + DWORD freq; // current output rate +} BASS_INFO; + +// BASS_INFO flags (from DSOUND.H) +#define DSCAPS_CONTINUOUSRATE \ + 0x00000010 // supports all sample rates between min/maxrate +#define DSCAPS_EMULDRIVER \ + 0x00000020 // device does NOT have hardware DirectSound support +#define DSCAPS_CERTIFIED \ + 0x00000040 // device driver has been certified by Microsoft +#define DSCAPS_SECONDARYMONO 0x00000100 // mono +#define DSCAPS_SECONDARYSTEREO 0x00000200 // stereo +#define DSCAPS_SECONDARY8BIT 0x00000400 // 8 bit +#define DSCAPS_SECONDARY16BIT 0x00000800 // 16 bit + +// Recording device info structure +typedef struct { + DWORD flags; // device capabilities (DSCCAPS_xxx flags) + DWORD formats; // supported standard formats (WAVE_FORMAT_xxx flags) + DWORD inputs; // number of inputs + BOOL singlein; // TRUE = only 1 input can be set at a time + DWORD freq; // current input rate +} 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 + +// defines for formats field of BASS_RECORDINFO (from MMSYSTEM.H) +#ifndef WAVE_FORMAT_1M08 +#define WAVE_FORMAT_1M08 0x00000001 /* 11.025 kHz, Mono, 8-bit */ +#define WAVE_FORMAT_1S08 0x00000002 /* 11.025 kHz, Stereo, 8-bit */ +#define WAVE_FORMAT_1M16 0x00000004 /* 11.025 kHz, Mono, 16-bit */ +#define WAVE_FORMAT_1S16 0x00000008 /* 11.025 kHz, Stereo, 16-bit */ +#define WAVE_FORMAT_2M08 0x00000010 /* 22.05 kHz, Mono, 8-bit */ +#define WAVE_FORMAT_2S08 0x00000020 /* 22.05 kHz, Stereo, 8-bit */ +#define WAVE_FORMAT_2M16 0x00000040 /* 22.05 kHz, Mono, 16-bit */ +#define WAVE_FORMAT_2S16 0x00000080 /* 22.05 kHz, Stereo, 16-bit */ +#define WAVE_FORMAT_4M08 0x00000100 /* 44.1 kHz, Mono, 8-bit */ +#define WAVE_FORMAT_4S08 0x00000200 /* 44.1 kHz, Stereo, 8-bit */ +#define WAVE_FORMAT_4M16 0x00000400 /* 44.1 kHz, Mono, 16-bit */ +#define WAVE_FORMAT_4S16 0x00000800 /* 44.1 kHz, Stereo, 16-bit */ +#endif + +// Sample info structure +typedef struct { + DWORD freq; // default playback rate + float volume; // default volume (0-1) + float pan; // default pan (-1=left, 0=middle, 1=right) + DWORD flags; // BASS_SAMPLE_xxx flags + DWORD length; // length (in bytes) + DWORD max; // maximum simultaneous playbacks + DWORD origres; // original resolution + DWORD chans; // number of channels + DWORD mingap; // minimum gap (ms) between creating channels + DWORD mode3d; // BASS_3DMODE_xxx mode + float mindist; // minimum distance + float maxdist; // maximum distance + DWORD iangle; // angle of inside projection cone + DWORD oangle; // angle of outside projection cone + float outvol; // delta-volume outside the projection cone + DWORD vam; // voice allocation/management flags (BASS_VAM_xxx) + DWORD priority; // priority (0=lowest, 0xffffffff=highest) +} BASS_SAMPLE; + +#define BASS_SAMPLE_8BITS 1 // 8 bit +#define BASS_SAMPLE_FLOAT 256 // 32 bit floating-point +#define BASS_SAMPLE_MONO 2 // mono +#define BASS_SAMPLE_LOOP 4 // looped +#define BASS_SAMPLE_3D 8 // 3D functionality +#define BASS_SAMPLE_SOFTWARE 16 // not using hardware mixing +#define BASS_SAMPLE_MUTEMAX 32 // mute at max distance (3D only) +#define BASS_SAMPLE_VAM 64 // DX7 voice allocation & management +#define BASS_SAMPLE_FX 128 // old implementation of DX8 effects +#define BASS_SAMPLE_OVER_VOL 0x10000 // override lowest volume +#define BASS_SAMPLE_OVER_POS 0x20000 // override longest playing +#define BASS_SAMPLE_OVER_DIST \ + 0x30000 // override furthest from listener (3D only) + +#define BASS_STREAM_PRESCAN \ + 0x20000 // enable pin-point seeking/length (MP3/MP2/MP1) +#define BASS_STREAM_AUTOFREE \ + 0x40000 // automatically free the stream when it stop/ends +#define BASS_STREAM_RESTRATE \ + 0x80000 // restrict the download rate of internet file streams +#define BASS_STREAM_BLOCK \ + 0x100000 // download/play internet file stream in small blocks +#define BASS_STREAM_DECODE \ + 0x200000 // don't play the stream, only decode (BASS_ChannelGetData) +#define BASS_STREAM_STATUS \ + 0x800000 // give server status info (HTTP/ICY tags) in DOWNLOADPROC + +#define BASS_MP3_IGNOREDELAY \ + 0x200 // ignore LAME/Xing/VBRI/iTunes delay & padding info +#define BASS_MP3_SETPOS BASS_STREAM_PRESCAN + +#define BASS_MUSIC_FLOAT BASS_SAMPLE_FLOAT +#define BASS_MUSIC_MONO BASS_SAMPLE_MONO +#define BASS_MUSIC_LOOP BASS_SAMPLE_LOOP +#define BASS_MUSIC_3D BASS_SAMPLE_3D +#define BASS_MUSIC_FX BASS_SAMPLE_FX +#define BASS_MUSIC_AUTOFREE BASS_STREAM_AUTOFREE +#define BASS_MUSIC_DECODE BASS_STREAM_DECODE +#define BASS_MUSIC_PRESCAN BASS_STREAM_PRESCAN // calculate playback length +#define BASS_MUSIC_CALCLEN BASS_MUSIC_PRESCAN +#define BASS_MUSIC_RAMP 0x200 // normal ramping +#define BASS_MUSIC_RAMPS 0x400 // sensitive ramping +#define BASS_MUSIC_SURROUND 0x800 // surround sound +#define BASS_MUSIC_SURROUND2 0x1000 // surround sound (mode 2) +#define BASS_MUSIC_FT2PAN 0x2000 // apply FastTracker 2 panning to XM files +#define BASS_MUSIC_FT2MOD 0x2000 // play .MOD as FastTracker 2 does +#define BASS_MUSIC_PT1MOD 0x4000 // play .MOD as ProTracker 1 does +#define BASS_MUSIC_NONINTER 0x10000 // non-interpolated sample mixing +#define BASS_MUSIC_SINCINTER 0x800000 // sinc interpolated sample mixing +#define BASS_MUSIC_POSRESET 0x8000 // stop all notes when moving position +#define BASS_MUSIC_POSRESETEX \ + 0x400000 // stop all notes and reset bmp/etc when moving position +#define BASS_MUSIC_STOPBACK 0x80000 // stop the music on a backwards jump effect +#define BASS_MUSIC_NOSAMPLE 0x100000 // don't load the samples + +// Speaker assignment flags +#define BASS_SPEAKER_FRONT 0x1000000 // front speakers +#define BASS_SPEAKER_REAR 0x2000000 // rear/side speakers +#define BASS_SPEAKER_CENLFE 0x3000000 // center & LFE speakers (5.1) +#define BASS_SPEAKER_REAR2 0x4000000 // rear center speakers (7.1) +#define BASS_SPEAKER_N(n) ((n) << 24) // n'th pair of speakers (max 15) +#define BASS_SPEAKER_LEFT 0x10000000 // modifier: left +#define BASS_SPEAKER_RIGHT 0x20000000 // modifier: right +#define BASS_SPEAKER_FRONTLEFT BASS_SPEAKER_FRONT | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_FRONTRIGHT BASS_SPEAKER_FRONT | BASS_SPEAKER_RIGHT +#define BASS_SPEAKER_REARLEFT BASS_SPEAKER_REAR | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_REARRIGHT BASS_SPEAKER_REAR | BASS_SPEAKER_RIGHT +#define BASS_SPEAKER_CENTER BASS_SPEAKER_CENLFE | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_LFE BASS_SPEAKER_CENLFE | BASS_SPEAKER_RIGHT +#define BASS_SPEAKER_REAR2LEFT BASS_SPEAKER_REAR2 | BASS_SPEAKER_LEFT +#define BASS_SPEAKER_REAR2RIGHT BASS_SPEAKER_REAR2 | BASS_SPEAKER_RIGHT + +#define BASS_ASYNCFILE 0x40000000 +#define BASS_UNICODE 0x80000000 + +#define BASS_RECORD_PAUSE 0x8000 // start recording paused +#define BASS_RECORD_ECHOCANCEL 0x2000 +#define BASS_RECORD_AGC 0x4000 + +// DX7 voice allocation & management flags +#define BASS_VAM_HARDWARE 1 +#define BASS_VAM_SOFTWARE 2 +#define BASS_VAM_TERM_TIME 4 +#define BASS_VAM_TERM_DIST 8 +#define BASS_VAM_TERM_PRIO 16 + +// Channel info structure +typedef struct { + DWORD freq; // default playback rate + DWORD chans; // channels + DWORD flags; // BASS_SAMPLE/STREAM/MUSIC/SPEAKER flags + DWORD ctype; // type of channel + DWORD origres; // original resolution + HPLUGIN plugin; // plugin + HSAMPLE sample; // sample + const char *filename; // filename +} BASS_CHANNELINFO; + +#define BASS_ORIGRES_FLOAT 0x10000 + +// BASS_CHANNELINFO types +#define BASS_CTYPE_SAMPLE 1 +#define BASS_CTYPE_RECORD 2 +#define BASS_CTYPE_STREAM 0x10000 +#define BASS_CTYPE_STREAM_OGG 0x10002 +#define BASS_CTYPE_STREAM_MP1 0x10003 +#define BASS_CTYPE_STREAM_MP2 0x10004 +#define BASS_CTYPE_STREAM_MP3 0x10005 +#define BASS_CTYPE_STREAM_AIFF 0x10006 +#define BASS_CTYPE_STREAM_CA 0x10007 +#define BASS_CTYPE_STREAM_MF 0x10008 +#define BASS_CTYPE_STREAM_AM 0x10009 +#define BASS_CTYPE_STREAM_DUMMY 0x18000 +#define BASS_CTYPE_STREAM_DEVICE 0x18001 +#define BASS_CTYPE_STREAM_WAV 0x40000 // WAVE flag, LOWORD=codec +#define BASS_CTYPE_STREAM_WAV_PCM 0x50001 +#define BASS_CTYPE_STREAM_WAV_FLOAT 0x50003 +#define BASS_CTYPE_MUSIC_MOD 0x20000 +#define BASS_CTYPE_MUSIC_MTM 0x20001 +#define BASS_CTYPE_MUSIC_S3M 0x20002 +#define BASS_CTYPE_MUSIC_XM 0x20003 +#define BASS_CTYPE_MUSIC_IT 0x20004 +#define BASS_CTYPE_MUSIC_MO3 0x00100 // MO3 flag + +typedef struct { + DWORD ctype; // channel type +#if defined(_WIN32_WCE) || \ + (WINAPI_FAMILY && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) + const wchar_t *name; // format description + const wchar_t *exts; // file extension filter (*.ext1;*.ext2;etc...) +#else + const char *name; // format description + const char *exts; // file extension filter (*.ext1;*.ext2;etc...) +#endif +} BASS_PLUGINFORM; + +typedef struct { + DWORD version; // version (same form as BASS_GetVersion) + DWORD formatc; // number of formats + const BASS_PLUGINFORM *formats; // the array of formats +} BASS_PLUGININFO; + +// 3D vector (for 3D positions/velocities/orientations) +typedef struct BASS_3DVECTOR { +#ifdef __cplusplus + BASS_3DVECTOR(){}; + BASS_3DVECTOR(float _x, float _y, float _z) : x(_x), y(_y), z(_z){}; +#endif + float x; // +=right, -=left + float y; // +=up, -=down + float z; // +=front, -=behind +} BASS_3DVECTOR; + +// 3D channel modes +#define BASS_3DMODE_NORMAL 0 // normal 3D processing +#define BASS_3DMODE_RELATIVE 1 // position is relative to the listener +#define BASS_3DMODE_OFF 2 // no 3D processing + +// software 3D mixing algorithms (used with BASS_CONFIG_3DALGORITHM) +#define BASS_3DALG_DEFAULT 0 +#define BASS_3DALG_OFF 1 +#define BASS_3DALG_FULL 2 +#define BASS_3DALG_LIGHT 3 + +// EAX environments, use with BASS_SetEAXParameters +enum { + EAX_ENVIRONMENT_GENERIC, + EAX_ENVIRONMENT_PADDEDCELL, + EAX_ENVIRONMENT_ROOM, + EAX_ENVIRONMENT_BATHROOM, + EAX_ENVIRONMENT_LIVINGROOM, + EAX_ENVIRONMENT_STONEROOM, + EAX_ENVIRONMENT_AUDITORIUM, + EAX_ENVIRONMENT_CONCERTHALL, + EAX_ENVIRONMENT_CAVE, + EAX_ENVIRONMENT_ARENA, + EAX_ENVIRONMENT_HANGAR, + EAX_ENVIRONMENT_CARPETEDHALLWAY, + EAX_ENVIRONMENT_HALLWAY, + EAX_ENVIRONMENT_STONECORRIDOR, + EAX_ENVIRONMENT_ALLEY, + EAX_ENVIRONMENT_FOREST, + EAX_ENVIRONMENT_CITY, + EAX_ENVIRONMENT_MOUNTAINS, + EAX_ENVIRONMENT_QUARRY, + EAX_ENVIRONMENT_PLAIN, + EAX_ENVIRONMENT_PARKINGLOT, + EAX_ENVIRONMENT_SEWERPIPE, + EAX_ENVIRONMENT_UNDERWATER, + EAX_ENVIRONMENT_DRUGGED, + EAX_ENVIRONMENT_DIZZY, + EAX_ENVIRONMENT_PSYCHOTIC, + + EAX_ENVIRONMENT_COUNT // total number of environments +}; + +// EAX presets, usage: BASS_SetEAXParameters(EAX_PRESET_xxx) +#define EAX_PRESET_GENERIC EAX_ENVIRONMENT_GENERIC, 0.5F, 1.493F, 0.5F +#define EAX_PRESET_PADDEDCELL EAX_ENVIRONMENT_PADDEDCELL, 0.25F, 0.1F, 0.0F +#define EAX_PRESET_ROOM EAX_ENVIRONMENT_ROOM, 0.417F, 0.4F, 0.666F +#define EAX_PRESET_BATHROOM EAX_ENVIRONMENT_BATHROOM, 0.653F, 1.499F, 0.166F +#define EAX_PRESET_LIVINGROOM EAX_ENVIRONMENT_LIVINGROOM, 0.208F, 0.478F, 0.0F +#define EAX_PRESET_STONEROOM EAX_ENVIRONMENT_STONEROOM, 0.5F, 2.309F, 0.888F +#define EAX_PRESET_AUDITORIUM EAX_ENVIRONMENT_AUDITORIUM, 0.403F, 4.279F, 0.5F +#define EAX_PRESET_CONCERTHALL EAX_ENVIRONMENT_CONCERTHALL, 0.5F, 3.961F, 0.5F +#define EAX_PRESET_CAVE EAX_ENVIRONMENT_CAVE, 0.5F, 2.886F, 1.304F +#define EAX_PRESET_ARENA EAX_ENVIRONMENT_ARENA, 0.361F, 7.284F, 0.332F +#define EAX_PRESET_HANGAR EAX_ENVIRONMENT_HANGAR, 0.5F, 10.0F, 0.3F +#define EAX_PRESET_CARPETEDHALLWAY \ + EAX_ENVIRONMENT_CARPETEDHALLWAY, 0.153F, 0.259F, 2.0F +#define EAX_PRESET_HALLWAY EAX_ENVIRONMENT_HALLWAY, 0.361F, 1.493F, 0.0F +#define EAX_PRESET_STONECORRIDOR \ + EAX_ENVIRONMENT_STONECORRIDOR, 0.444F, 2.697F, 0.638F +#define EAX_PRESET_ALLEY EAX_ENVIRONMENT_ALLEY, 0.25F, 1.752F, 0.776F +#define EAX_PRESET_FOREST EAX_ENVIRONMENT_FOREST, 0.111F, 3.145F, 0.472F +#define EAX_PRESET_CITY EAX_ENVIRONMENT_CITY, 0.111F, 2.767F, 0.224F +#define EAX_PRESET_MOUNTAINS EAX_ENVIRONMENT_MOUNTAINS, 0.194F, 7.841F, 0.472F +#define EAX_PRESET_QUARRY EAX_ENVIRONMENT_QUARRY, 1.0F, 1.499F, 0.5F +#define EAX_PRESET_PLAIN EAX_ENVIRONMENT_PLAIN, 0.097F, 2.767F, 0.224F +#define EAX_PRESET_PARKINGLOT EAX_ENVIRONMENT_PARKINGLOT, 0.208F, 1.652F, 1.5F +#define EAX_PRESET_SEWERPIPE EAX_ENVIRONMENT_SEWERPIPE, 0.652F, 2.886F, 0.25F +#define EAX_PRESET_UNDERWATER EAX_ENVIRONMENT_UNDERWATER, 1.0F, 1.499F, 0.0F +#define EAX_PRESET_DRUGGED EAX_ENVIRONMENT_DRUGGED, 0.875F, 8.392F, 1.388F +#define EAX_PRESET_DIZZY EAX_ENVIRONMENT_DIZZY, 0.139F, 17.234F, 0.666F +#define EAX_PRESET_PSYCHOTIC EAX_ENVIRONMENT_PSYCHOTIC, 0.486F, 7.563F, 0.806F + +typedef DWORD(CALLBACK STREAMPROC)(HSTREAM handle, void *buffer, DWORD length, + void *user); +/* User stream callback function. NOTE: A stream function should obviously be as +quick as possible, other streams (and MOD musics) can't be mixed until it's +finished. handle : The stream that needs writing buffer : Buffer to write the +samples in length : Number of bytes to write user : The 'user' parameter value +given when calling BASS_StreamCreate RETURN : Number of bytes written. Set the +BASS_STREAMPROC_END flag to end the stream. */ + +#define BASS_STREAMPROC_END 0x80000000 // end of user stream flag + +// special STREAMPROCs +#define STREAMPROC_DUMMY (STREAMPROC *)0 // "dummy" stream +#define STREAMPROC_PUSH (STREAMPROC *)-1 // push stream +#define STREAMPROC_DEVICE (STREAMPROC *)-2 // device mix stream + +// BASS_StreamCreateFileUser file systems +#define STREAMFILE_NOBUFFER 0 +#define STREAMFILE_BUFFER 1 +#define STREAMFILE_BUFFERPUSH 2 + +// User file stream callback functions +typedef void(CALLBACK FILECLOSEPROC)(void *user); +typedef QWORD(CALLBACK FILELENPROC)(void *user); +typedef DWORD(CALLBACK FILEREADPROC)(void *buffer, DWORD length, void *user); +typedef BOOL(CALLBACK FILESEEKPROC)(QWORD offset, void *user); + +typedef struct { + FILECLOSEPROC *close; + FILELENPROC *length; + FILEREADPROC *read; + FILESEEKPROC *seek; +} BASS_FILEPROCS; + +// BASS_StreamPutFileData options +#define BASS_FILEDATA_END 0 // end & close the file + +// BASS_StreamGetFilePosition modes +#define BASS_FILEPOS_CURRENT 0 +#define BASS_FILEPOS_DECODE BASS_FILEPOS_CURRENT +#define BASS_FILEPOS_DOWNLOAD 1 +#define BASS_FILEPOS_END 2 +#define BASS_FILEPOS_START 3 +#define BASS_FILEPOS_CONNECTED 4 +#define BASS_FILEPOS_BUFFER 5 +#define BASS_FILEPOS_SOCKET 6 +#define BASS_FILEPOS_ASYNCBUF 7 +#define BASS_FILEPOS_SIZE 8 +#define BASS_FILEPOS_BUFFERING 9 + +typedef void(CALLBACK DOWNLOADPROC)(const void *buffer, DWORD length, + void *user); +/* Internet stream download callback function. +buffer : Buffer containing the downloaded data... NULL=end of download +length : Number of bytes in the buffer +user : The 'user' parameter value given when calling BASS_StreamCreateURL */ + +// BASS_ChannelSetSync types +#define BASS_SYNC_POS 0 +#define BASS_SYNC_END 2 +#define BASS_SYNC_META 4 +#define BASS_SYNC_SLIDE 5 +#define BASS_SYNC_STALL 6 +#define BASS_SYNC_DOWNLOAD 7 +#define BASS_SYNC_FREE 8 +#define BASS_SYNC_SETPOS 11 +#define BASS_SYNC_MUSICPOS 10 +#define BASS_SYNC_MUSICINST 1 +#define BASS_SYNC_MUSICFX 3 +#define BASS_SYNC_OGG_CHANGE 12 +#define BASS_SYNC_MIXTIME 0x40000000 // flag: sync at mixtime, else at playtime +#define BASS_SYNC_ONETIME 0x80000000 // flag: sync only once, else continuously + +typedef void(CALLBACK SYNCPROC)(HSYNC handle, DWORD channel, DWORD data, + void *user); +/* 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 +it's finished either. +handle : The sync that has occured +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); +/* 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. +handle : The DSP handle +channel: Channel that the DSP is being applied to +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); +/* Recording callback function. +handle : The recording handle +buffer : Buffer containing the recorded sample data +length : Number of bytes +user : The 'user' parameter value given when calling BASS_RecordStart +RETURN : TRUE = continue recording, FALSE = stop */ + +// BASS_ChannelIsActive return values +#define BASS_ACTIVE_STOPPED 0 +#define BASS_ACTIVE_PLAYING 1 +#define BASS_ACTIVE_STALLED 2 +#define BASS_ACTIVE_PAUSED 3 + +// Channel attributes +#define BASS_ATTRIB_FREQ 1 +#define BASS_ATTRIB_VOL 2 +#define BASS_ATTRIB_PAN 3 +#define BASS_ATTRIB_EAXMIX 4 +#define BASS_ATTRIB_NOBUFFER 5 +#define BASS_ATTRIB_VBR 6 +#define BASS_ATTRIB_CPU 7 +#define BASS_ATTRIB_SRC 8 +#define BASS_ATTRIB_NET_RESUME 9 +#define BASS_ATTRIB_SCANINFO 10 +#define BASS_ATTRIB_NORAMP 11 +#define BASS_ATTRIB_BITRATE 12 +#define BASS_ATTRIB_BUFFER 13 +#define BASS_ATTRIB_MUSIC_AMPLIFY 0x100 +#define BASS_ATTRIB_MUSIC_PANSEP 0x101 +#define BASS_ATTRIB_MUSIC_PSCALER 0x102 +#define BASS_ATTRIB_MUSIC_BPM 0x103 +#define BASS_ATTRIB_MUSIC_SPEED 0x104 +#define BASS_ATTRIB_MUSIC_VOL_GLOBAL 0x105 +#define BASS_ATTRIB_MUSIC_ACTIVE 0x106 +#define BASS_ATTRIB_MUSIC_VOL_CHAN 0x200 // + channel # +#define BASS_ATTRIB_MUSIC_VOL_INST 0x300 // + instrument # + +// BASS_ChannelSlideAttribute flags +#define BASS_SLIDE_LOG 0x1000000 + +// BASS_ChannelGetData flags +#define BASS_DATA_AVAILABLE 0 // query how much data is buffered +#define BASS_DATA_FIXED 0x20000000 // flag: return 8.24 fixed-point data +#define BASS_DATA_FLOAT 0x40000000 // flag: return floating-point sample data +#define BASS_DATA_FFT256 0x80000000 // 256 sample FFT +#define BASS_DATA_FFT512 0x80000001 // 512 FFT +#define BASS_DATA_FFT1024 0x80000002 // 1024 FFT +#define BASS_DATA_FFT2048 0x80000003 // 2048 FFT +#define BASS_DATA_FFT4096 0x80000004 // 4096 FFT +#define BASS_DATA_FFT8192 0x80000005 // 8192 FFT +#define BASS_DATA_FFT16384 0x80000006 // 16384 FFT +#define BASS_DATA_FFT32768 0x80000007 // 32768 FFT +#define BASS_DATA_FFT_INDIVIDUAL \ + 0x10 // FFT flag: FFT for each channel, else all combined +#define BASS_DATA_FFT_NOWINDOW 0x20 // FFT flag: no Hanning window +#define BASS_DATA_FFT_REMOVEDC 0x40 // FFT flag: pre-remove DC bias +#define BASS_DATA_FFT_COMPLEX 0x80 // FFT flag: return complex data + +// BASS_ChannelGetLevelEx flags +#define BASS_LEVEL_MONO 1 +#define BASS_LEVEL_STEREO 2 +#define BASS_LEVEL_RMS 4 +#define BASS_LEVEL_VOLPAN 8 + +// BASS_ChannelGetTags types : what's returned +#define BASS_TAG_ID3 0 // ID3v1 tags : TAG_ID3 structure +#define BASS_TAG_ID3V2 1 // ID3v2 tags : variable length block +#define BASS_TAG_OGG 2 // OGG comments : series of null-terminated UTF-8 strings +#define BASS_TAG_HTTP 3 // HTTP headers : series of null-terminated ANSI strings +#define BASS_TAG_ICY 4 // ICY headers : series of null-terminated ANSI strings +#define BASS_TAG_META 5 // ICY metadata : ANSI string +#define BASS_TAG_APE 6 // APE tags : series of null-terminated UTF-8 strings +#define BASS_TAG_MP4 \ + 7 // MP4/iTunes metadata : series of null-terminated UTF-8 strings +#define BASS_TAG_WMA 8 // WMA tags : series of null-terminated UTF-8 strings +#define BASS_TAG_VENDOR 9 // OGG encoder : UTF-8 string +#define BASS_TAG_LYRICS3 10 // Lyric3v2 tag : ASCII string +#define BASS_TAG_CA_CODEC 11 // CoreAudio codec info : TAG_CA_CODEC structure +#define BASS_TAG_MF \ + 13 // Media Foundation tags : series of null-terminated UTF-8 strings +#define BASS_TAG_WAVEFORMAT 14 // WAVE format : WAVEFORMATEEX structure +#define BASS_TAG_AM_MIME 15 // Android Media MIME type : ASCII string +#define BASS_TAG_AM_NAME 16 // Android Media codec name : ASCII string +#define BASS_TAG_RIFF_INFO \ + 0x100 // RIFF "INFO" tags : series of null-terminated ANSI strings +#define BASS_TAG_RIFF_BEXT 0x101 // RIFF/BWF "bext" tags : TAG_BEXT structure +#define BASS_TAG_RIFF_CART 0x102 // RIFF/BWF "cart" tags : TAG_CART structure +#define BASS_TAG_RIFF_DISP 0x103 // RIFF "DISP" text tag : ANSI string +#define BASS_TAG_RIFF_CUE 0x104 // RIFF "cue " chunk : TAG_CUE structure +#define BASS_TAG_RIFF_SMPL 0x105 // RIFF "smpl" chunk : TAG_SMPL structure +#define BASS_TAG_APE_BINARY \ + 0x1000 // + index #, binary APE tag : TAG_APE_BINARY structure +#define BASS_TAG_MUSIC_NAME 0x10000 // MOD music name : ANSI string +#define BASS_TAG_MUSIC_MESSAGE 0x10001 // MOD message : ANSI string +#define BASS_TAG_MUSIC_ORDERS \ + 0x10002 // MOD order list : BYTE array of pattern numbers +#define BASS_TAG_MUSIC_AUTH 0x10003 // MOD author : UTF-8 string +#define BASS_TAG_MUSIC_INST \ + 0x10100 // + instrument #, MOD instrument name : ANSI string +#define BASS_TAG_MUSIC_SAMPLE \ + 0x10300 // + sample #, MOD sample name : ANSI string + +// ID3v1 tag structure +typedef struct { + char id[3]; + char title[30]; + char artist[30]; + char album[30]; + char year[4]; + char comment[30]; + BYTE genre; +} TAG_ID3; + +// Binary APE tag structure +typedef struct { + const char *key; + const void *data; + DWORD length; } TAG_APE_BINARY; // BWF "bext" tag structure -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable:4200) -#endif -#pragma pack(push,1) -typedef struct { - char Description[256]; // description - char Originator[32]; // name of the originator - char OriginatorReference[32]; // reference of the originator - char OriginationDate[10]; // date of creation (yyyy-mm-dd) - char OriginationTime[8]; // time of creation (hh-mm-ss) - QWORD TimeReference; // first sample count since midnight (little-endian) - WORD Version; // BWF version (little-endian) - BYTE UMID[64]; // SMPTE UMID - BYTE Reserved[190]; -#if defined(__GNUC__) && __GNUC__<3 - char CodingHistory[0]; // history -#elif 1 // change to 0 if compiler fails the following line - char CodingHistory[]; // history -#else - char CodingHistory[1]; // history -#endif -} TAG_BEXT; +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable : 4200) +#endif +#pragma pack(push, 1) +typedef struct { + char Description[256]; // description + char Originator[32]; // name of the originator + char OriginatorReference[32]; // reference of the originator + char OriginationDate[10]; // date of creation (yyyy-mm-dd) + char OriginationTime[8]; // time of creation (hh-mm-ss) + QWORD TimeReference; // first sample count since midnight (little-endian) + WORD Version; // BWF version (little-endian) + BYTE UMID[64]; // SMPTE UMID + BYTE Reserved[190]; +#if defined(__GNUC__) && __GNUC__ < 3 + char CodingHistory[0]; // history +#elif 1 // change to 0 if compiler fails the following line + char CodingHistory[]; // history +#else + char CodingHistory[1]; // history +#endif +} TAG_BEXT; #pragma pack(pop) // BWF "cart" tag structures -typedef struct -{ - DWORD dwUsage; // FOURCC timer usage ID - DWORD dwValue; // timer value in samples from head +typedef struct { + DWORD dwUsage; // FOURCC timer usage ID + DWORD dwValue; // timer value in samples from head } TAG_CART_TIMER; -typedef struct -{ - char Version[4]; // version of the data structure - char Title[64]; // title of cart audio sequence - char Artist[64]; // artist or creator name - char CutID[64]; // cut number identification - char ClientID[64]; // client identification - char Category[64]; // category ID, PSA, NEWS, etc - char Classification[64]; // classification or auxiliary key - char OutCue[64]; // out cue text - char StartDate[10]; // yyyy-mm-dd - char StartTime[8]; // hh:mm:ss - char EndDate[10]; // yyyy-mm-dd - char EndTime[8]; // hh:mm:ss - char ProducerAppID[64]; // name of vendor or application - char ProducerAppVersion[64]; // version of producer application - char UserDef[64]; // user defined text - DWORD dwLevelReference; // sample value for 0 dB reference - TAG_CART_TIMER PostTimer[8]; // 8 time markers after head - char Reserved[276]; - char URL[1024]; // uniform resource locator -#if defined(__GNUC__) && __GNUC__<3 - char TagText[0]; // free form text for scripts or tags -#elif 1 // change to 0 if compiler fails the following line - char TagText[]; // free form text for scripts or tags +typedef struct { + char Version[4]; // version of the data structure + char Title[64]; // title of cart audio sequence + char Artist[64]; // artist or creator name + char CutID[64]; // cut number identification + char ClientID[64]; // client identification + char Category[64]; // category ID, PSA, NEWS, etc + char Classification[64]; // classification or auxiliary key + char OutCue[64]; // out cue text + char StartDate[10]; // yyyy-mm-dd + char StartTime[8]; // hh:mm:ss + char EndDate[10]; // yyyy-mm-dd + char EndTime[8]; // hh:mm:ss + char ProducerAppID[64]; // name of vendor or application + char ProducerAppVersion[64]; // version of producer application + char UserDef[64]; // user defined text + DWORD dwLevelReference; // sample value for 0 dB reference + TAG_CART_TIMER PostTimer[8]; // 8 time markers after head + char Reserved[276]; + char URL[1024]; // uniform resource locator +#if defined(__GNUC__) && __GNUC__ < 3 + char TagText[0]; // free form text for scripts or tags +#elif 1 // change to 0 if compiler fails the following line + char TagText[]; // free form text for scripts or tags #else - char TagText[1]; // free form text for scripts or tags + char TagText[1]; // free form text for scripts or tags #endif } TAG_CART; // RIFF "cue " tag structures -typedef struct -{ - DWORD dwName; - DWORD dwPosition; - DWORD fccChunk; - DWORD dwChunkStart; - DWORD dwBlockStart; - DWORD dwSampleOffset; +typedef struct { + DWORD dwName; + DWORD dwPosition; + DWORD fccChunk; + DWORD dwChunkStart; + DWORD dwBlockStart; + DWORD dwSampleOffset; } TAG_CUE_POINT; -typedef struct -{ - DWORD dwCuePoints; -#if defined(__GNUC__) && __GNUC__<3 - TAG_CUE_POINT CuePoints[0]; +typedef struct { + DWORD dwCuePoints; +#if defined(__GNUC__) && __GNUC__ < 3 + TAG_CUE_POINT CuePoints[0]; #elif 1 // change to 0 if compiler fails the following line - TAG_CUE_POINT CuePoints[]; + TAG_CUE_POINT CuePoints[]; #else - TAG_CUE_POINT CuePoints[1]; + TAG_CUE_POINT CuePoints[1]; #endif } TAG_CUE; // RIFF "smpl" tag structures -typedef struct -{ - DWORD dwIdentifier; - DWORD dwType; - DWORD dwStart; - DWORD dwEnd; - DWORD dwFraction; - DWORD dwPlayCount; +typedef struct { + DWORD dwIdentifier; + DWORD dwType; + DWORD dwStart; + DWORD dwEnd; + DWORD dwFraction; + DWORD dwPlayCount; } TAG_SMPL_LOOP; -typedef struct -{ - DWORD dwManufacturer; - DWORD dwProduct; - DWORD dwSamplePeriod; - DWORD dwMIDIUnityNote; - DWORD dwMIDIPitchFraction; - DWORD dwSMPTEFormat; - DWORD dwSMPTEOffset; - DWORD cSampleLoops; - DWORD cbSamplerData; -#if defined(__GNUC__) && __GNUC__<3 - TAG_SMPL_LOOP SampleLoops[0]; +typedef struct { + DWORD dwManufacturer; + DWORD dwProduct; + DWORD dwSamplePeriod; + DWORD dwMIDIUnityNote; + DWORD dwMIDIPitchFraction; + DWORD dwSMPTEFormat; + DWORD dwSMPTEOffset; + DWORD cSampleLoops; + DWORD cbSamplerData; +#if defined(__GNUC__) && __GNUC__ < 3 + TAG_SMPL_LOOP SampleLoops[0]; #elif 1 // change to 0 if compiler fails the following line - TAG_SMPL_LOOP SampleLoops[]; + TAG_SMPL_LOOP SampleLoops[]; #else - TAG_SMPL_LOOP SampleLoops[1]; + TAG_SMPL_LOOP SampleLoops[1]; #endif } TAG_SMPL; #ifdef _MSC_VER #pragma warning(pop) #endif -// CoreAudio codec info structure -typedef struct { - DWORD ftype; // file format - DWORD atype; // audio format - const char *name; // description -} TAG_CA_CODEC; - +// CoreAudio codec info structure +typedef struct { + DWORD ftype; // file format + DWORD atype; // audio format + const char *name; // description +} TAG_CA_CODEC; + #ifndef _WAVEFORMATEX_ #define _WAVEFORMATEX_ -#pragma pack(push,1) -typedef struct tWAVEFORMATEX -{ - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; - WORD wBitsPerSample; - WORD cbSize; +#pragma pack(push, 1) +typedef struct tWAVEFORMATEX { + WORD wFormatTag; + WORD nChannels; + DWORD nSamplesPerSec; + DWORD nAvgBytesPerSec; + WORD nBlockAlign; + WORD wBitsPerSample; + WORD cbSize; } WAVEFORMATEX, *PWAVEFORMATEX, *LPWAVEFORMATEX; typedef const WAVEFORMATEX *LPCWAVEFORMATEX; #pragma pack(pop) #endif -// BASS_ChannelGetLength/GetPosition/SetPosition modes -#define BASS_POS_BYTE 0 // byte position -#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row) -#define BASS_POS_OGG 3 // OGG bitstream number -#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers -#define BASS_POS_RELATIVE 0x4000000 // flag: seek relative to the current position -#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position -#define BASS_POS_DECODE 0x10000000 // flag: get the decoding (not playing) position -#define BASS_POS_DECODETO 0x20000000 // flag: decode to the position instead of seeking -#define BASS_POS_SCAN 0x40000000 // flag: scan to the position - -// BASS_ChannelSetDevice/GetDevice option -#define BASS_NODEVICE 0x20000 - -// BASS_RecordSetInput flags -#define BASS_INPUT_OFF 0x10000 -#define BASS_INPUT_ON 0x20000 - -#define BASS_INPUT_TYPE_MASK 0xff000000 -#define BASS_INPUT_TYPE_UNDEF 0x00000000 -#define BASS_INPUT_TYPE_DIGITAL 0x01000000 -#define BASS_INPUT_TYPE_LINE 0x02000000 -#define BASS_INPUT_TYPE_MIC 0x03000000 -#define BASS_INPUT_TYPE_SYNTH 0x04000000 -#define BASS_INPUT_TYPE_CD 0x05000000 -#define BASS_INPUT_TYPE_PHONE 0x06000000 -#define BASS_INPUT_TYPE_SPEAKER 0x07000000 -#define BASS_INPUT_TYPE_WAVE 0x08000000 -#define BASS_INPUT_TYPE_AUX 0x09000000 -#define BASS_INPUT_TYPE_ANALOG 0x0a000000 - -// BASS_ChannelSetFX effect types -#define BASS_FX_DX8_CHORUS 0 -#define BASS_FX_DX8_COMPRESSOR 1 -#define BASS_FX_DX8_DISTORTION 2 -#define BASS_FX_DX8_ECHO 3 -#define BASS_FX_DX8_FLANGER 4 -#define BASS_FX_DX8_GARGLE 5 -#define BASS_FX_DX8_I3DL2REVERB 6 -#define BASS_FX_DX8_PARAMEQ 7 -#define BASS_FX_DX8_REVERB 8 -#define BASS_FX_VOLUME 9 - -typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx -} BASS_DX8_CHORUS; - -typedef struct { - float fGain; - float fAttack; - float fRelease; - float fThreshold; - float fRatio; - float fPredelay; -} BASS_DX8_COMPRESSOR; - -typedef struct { - float fGain; - float fEdge; - float fPostEQCenterFrequency; - float fPostEQBandwidth; - float fPreLowpassCutoff; -} BASS_DX8_DISTORTION; - -typedef struct { - float fWetDryMix; - float fFeedback; - float fLeftDelay; - float fRightDelay; - BOOL lPanDelay; -} BASS_DX8_ECHO; - -typedef struct { - float fWetDryMix; - float fDepth; - float fFeedback; - float fFrequency; - DWORD lWaveform; // 0=triangle, 1=sine - float fDelay; - DWORD lPhase; // BASS_DX8_PHASE_xxx -} BASS_DX8_FLANGER; - -typedef struct { - DWORD dwRateHz; // Rate of modulation in hz - DWORD dwWaveShape; // 0=triangle, 1=square -} BASS_DX8_GARGLE; - -typedef struct { - int lRoom; // [-10000, 0] default: -1000 mB - int lRoomHF; // [-10000, 0] default: 0 mB - float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 - float flDecayTime; // [0.1, 20.0] default: 1.49s - float flDecayHFRatio; // [0.1, 2.0] default: 0.83 - int lReflections; // [-10000, 1000] default: -2602 mB - float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s - int lReverb; // [-10000, 2000] default: 200 mB - float flReverbDelay; // [0.0, 0.1] default: 0.011 s - float flDiffusion; // [0.0, 100.0] default: 100.0 % - float flDensity; // [0.0, 100.0] default: 100.0 % - float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz -} BASS_DX8_I3DL2REVERB; - -typedef struct { - float fCenter; - float fBandwidth; - float fGain; -} BASS_DX8_PARAMEQ; - -typedef struct { - float fInGain; // [-96.0,0.0] default: 0.0 dB - float fReverbMix; // [-96.0,0.0] default: 0.0 db - float fReverbTime; // [0.001,3000.0] default: 1000.0 ms - float fHighFreqRTRatio; // [0.001,0.999] default: 0.001 -} BASS_DX8_REVERB; - -#define BASS_DX8_PHASE_NEG_180 0 -#define BASS_DX8_PHASE_NEG_90 1 -#define BASS_DX8_PHASE_ZERO 2 -#define BASS_DX8_PHASE_90 3 -#define BASS_DX8_PHASE_180 4 +// BASS_ChannelGetLength/GetPosition/SetPosition modes +#define BASS_POS_BYTE 0 // byte position +#define BASS_POS_MUSIC_ORDER 1 // order.row position, MAKELONG(order,row) +#define BASS_POS_OGG 3 // OGG bitstream number +#define BASS_POS_RESET 0x2000000 // flag: reset user file buffers +#define BASS_POS_RELATIVE \ + 0x4000000 // flag: seek relative to the current position +#define BASS_POS_INEXACT 0x8000000 // flag: allow seeking to inexact position +#define BASS_POS_DECODE \ + 0x10000000 // flag: get the decoding (not playing) position +#define BASS_POS_DECODETO \ + 0x20000000 // flag: decode to the position instead of seeking +#define BASS_POS_SCAN 0x40000000 // flag: scan to the position -typedef struct { - float fTarget; - float fCurrent; - float fTime; - DWORD lCurve; -} BASS_FX_VOLUME_PARAM; +// BASS_ChannelSetDevice/GetDevice option +#define BASS_NODEVICE 0x20000 -typedef void (CALLBACK IOSNOTIFYPROC)(DWORD status); +// BASS_RecordSetInput flags +#define BASS_INPUT_OFF 0x10000 +#define BASS_INPUT_ON 0x20000 + +#define BASS_INPUT_TYPE_MASK 0xff000000 +#define BASS_INPUT_TYPE_UNDEF 0x00000000 +#define BASS_INPUT_TYPE_DIGITAL 0x01000000 +#define BASS_INPUT_TYPE_LINE 0x02000000 +#define BASS_INPUT_TYPE_MIC 0x03000000 +#define BASS_INPUT_TYPE_SYNTH 0x04000000 +#define BASS_INPUT_TYPE_CD 0x05000000 +#define BASS_INPUT_TYPE_PHONE 0x06000000 +#define BASS_INPUT_TYPE_SPEAKER 0x07000000 +#define BASS_INPUT_TYPE_WAVE 0x08000000 +#define BASS_INPUT_TYPE_AUX 0x09000000 +#define BASS_INPUT_TYPE_ANALOG 0x0a000000 + +// BASS_ChannelSetFX effect types +#define BASS_FX_DX8_CHORUS 0 +#define BASS_FX_DX8_COMPRESSOR 1 +#define BASS_FX_DX8_DISTORTION 2 +#define BASS_FX_DX8_ECHO 3 +#define BASS_FX_DX8_FLANGER 4 +#define BASS_FX_DX8_GARGLE 5 +#define BASS_FX_DX8_I3DL2REVERB 6 +#define BASS_FX_DX8_PARAMEQ 7 +#define BASS_FX_DX8_REVERB 8 +#define BASS_FX_VOLUME 9 + +typedef struct { + float fWetDryMix; + float fDepth; + float fFeedback; + float fFrequency; + DWORD lWaveform; // 0=triangle, 1=sine + float fDelay; + DWORD lPhase; // BASS_DX8_PHASE_xxx +} BASS_DX8_CHORUS; + +typedef struct { + float fGain; + float fAttack; + float fRelease; + float fThreshold; + float fRatio; + float fPredelay; +} BASS_DX8_COMPRESSOR; + +typedef struct { + float fGain; + float fEdge; + float fPostEQCenterFrequency; + float fPostEQBandwidth; + float fPreLowpassCutoff; +} BASS_DX8_DISTORTION; + +typedef struct { + float fWetDryMix; + float fFeedback; + float fLeftDelay; + float fRightDelay; + BOOL lPanDelay; +} BASS_DX8_ECHO; + +typedef struct { + float fWetDryMix; + float fDepth; + float fFeedback; + float fFrequency; + DWORD lWaveform; // 0=triangle, 1=sine + float fDelay; + DWORD lPhase; // BASS_DX8_PHASE_xxx +} BASS_DX8_FLANGER; + +typedef struct { + DWORD dwRateHz; // Rate of modulation in hz + DWORD dwWaveShape; // 0=triangle, 1=square +} BASS_DX8_GARGLE; + +typedef struct { + int lRoom; // [-10000, 0] default: -1000 mB + int lRoomHF; // [-10000, 0] default: 0 mB + float flRoomRolloffFactor; // [0.0, 10.0] default: 0.0 + float flDecayTime; // [0.1, 20.0] default: 1.49s + float flDecayHFRatio; // [0.1, 2.0] default: 0.83 + int lReflections; // [-10000, 1000] default: -2602 mB + float flReflectionsDelay; // [0.0, 0.3] default: 0.007 s + int lReverb; // [-10000, 2000] default: 200 mB + float flReverbDelay; // [0.0, 0.1] default: 0.011 s + float flDiffusion; // [0.0, 100.0] default: 100.0 % + float flDensity; // [0.0, 100.0] default: 100.0 % + float flHFReference; // [20.0, 20000.0] default: 5000.0 Hz +} BASS_DX8_I3DL2REVERB; + +typedef struct { + float fCenter; + float fBandwidth; + float fGain; +} BASS_DX8_PARAMEQ; + +typedef struct { + float fInGain; // [-96.0,0.0] default: 0.0 dB + float fReverbMix; // [-96.0,0.0] default: 0.0 db + float fReverbTime; // [0.001,3000.0] default: 1000.0 ms + float fHighFreqRTRatio; // [0.001,0.999] default: 0.001 +} BASS_DX8_REVERB; + +#define BASS_DX8_PHASE_NEG_180 0 +#define BASS_DX8_PHASE_NEG_90 1 +#define BASS_DX8_PHASE_ZERO 2 +#define BASS_DX8_PHASE_90 3 +#define BASS_DX8_PHASE_180 4 + +typedef struct { + float fTarget; + float fCurrent; + float fTime; + DWORD lCurve; +} BASS_FX_VOLUME_PARAM; + +typedef void(CALLBACK IOSNOTIFYPROC)(DWORD status); /* iOS notification callback function. status : The notification (BASS_IOSNOTIFY_xxx) */ -#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started -#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended - -BOOL BASSDEF(BASS_SetConfig)(DWORD option, DWORD value); -DWORD BASSDEF(BASS_GetConfig)(DWORD option); -BOOL BASSDEF(BASS_SetConfigPtr)(DWORD option, const void *value); -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); -#else -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) -void *BASSDEF(BASS_GetDSoundObject)(DWORD object); -#endif -BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info); -BOOL BASSDEF(BASS_Update)(DWORD length); -float BASSDEF(BASS_GetCPU)(); -BOOL BASSDEF(BASS_Start)(); -BOOL BASSDEF(BASS_Stop)(); -BOOL BASSDEF(BASS_Pause)(); -BOOL BASSDEF(BASS_SetVolume)(float volume); -float BASSDEF(BASS_GetVolume)(); - -HPLUGIN BASSDEF(BASS_PluginLoad)(const char *file, DWORD flags); -BOOL BASSDEF(BASS_PluginFree)(HPLUGIN handle); -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); -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); -#endif - -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); -BOOL BASSDEF(BASS_SampleFree)(HSAMPLE handle); -BOOL BASSDEF(BASS_SampleSetData)(HSAMPLE handle, const void *buffer); -BOOL BASSDEF(BASS_SampleGetData)(HSAMPLE handle, void *buffer); -BOOL BASSDEF(BASS_SampleGetInfo)(HSAMPLE handle, BASS_SAMPLE *info); -BOOL BASSDEF(BASS_SampleSetInfo)(HSAMPLE handle, const BASS_SAMPLE *info); -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); -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); - -BOOL BASSDEF(BASS_RecordGetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); -BOOL BASSDEF(BASS_RecordInit)(int device); -BOOL BASSDEF(BASS_RecordSetDevice)(DWORD device); -DWORD BASSDEF(BASS_RecordGetDevice)(); -BOOL BASSDEF(BASS_RecordFree)(); -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); - -double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos); -QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, double pos); -DWORD BASSDEF(BASS_ChannelGetDevice)(DWORD handle); -BOOL BASSDEF(BASS_ChannelSetDevice)(DWORD handle, DWORD device); -DWORD BASSDEF(BASS_ChannelIsActive)(DWORD handle); -BOOL BASSDEF(BASS_ChannelGetInfo)(DWORD handle, BASS_CHANNELINFO *info); -const char *BASSDEF(BASS_ChannelGetTags)(DWORD handle, DWORD tags); -DWORD BASSDEF(BASS_ChannelFlags)(DWORD handle, DWORD flags, DWORD mask); -BOOL BASSDEF(BASS_ChannelUpdate)(DWORD handle, DWORD length); -BOOL BASSDEF(BASS_ChannelLock)(DWORD handle, BOOL lock); -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_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); -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); -DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length); -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); -BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp); -BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan); -BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan); -HFX BASSDEF(BASS_ChannelSetFX)(DWORD handle, DWORD type, int priority); -BOOL BASSDEF(BASS_ChannelRemoveFX)(DWORD handle, HFX fx); - -BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, const void *params); -BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *params); -BOOL BASSDEF(BASS_FXReset)(HFX handle); -BOOL BASSDEF(BASS_FXSetPriority)(HFX handle, int priority); +#define BASS_IOSNOTIFY_INTERRUPT 1 // interruption started +#define BASS_IOSNOTIFY_INTERRUPT_END 2 // interruption ended -#ifdef __cplusplus -} +BOOL BASSDEF(BASS_SetConfig)(DWORD option, DWORD value); +DWORD BASSDEF(BASS_GetConfig)(DWORD option); +BOOL BASSDEF(BASS_SetConfigPtr)(DWORD option, const void *value); +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); +#else +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) +void *BASSDEF(BASS_GetDSoundObject)(DWORD object); +#endif +BOOL BASSDEF(BASS_GetInfo)(BASS_INFO *info); +BOOL BASSDEF(BASS_Update)(DWORD length); +float BASSDEF(BASS_GetCPU)(); +BOOL BASSDEF(BASS_Start)(); +BOOL BASSDEF(BASS_Stop)(); +BOOL BASSDEF(BASS_Pause)(); +BOOL BASSDEF(BASS_SetVolume)(float volume); +float BASSDEF(BASS_GetVolume)(); + +HPLUGIN BASSDEF(BASS_PluginLoad)(const char *file, DWORD flags); +BOOL BASSDEF(BASS_PluginFree)(HPLUGIN handle); +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); +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); +#endif + +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); +BOOL BASSDEF(BASS_SampleFree)(HSAMPLE handle); +BOOL BASSDEF(BASS_SampleSetData)(HSAMPLE handle, const void *buffer); +BOOL BASSDEF(BASS_SampleGetData)(HSAMPLE handle, void *buffer); +BOOL BASSDEF(BASS_SampleGetInfo)(HSAMPLE handle, BASS_SAMPLE *info); +BOOL BASSDEF(BASS_SampleSetInfo)(HSAMPLE handle, const BASS_SAMPLE *info); +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); +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); + +BOOL BASSDEF(BASS_RecordGetDeviceInfo)(DWORD device, BASS_DEVICEINFO *info); +BOOL BASSDEF(BASS_RecordInit)(int device); +BOOL BASSDEF(BASS_RecordSetDevice)(DWORD device); +DWORD BASSDEF(BASS_RecordGetDevice)(); +BOOL BASSDEF(BASS_RecordFree)(); +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); + +double BASSDEF(BASS_ChannelBytes2Seconds)(DWORD handle, QWORD pos); +QWORD BASSDEF(BASS_ChannelSeconds2Bytes)(DWORD handle, double pos); +DWORD BASSDEF(BASS_ChannelGetDevice)(DWORD handle); +BOOL BASSDEF(BASS_ChannelSetDevice)(DWORD handle, DWORD device); +DWORD BASSDEF(BASS_ChannelIsActive)(DWORD handle); +BOOL BASSDEF(BASS_ChannelGetInfo)(DWORD handle, BASS_CHANNELINFO *info); +const char *BASSDEF(BASS_ChannelGetTags)(DWORD handle, DWORD tags); +DWORD BASSDEF(BASS_ChannelFlags)(DWORD handle, DWORD flags, DWORD mask); +BOOL BASSDEF(BASS_ChannelUpdate)(DWORD handle, DWORD length); +BOOL BASSDEF(BASS_ChannelLock)(DWORD handle, BOOL lock); +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_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); +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); +DWORD BASSDEF(BASS_ChannelGetData)(DWORD handle, void *buffer, DWORD length); +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); +BOOL BASSDEF(BASS_ChannelRemoveDSP)(DWORD handle, HDSP dsp); +BOOL BASSDEF(BASS_ChannelSetLink)(DWORD handle, DWORD chan); +BOOL BASSDEF(BASS_ChannelRemoveLink)(DWORD handle, DWORD chan); +HFX BASSDEF(BASS_ChannelSetFX)(DWORD handle, DWORD type, int priority); +BOOL BASSDEF(BASS_ChannelRemoveFX)(DWORD handle, HFX fx); + +BOOL BASSDEF(BASS_FXSetParameters)(HFX handle, const void *params); +BOOL BASSDEF(BASS_FXGetParameters)(HFX handle, void *params); +BOOL BASSDEF(BASS_FXReset)(HFX handle); +BOOL BASSDEF(BASS_FXSetPriority)(HFX handle, int priority); + +#ifdef __cplusplus +} #if defined(_WIN32) && !defined(NOBASSOVERLOADS) static inline HPLUGIN BASS_PluginLoad(const WCHAR *file, DWORD flags) { - return BASS_PluginLoad((const char*)file, flags|BASS_UNICODE); + 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) { - return BASS_SetConfigPtr(option|BASS_UNICODE, (const void*)value); + return BASS_SetConfigPtr(option | BASS_UNICODE, (const void *)value); } #endif -#endif - -#endif +#endif + +#endif diff --git a/include/chatlogpiece.h b/include/chatlogpiece.h index 945a7bc..0232666 100644 --- a/include/chatlogpiece.h +++ b/include/chatlogpiece.h @@ -1,11 +1,10 @@ #ifndef CHATLOGPIECE_H #define CHATLOGPIECE_H -#include #include +#include -class chatlogpiece -{ +class chatlogpiece { public: chatlogpiece(); chatlogpiece(QString p_name, QString p_showname, QString p_message, diff --git a/include/courtroom.h b/include/courtroom.h index 26380aa..674a0cb 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -1,738 +1,738 @@ -#ifndef COURTROOM_H -#define COURTROOM_H - -#include "aoimage.h" -#include "aobutton.h" -#include "aocharbutton.h" -#include "aoemotebutton.h" -#include "aopacket.h" -#include "aoscene.h" -#include "aomovie.h" -#include "aocharmovie.h" -#include "aomusicplayer.h" -#include "aooptionsdialog.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 "datatypes.h" -#include "debug_functions.h" -#include "chatlogpiece.h" -#include "aocharmovie.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -class AOApplication; -class AOCharMovie; -class Courtroom : public QMainWindow -{ - Q_OBJECT -public: - explicit Courtroom(AOApplication *p_ao_app); - - void append_char(char_type p_char){char_list.append(p_char);} - void append_evidence(evi_type p_evi){evidence_list.append(p_evi);} - void append_music(QString f_music){music_list.append(f_music);} - void append_area(QString f_area){area_list.append(f_area);} - void clear_music(){music_list.clear();} - void clear_areas(){area_list.clear();} - void handle_failed_login(); - QString threading_sfx = ""; - QString threading_shake = ""; - QString threading_flash = ""; - QString threading_prefix = ""; - //cid and this may differ in cases of ini-editing - QString current_char = ""; - int current_emote = 0; - AOApplication *ao_app; - //abstract widget to hold char buttons - QWidget *ui_char_buttons; - QVector char_list; - QVector evidence_list; - QVector music_list; - QVector area_list; - QSignalMapper *char_button_mapper; - QVector ui_char_button_list; - QVector ui_char_button_list_filtered; - QLineEdit *ui_char_search; - QCheckBox *ui_char_passworded; - QCheckBox *ui_char_taken; - void mt_pre_framegetter(int frameNumber); - void mt_framegetter(int frameNumber); - void reset_music_list() - { - music_list.clear(); - } - - void arup_append(int players, QString status, QString cm, QString locked) - { - arup_players.append(players); - arup_statuses.append(status); - arup_cms.append(cm); - arup_locks.append(locked); - } - - void arup_modify(int type, int place, QString value) - { - if (type == 0) - { - if (arup_players.size() > place) - arup_players[place] = value.toInt(); - } - else if (type == 1) - { - if (arup_statuses.size() > place) - arup_statuses[place] = value; - } - else if (type == 2) - { - if (arup_cms.size() > place) - arup_cms[place] = value; - } - else if (type == 3) - { - if (arup_locks.size() > place) - arup_locks[place] = value; - } - list_areas(); - } - - void character_loading_finished(); - - //sets position of widgets based on theme ini files - void set_widgets(); - //sets font size based on theme ini files - void set_font(QWidget *widget, QString p_identifier); - //helper function that calls above function on the relevant widgets - void set_fonts(); - - void set_window_title(QString p_title); - - //reads theme inis and sets size and pos based on the identifier - void set_size_and_pos(QWidget *p_widget, QString p_identifier); - QPoint get_theme_pos(QString p_identifier); - //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 - void set_background(QString p_background); - - //sets the evidence list member variable to argument - void set_evidence_list(QVector &p_evi_list); - - //called when a DONE#% from the server was received - void done_received(); - - //sets the local mute list based on characters available on the server - void set_mute_list(); - - // Sets the local pair list based on the characters available on the server. - void set_pair_list(); - - //sets desk and bg based on pos in chatmessage - void set_scene(); - - //sets text color based on text color in chatmessage - void set_text_color(); - - // And gets the colour, too! - QColor get_text_color(QString color); - - //takes in serverD-formatted IP list as prints a converted version to server OOC - //admittedly poorly named - void set_ip_list(QString p_list); - - //disables chat if current cid matches second argument - //enables if p_muted is false - void set_mute(bool p_muted, int p_cid); - - //send a message that the player is banned and quits the server - void set_ban(int p_cid); - - //cid = character id, returns the cid of the currently selected character - int get_cid() {return m_cid;} - QString get_current_char() {return current_char;} - QString get_current_background() {return current_background;} - - //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 - 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); - - //check whether or not current theme has images for buttons with fallback text - void detect_fallback_text(); - - //these functions handle chatmessages sequentially. - //The process itself is very convoluted and merits separate documentation - //But the general idea is objection animation->pre animation->talking->idle - void handle_chatmessage(QStringList *p_contents); - void handle_chatmessage_2(); - void handle_chatmessage_3(); - - //This function filters out the common CC inline text trickery, for appending to - //the IC chatlog. - 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 - // 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, - bool skip_filter = false, int chat_color = 0); - +#ifndef COURTROOM_H +#define COURTROOM_H + +#include "aoapplication.h" +#include "aoblipplayer.h" +#include "aobutton.h" +#include "aocharbutton.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 "aotextarea.h" +#include "aotextedit.h" +#include "chatlogpiece.h" +#include "datatypes.h" +#include "debug_functions.h" +#include "file_functions.h" +#include "hardware_functions.h" +#include "lobby.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +class AOApplication; +class AOCharMovie; +class Courtroom : public QMainWindow { + Q_OBJECT +public: + explicit Courtroom(AOApplication *p_ao_app); + + void append_char(char_type p_char) { char_list.append(p_char); } + void append_evidence(evi_type p_evi) { evidence_list.append(p_evi); } + void append_music(QString f_music) { music_list.append(f_music); } + void append_area(QString f_area) { area_list.append(f_area); } + void clear_music() { music_list.clear(); } + void clear_areas() { area_list.clear(); } + void handle_failed_login(); + QString threading_sfx = ""; + QString threading_shake = ""; + QString threading_flash = ""; + QString threading_prefix = ""; + // cid and this may differ in cases of ini-editing + QString current_char = ""; + int current_emote = 0; + AOApplication *ao_app; + // abstract widget to hold char buttons + QWidget *ui_char_buttons; + QVector char_list; + QVector evidence_list; + QVector music_list; + QVector area_list; + QSignalMapper *char_button_mapper; + QVector ui_char_button_list; + QVector ui_char_button_list_filtered; + QLineEdit *ui_char_search; + QCheckBox *ui_char_passworded; + QCheckBox *ui_char_taken; + void mt_pre_framegetter(int frameNumber); + void mt_framegetter(int frameNumber); + void reset_music_list() { music_list.clear(); } + + void arup_append(int players, QString status, QString cm, QString locked) + { + arup_players.append(players); + arup_statuses.append(status); + arup_cms.append(cm); + arup_locks.append(locked); + } + + void arup_modify(int type, int place, QString value) + { + if (type == 0) { + if (arup_players.size() > place) + arup_players[place] = value.toInt(); + } + else if (type == 1) { + if (arup_statuses.size() > place) + arup_statuses[place] = value; + } + else if (type == 2) { + if (arup_cms.size() > place) + arup_cms[place] = value; + } + else if (type == 3) { + if (arup_locks.size() > place) + arup_locks[place] = value; + } + list_areas(); + } + + void character_loading_finished(); + + // sets position of widgets based on theme ini files + void set_widgets(); + // sets font size based on theme ini files + void set_font(QWidget *widget, QString p_identifier); + // helper function that calls above function on the relevant widgets + 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); + // 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 + void set_background(QString p_background); + + // sets the evidence list member variable to argument + void set_evidence_list(QVector &p_evi_list); + + // called when a DONE#% from the server was received + void done_received(); + + // sets the local mute list based on characters available on the server + void set_mute_list(); + + // Sets the local pair list based on the characters available on the server. + void set_pair_list(); + + // sets desk and bg based on pos in chatmessage + void set_scene(); + + // sets text color based on text color in chatmessage + void set_text_color(); + + // And gets the colour, too! + QColor get_text_color(QString color); + + // takes in serverD-formatted IP list as prints a converted version to server + // OOC admittedly poorly named + void set_ip_list(QString p_list); + + // disables chat if current cid matches second argument + // enables if p_muted is false + void set_mute(bool p_muted, int p_cid); + + // send a message that the player is banned and quits the server + void set_ban(int p_cid); + + // cid = character id, returns the cid of the currently selected character + int get_cid() { return m_cid; } + QString get_current_char() { return current_char; } + QString get_current_background() { return current_background; } + + // set the character using an ID + void set_character(int char_id); + + // 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); + + // check whether or not current theme has images for buttons with fallback + // text + void detect_fallback_text(); + + // these functions handle chatmessages sequentially. + // The process itself is very convoluted and merits separate documentation + // But the general idea is objection animation->pre animation->talking->idle + void handle_chatmessage(QStringList *p_contents); + void handle_chatmessage_2(); + void handle_chatmessage_3(); + + // This function filters out the common CC inline text trickery, for appending + // to the IC chatlog. + 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 + // 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, + bool skip_filter = false, int chat_color = 0); + // prints who played the song to IC chat and plays said song(if found on local // filesystem) takes in a list where the first element is the song name and // the second is the char id of who played it - void handle_song(QStringList *p_contents); - - void play_preanim(bool noninterrupting); - - //plays the witness testimony or cross examination animation based on argument - void handle_wtce(QString p_wtce, int variant); - - //sets the hp bar of defense(p_bar 1) or pro(p_bar 2) - //state is an number between 0 and 10 inclusive - void set_hp_bar(int p_bar, int p_state); - - //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 refresh_iclog(bool skiplast); - - ~Courtroom(); - -private: - - int m_courtroom_width = 714; - int m_courtroom_height = 668; - - int m_viewport_x = 0; - int m_viewport_y = 0; - - int m_viewport_width = 256; - int m_viewport_height = 192; - - bool first_message_sent = false; - int maximumMessages = 0; - QPropertyAnimation *screenshake_animation; - QPropertyAnimation *chatbox_screenshake_animation; - QParallelAnimationGroup *screenshake_group; - QMovie *frame_emote_checker; - // This is for inline message-colouring. - - enum INLINE_COLOURS { - INLINE_BLUE, - INLINE_GREEN, - INLINE_ORANGE, - INLINE_GREY - }; - - // A stack of inline colours. - std::stack inline_colour_stack; - - bool next_character_is_not_special = false; // If true, write the - // next character as it is. - - bool message_is_centered = false; - - int current_display_speed = 3; - int message_display_speed[7] = {10, 20, 30, 40, 50, 60, 75}; - - // This is for checking if the character should start talking again - // when an inline blue text ends. - bool entire_message_is_blue = false; - - // And this is the inline 'talking checker'. Counts how 'deep' we are - // in inline blues. - int inline_blue_depth = 0; - - // The character ID of the character this user wants to appear alongside with. - int other_charid = -1; - - // The offset this user has given if they want to appear alongside someone. - int offset_with_pair = 0; - - QVector arup_players; - QVector arup_statuses; - QVector arup_cms; - QVector arup_locks; - - QVector ic_chatlog_history; - - // These map music row items and area row items to their actual IDs. - QVector music_row_to_number; - QVector area_row_to_number; - - //triggers ping_server() every 60 seconds - QTimer *keepalive_timer; - - //determines how fast messages tick onto screen - QTimer *chat_tick_timer; - //int chat_tick_interval = 60; - //which tick position(character in chat message) we are at - int tick_pos = 0; - //used to determine how often blips sound - int blip_pos = 0; - int blip_rate = 1; - int rainbow_counter = 0; - bool rainbow_appended = false; - bool blank_blip = false; - - // The cursor to write with in mirror mode - QTextCursor *mirror_cursor; - // Used for getting the current maximum blocks allowed in the IC chatlog. - int log_maximum_blocks = 0; - - // True, if the log should go downwards. - bool log_goes_downwards = false; - - //delay before chat messages starts ticking - QTimer *text_delay_timer; - - //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) - QTimer *realization_timer; - - //every time point in char.inis times this equals the final time - const int time_mod = 40; - - // the amount of time non-animated objection/hold it/takethat images stay - // onscreen for in ms - const int shout_stay_time = 724; - - // the amount of time non-animated guilty/not guilty images stay onscreen for - // in ms - const int verdict_stay_time = 3000; - - // the amount of time non-animated witness testimony/cross-examination images - // stay onscreen for in ms - const int wtce_stay_time = 1500; - - static const int chatmessage_size = 28; - QString m_chatmessage[chatmessage_size]; - bool chatmessage_is_empty = false; - - QString previous_ic_message = ""; - - //char id, muted or not - QMap mute_map; - - //QVector muted_cids; - - bool is_muted = false; - - //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 - int text_state = 2; - - // characters we consider punctuation - const QString punctuation_chars = ".,?!:;"; - - // amount by which we multiply the delay when we parse punctuation chars - int punctuation_modifier = 2; - - // character id, which index of the char_list the player is - int m_cid = -1; - // cid and this may differ in cases of ini-editing - - QString char_name = ""; - - int objection_state = 0; - bool keep_custom_objection = false; - QString objection_custom = ""; - int realization_state = 0; - int screenshake_state = 0; - int text_color = 0; - bool is_presenting_evidence = false; - - int defense_bar_state = 0; - int prosecution_bar_state = 0; - - int current_char_page = 0; - int char_columns = 10; - int char_rows = 9; - int max_chars_on_page = 90; - - const int button_width = 60; - const int button_height = 60; - - int current_emote_page = 0; - int emote_columns = 5; - int emote_rows = 2; - int max_emotes_on_page = 10; - - QVector local_evidence_list; - - int current_evidence_page = 0; - int current_evidence = 0; - int evidence_columns = 6; - 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 - bool is_ao2_bg = false; - - // whether or not to use text for buttons instead of images, true is text - bool change_char_fallback = true; - bool reload_theme_fallback = true; - bool settings_fallback = true; - bool call_mod_fallback = true; - bool casing_fallback = true; - bool amswap_fallback = true; - bool ooc_toggle_fallback = true; - - //whether the ooc chat is server or master chat, true is server - bool server_ooc = true; - - // Is AFK enabled - bool isafk = false; - QString current_background = "default"; - - AOMusicPlayer *music_player; - AOSfxPlayer *sfx_player; - AOSfxPlayer *misc_sfx_player; - AOSfxPlayer *frame_emote_sfx_player; - AOSfxPlayer *pair_frame_emote_sfx_player; - AOSfxPlayer *objection_player; - AOBlipPlayer *blip_player; - - AOSfxPlayer *modcall_player; - - AOImage *ui_background; - - QWidget *ui_viewport; - AOScene *ui_vp_background; - AOMovie *ui_vp_speedlines; - AOCharMovie *ui_vp_player_char; - AOCharMovie *ui_vp_sideplayer_char; - AOScene *ui_vp_desk; - AOScene *ui_vp_legacy_desk; - AOEvidenceDisplay *ui_vp_evidence_display; - AOImage *ui_vp_chatbox; - QLabel *ui_vp_showname; - QTextEdit *ui_vp_message; - AOMovie *ui_vp_realization; - AOMovie *ui_vp_testimony; - AOMovie *ui_vp_wtce; - AOMovie *ui_vp_objection; + void handle_song(QStringList *p_contents); + + void play_preanim(bool noninterrupting); + + // plays the witness testimony or cross examination animation based on + // argument + void handle_wtce(QString p_wtce, int variant); + + // sets the hp bar of defense(p_bar 1) or pro(p_bar 2) + // state is an number between 0 and 10 inclusive + void set_hp_bar(int p_bar, int p_state); + + // Toggles the judge buttons, whether they should appear or not. + void toggle_judge_buttons(bool is_on); + 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; + + int m_viewport_x = 0; + int m_viewport_y = 0; + + int m_viewport_width = 256; + int m_viewport_height = 192; + + bool first_message_sent = false; + int maximumMessages = 0; + QPropertyAnimation *screenshake_animation; + QPropertyAnimation *chatbox_screenshake_animation; + QParallelAnimationGroup *screenshake_group; + QMovie *frame_emote_checker; + // This is for inline message-colouring. + + enum INLINE_COLOURS { INLINE_BLUE, INLINE_GREEN, INLINE_ORANGE, INLINE_GREY }; + + // A stack of inline colours. + std::stack inline_colour_stack; + + bool next_character_is_not_special = false; // If true, write the + // next character as it is. + + bool message_is_centered = false; + + int current_display_speed = 3; + int message_display_speed[7] = {10, 20, 30, 40, 50, 60, 75}; + + // This is for checking if the character should start talking again + // when an inline blue text ends. + bool entire_message_is_blue = false; + + // And this is the inline 'talking checker'. Counts how 'deep' we are + // in inline blues. + int inline_blue_depth = 0; + + // The character ID of the character this user wants to appear alongside with. + int other_charid = -1; + + // The offset this user has given if they want to appear alongside someone. + int offset_with_pair = 0; + + QVector arup_players; + QVector arup_statuses; + QVector arup_cms; + QVector arup_locks; + + QVector ic_chatlog_history; + + // These map music row items and area row items to their actual IDs. + QVector music_row_to_number; + QVector area_row_to_number; + + // triggers ping_server() every 60 seconds + QTimer *keepalive_timer; + + // determines how fast messages tick onto screen + QTimer *chat_tick_timer; + // int chat_tick_interval = 60; + // which tick position(character in chat message) we are at + int tick_pos = 0; + // used to determine how often blips sound + int blip_pos = 0; + int blip_rate = 1; + int rainbow_counter = 0; + bool rainbow_appended = false; + bool blank_blip = false; + + // The cursor to write with in mirror mode + QTextCursor *mirror_cursor; + // Used for getting the current maximum blocks allowed in the IC chatlog. + int log_maximum_blocks = 0; + + // True, if the log should go downwards. + bool log_goes_downwards = false; + + // delay before chat messages starts ticking + QTimer *text_delay_timer; + + // 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) + QTimer *realization_timer; + + // every time point in char.inis times this equals the final time + const int time_mod = 40; + + // the amount of time non-animated objection/hold it/takethat images stay + // onscreen for in ms + const int shout_stay_time = 724; + + // the amount of time non-animated guilty/not guilty images stay onscreen for + // in ms + const int verdict_stay_time = 3000; + + // the amount of time non-animated witness testimony/cross-examination images + // stay onscreen for in ms + const int wtce_stay_time = 1500; + + static const int chatmessage_size = 28; + QString m_chatmessage[chatmessage_size]; + bool chatmessage_is_empty = false; + + QString previous_ic_message = ""; + + // char id, muted or not + QMap mute_map; + + // QVector muted_cids; + + bool is_muted = false; + + // 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 + int text_state = 2; + + // characters we consider punctuation + const QString punctuation_chars = ".,?!:;"; + + // amount by which we multiply the delay when we parse punctuation chars + int punctuation_modifier = 2; + + // character id, which index of the char_list the player is + int m_cid = -1; + // cid and this may differ in cases of ini-editing + + QString char_name = ""; + + int objection_state = 0; + bool keep_custom_objection = false; + QString objection_custom = ""; + int realization_state = 0; + int screenshake_state = 0; + int text_color = 0; + bool is_presenting_evidence = false; + + int defense_bar_state = 0; + int prosecution_bar_state = 0; + + int current_char_page = 0; + int char_columns = 10; + int char_rows = 9; + int max_chars_on_page = 90; + + const int button_width = 60; + const int button_height = 60; + + int current_emote_page = 0; + int emote_columns = 5; + int emote_rows = 2; + int max_emotes_on_page = 10; + + QVector local_evidence_list; + + int current_evidence_page = 0; + int current_evidence = 0; + int evidence_columns = 6; + 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 + bool is_ao2_bg = false; + + // whether or not to use text for buttons instead of images, true is text + bool change_char_fallback = true; + bool reload_theme_fallback = true; + bool settings_fallback = true; + bool call_mod_fallback = true; + bool casing_fallback = true; + bool amswap_fallback = true; + bool ooc_toggle_fallback = true; + + // whether the ooc chat is server or master chat, true is server + bool server_ooc = true; + + // Is AFK enabled + bool isafk = false; + QString current_background = "default"; + + AOMusicPlayer *music_player; + AOSfxPlayer *sfx_player; + AOSfxPlayer *misc_sfx_player; + AOSfxPlayer *frame_emote_sfx_player; + AOSfxPlayer *pair_frame_emote_sfx_player; + AOSfxPlayer *objection_player; + AOBlipPlayer *blip_player; + + AOSfxPlayer *modcall_player; + + AOImage *ui_background; + + QWidget *ui_viewport; + AOScene *ui_vp_background; + AOMovie *ui_vp_speedlines; + AOCharMovie *ui_vp_player_char; + AOCharMovie *ui_vp_sideplayer_char; + AOScene *ui_vp_desk; + AOScene *ui_vp_legacy_desk; + AOEvidenceDisplay *ui_vp_evidence_display; + AOImage *ui_vp_chatbox; + QLabel *ui_vp_showname; + QTextEdit *ui_vp_message; + AOMovie *ui_vp_realization; + AOMovie *ui_vp_testimony; + AOMovie *ui_vp_wtce; + AOMovie *ui_vp_objection; void realization_done(); - - bool colorf_iclog = false; - bool mirror_iclog = false; - bool colorf_limit = false; - - bool keep_evidence_display = false; - - QTextEdit *ui_ic_chatlog; - - AOTextArea *ui_ms_chatlog; - AOTextArea *ui_server_chatlog; - - QListWidget *ui_mute_list; - QListWidget *ui_area_list; - QTreeWidget *ui_music_list; - - AOButton *ui_pair_button; - QListWidget *ui_pair_list; - QSpinBox *ui_pair_offset_spinbox; - - QLineEdit *ui_ic_chat_message; - QLineEdit *ui_ic_chat_name; - - QLineEdit *ui_ooc_chat_message; - QLineEdit *ui_ooc_chat_name; - - //QLineEdit *ui_area_password; - QLineEdit *ui_music_search; - QString music_search_par = ""; - QString area_search_par = ""; - - QWidget *ui_emotes; - QVector ui_emote_list; - AOButton *ui_emote_left; - AOButton *ui_emote_right; - - QComboBox *ui_emote_dropdown; - QComboBox *ui_pos_dropdown; - - AOImage *ui_defense_bar; - AOImage *ui_prosecution_bar; - - QLabel *ui_music_label; - QLabel *ui_sfx_label; - QLabel *ui_blip_label; - - AOButton *ui_hold_it; - AOButton *ui_objection; - AOButton *ui_take_that; - - AOButton *ui_ooc_toggle; - - AOButton *ui_witness_testimony; - AOButton *ui_cross_examination; - AOButton *ui_guilty; - AOButton *ui_not_guilty; - - AOButton *ui_change_character; - 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_guard; - QCheckBox *ui_casing; - - QCheckBox *ui_pre_non_interrupt; - QCheckBox *ui_showname_enable; - - AOButton *ui_custom_objection; - AOButton *ui_realization; - AOButton *ui_screenshake; - AOButton *ui_mute; - - QMenu *custom_obj_menu; - - AOButton *ui_defense_plus; - AOButton *ui_defense_minus; - - AOButton *ui_prosecution_plus; - AOButton *ui_prosecution_minus; - - QComboBox *ui_text_color; - - QSlider *ui_music_slider; - QSlider *ui_sfx_slider; - QSlider *ui_blip_slider; - - AOImage *ui_muted; - - QSpinBox *ui_log_limit_spinbox; - QLabel *ui_log_limit_label; - - AOButton *ui_evidence_button; - AOImage *ui_evidence; - AOLineEdit *ui_evidence_name; - QWidget *ui_evidence_buttons; - QVector ui_evidence_list; - AOButton *ui_evidence_left; - AOButton *ui_evidence_right; - AOButton *ui_evidence_present; - AOImage *ui_evidence_overlay; - AOButton *ui_evidence_delete; - AOLineEdit *ui_evidence_image_name; - AOButton *ui_evidence_image_button; - AOButton *ui_evidence_x; - AOTextEdit *ui_evidence_description; - - AOImage *ui_char_select_background; - - AOImage *ui_selector; - - AOButton *ui_back_to_lobby; - - QLineEdit *ui_char_password; - - AOButton *ui_char_select_left; - AOButton *ui_char_select_right; - - AOButton *ui_spectator; - - void construct_char_select(); - void set_char_select(); - void set_char_select_page(); - void put_button_in_place(int starting, int chars_on_this_page); - void filter_character_list(); - - void construct_emotes(); - void set_emote_page(); - void set_emote_dropdown(); - - void construct_evidence(); - void set_evidence_page(); - -public slots: - void objection_done(); - void preanim_done(); - - void mod_called(QString p_ip); - - void case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno, bool witness); - -private slots: - void start_chat_ticking(); - void play_sfx(); - - void chat_tick(); - - void on_mute_list_clicked(QModelIndex p_index); - void on_pair_list_clicked(QModelIndex p_index); - - void on_chat_return_pressed(); - - void on_ooc_return_pressed(); - - void on_music_search_keypr(); - void on_music_search_edited(QString p_text); - void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); - void on_area_list_double_clicked(QModelIndex p_model); - - void select_emote(int p_id); - - void on_emote_clicked(int p_id); - - void on_emote_left_clicked(); - void on_emote_right_clicked(); - - void on_emote_dropdown_changed(int p_index); - void on_pos_dropdown_changed(int p_index); - - void on_evidence_name_edited(); - void on_evidence_image_name_edited(); - void on_evidence_image_button_clicked(); - void on_evidence_clicked(int p_id); - void on_evidence_double_clicked(int p_id); - - void on_evidence_hover(int p_id, bool p_state); - - void on_evidence_left_clicked(); - void on_evidence_right_clicked(); - void on_evidence_present_clicked(); - - void on_hold_it_clicked(); - void on_objection_clicked(); - void on_take_that_clicked(); - void on_custom_objection_clicked(); - void ShowContextMenu(const QPoint &pos); - - void on_realization_clicked(); - void on_screenshake_clicked(); - - void on_mute_clicked(); - void on_pair_clicked(); - - void on_defense_minus_clicked(); - void on_defense_plus_clicked(); - void on_prosecution_minus_clicked(); - void on_prosecution_plus_clicked(); - - void on_text_color_changed(int p_color); - - void on_music_slider_moved(int p_value); - void on_sfx_slider_moved(int p_value); - void on_blip_slider_moved(int p_value); - - void on_log_limit_changed(int value); - void on_pair_offset_changed(int value); - - void on_ooc_toggle_clicked(); - - void on_witness_testimony_clicked(); - void on_cross_examination_clicked(); - void on_not_guilty_clicked(); - void on_guilty_clicked(); - - void on_change_character_clicked(); - void on_reload_theme_clicked(); - void on_call_mod_clicked(); - void on_settings_clicked(); - void on_announce_casing_clicked(); - - void on_pre_clicked(); - void on_flip_clicked(); - void on_guard_clicked(); - - void on_showname_enable_clicked(); - - void on_evidence_button_clicked(); - - void on_evidence_delete_clicked(); - void on_evidence_x_clicked(); - - void on_back_to_lobby_clicked(); - - void on_char_select_left_clicked(); - void on_char_select_right_clicked(); - void on_char_search_changed(); - void on_char_taken_clicked(); - void on_char_passworded_clicked(); - - void on_spectator_clicked(); - - void char_clicked(int n_char); - - void on_switch_area_music_clicked(); - - void on_casing_clicked(); - - void ping_server(); - - #ifdef BASSAUDIO - void load_bass_opus_plugin(); - #endif -}; - -#endif // COURTROOM_H + + bool colorf_iclog = false; + bool mirror_iclog = false; + bool colorf_limit = false; + + bool keep_evidence_display = false; + + QTextEdit *ui_ic_chatlog; + + AOTextArea *ui_ms_chatlog; + AOTextArea *ui_server_chatlog; + + QListWidget *ui_mute_list; + QListWidget *ui_area_list; + QTreeWidget *ui_music_list; + + AOButton *ui_pair_button; + QListWidget *ui_pair_list; + QSpinBox *ui_pair_offset_spinbox; + + QLineEdit *ui_ic_chat_message; + QLineEdit *ui_ic_chat_name; + + QLineEdit *ui_ooc_chat_message; + QLineEdit *ui_ooc_chat_name; + + // QLineEdit *ui_area_password; + QLineEdit *ui_music_search; + QString music_search_par = ""; + QString area_search_par = ""; + + QWidget *ui_emotes; + QVector ui_emote_list; + AOButton *ui_emote_left; + AOButton *ui_emote_right; + + QComboBox *ui_emote_dropdown; + QComboBox *ui_pos_dropdown; + + AOImage *ui_defense_bar; + AOImage *ui_prosecution_bar; + + QLabel *ui_music_label; + QLabel *ui_sfx_label; + QLabel *ui_blip_label; + + AOButton *ui_hold_it; + AOButton *ui_objection; + AOButton *ui_take_that; + + AOButton *ui_ooc_toggle; + + AOButton *ui_witness_testimony; + AOButton *ui_cross_examination; + AOButton *ui_guilty; + AOButton *ui_not_guilty; + + AOButton *ui_change_character; + 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_guard; + QCheckBox *ui_casing; + + QCheckBox *ui_pre_non_interrupt; + QCheckBox *ui_showname_enable; + + AOButton *ui_custom_objection; + AOButton *ui_realization; + AOButton *ui_screenshake; + AOButton *ui_mute; + + QMenu *custom_obj_menu; + + AOButton *ui_defense_plus; + AOButton *ui_defense_minus; + + AOButton *ui_prosecution_plus; + AOButton *ui_prosecution_minus; + + QComboBox *ui_text_color; + + QSlider *ui_music_slider; + QSlider *ui_sfx_slider; + QSlider *ui_blip_slider; + + AOImage *ui_muted; + + QSpinBox *ui_log_limit_spinbox; + QLabel *ui_log_limit_label; + + AOButton *ui_evidence_button; + AOImage *ui_evidence; + AOLineEdit *ui_evidence_name; + QWidget *ui_evidence_buttons; + QVector ui_evidence_list; + AOButton *ui_evidence_left; + AOButton *ui_evidence_right; + AOButton *ui_evidence_present; + AOImage *ui_evidence_overlay; + AOButton *ui_evidence_delete; + AOLineEdit *ui_evidence_image_name; + AOButton *ui_evidence_image_button; + AOButton *ui_evidence_x; + AOTextEdit *ui_evidence_description; + + AOImage *ui_char_select_background; + + AOImage *ui_selector; + + AOButton *ui_back_to_lobby; + + QLineEdit *ui_char_password; + + AOButton *ui_char_select_left; + AOButton *ui_char_select_right; + + AOButton *ui_spectator; + + void construct_char_select(); + void set_char_select(); + void set_char_select_page(); + void put_button_in_place(int starting, int chars_on_this_page); + void filter_character_list(); + + void construct_emotes(); + void set_emote_page(); + void set_emote_dropdown(); + + void construct_evidence(); + void set_evidence_page(); + +public slots: + void objection_done(); + void preanim_done(); + + void mod_called(QString p_ip); + + void case_called(QString msg, bool def, bool pro, bool jud, bool jur, + bool steno, bool witness); + +private slots: + void start_chat_ticking(); + void play_sfx(); + + void chat_tick(); + + void on_mute_list_clicked(QModelIndex p_index); + void on_pair_list_clicked(QModelIndex p_index); + + void on_chat_return_pressed(); + + void on_ooc_return_pressed(); + + void on_music_search_keypr(); + void on_music_search_edited(QString p_text); + void on_music_list_double_clicked(QTreeWidgetItem *p_item, int column); + void on_area_list_double_clicked(QModelIndex p_model); + + void select_emote(int p_id); + + void on_emote_clicked(int p_id); + + void on_emote_left_clicked(); + void on_emote_right_clicked(); + + void on_emote_dropdown_changed(int p_index); + void on_pos_dropdown_changed(int p_index); + + void on_evidence_name_edited(); + void on_evidence_image_name_edited(); + void on_evidence_image_button_clicked(); + void on_evidence_clicked(int p_id); + void on_evidence_double_clicked(int p_id); + + void on_evidence_hover(int p_id, bool p_state); + + void on_evidence_left_clicked(); + void on_evidence_right_clicked(); + void on_evidence_present_clicked(); + + void on_hold_it_clicked(); + void on_objection_clicked(); + void on_take_that_clicked(); + void on_custom_objection_clicked(); + void ShowContextMenu(const QPoint &pos); + + void on_realization_clicked(); + void on_screenshake_clicked(); + + void on_mute_clicked(); + void on_pair_clicked(); + + void on_defense_minus_clicked(); + void on_defense_plus_clicked(); + void on_prosecution_minus_clicked(); + void on_prosecution_plus_clicked(); + + void on_text_color_changed(int p_color); + + void on_music_slider_moved(int p_value); + void on_sfx_slider_moved(int p_value); + void on_blip_slider_moved(int p_value); + + void on_log_limit_changed(int value); + void on_pair_offset_changed(int value); + + void on_ooc_toggle_clicked(); + + void on_witness_testimony_clicked(); + void on_cross_examination_clicked(); + void on_not_guilty_clicked(); + void on_guilty_clicked(); + + void on_change_character_clicked(); + void on_reload_theme_clicked(); + void on_call_mod_clicked(); + void on_settings_clicked(); + void on_announce_casing_clicked(); + + void on_pre_clicked(); + void on_flip_clicked(); + void on_guard_clicked(); + + void on_showname_enable_clicked(); + + void on_evidence_button_clicked(); + + void on_evidence_delete_clicked(); + void on_evidence_x_clicked(); + + void on_back_to_lobby_clicked(); + + void on_char_select_left_clicked(); + void on_char_select_right_clicked(); + void on_char_search_changed(); + void on_char_taken_clicked(); + void on_char_passworded_clicked(); + + void on_spectator_clicked(); + + void char_clicked(int n_char); + + void on_switch_area_music_clicked(); + + void on_casing_clicked(); + + void ping_server(); + +#ifdef BASSAUDIO + void load_bass_opus_plugin(); +#endif +}; + +#endif // COURTROOM_H diff --git a/include/datatypes.h b/include/datatypes.h index 1b76f72..89d4a40 100644 --- a/include/datatypes.h +++ b/include/datatypes.h @@ -3,16 +3,14 @@ #include -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 diff --git a/include/debug_functions.h b/include/debug_functions.h index 160274c..383431a 100644 --- a/include/debug_functions.h +++ b/include/debug_functions.h @@ -1,8 +1,8 @@ #ifndef DEBUG_FUNCTIONS_H #define DEBUG_FUNCTIONS_H -#include #include +#include void call_error(QString message); void call_notice(QString message); diff --git a/include/discord-rpc.h b/include/discord-rpc.h index feb874b..455f62a 100644 --- a/include/discord-rpc.h +++ b/include/discord-rpc.h @@ -24,61 +24,63 @@ extern "C" { #endif typedef struct DiscordRichPresence { - const char* state; /* max 128 bytes */ - const char* details; /* max 128 bytes */ - int64_t startTimestamp; - int64_t endTimestamp; - const char* largeImageKey; /* max 32 bytes */ - const char* largeImageText; /* max 128 bytes */ - const char* smallImageKey; /* max 32 bytes */ - const char* smallImageText; /* max 128 bytes */ - const char* partyId; /* max 128 bytes */ - int partySize; - int partyMax; - const char* matchSecret; /* max 128 bytes */ - const char* joinSecret; /* max 128 bytes */ - const char* spectateSecret; /* max 128 bytes */ - int8_t instance; + const char *state; /* max 128 bytes */ + const char *details; /* max 128 bytes */ + int64_t startTimestamp; + int64_t endTimestamp; + const char *largeImageKey; /* max 32 bytes */ + const char *largeImageText; /* max 128 bytes */ + const char *smallImageKey; /* max 32 bytes */ + const char *smallImageText; /* max 128 bytes */ + const char *partyId; /* max 128 bytes */ + int partySize; + int partyMax; + const char *matchSecret; /* max 128 bytes */ + const char *joinSecret; /* max 128 bytes */ + const char *spectateSecret; /* max 128 bytes */ + int8_t instance; } DiscordRichPresence; typedef struct DiscordJoinRequest { - const char* userId; - const char* username; - const char* discriminator; - const char* avatar; + const char *userId; + const char *username; + const char *discriminator; + const char *avatar; } DiscordJoinRequest; typedef struct DiscordEventHandlers { - void (*ready)(void); - void (*disconnected)(int errorCode, const char* message); - void (*errored)(int errorCode, const char* message); - void (*joinGame)(const char* joinSecret); - void (*spectateGame)(const char* spectateSecret); - void (*joinRequest)(const DiscordJoinRequest* request); + void (*ready)(void); + void (*disconnected)(int errorCode, const char *message); + void (*errored)(int errorCode, const char *message); + void (*joinGame)(const char *joinSecret); + void (*spectateGame)(const char *spectateSecret); + void (*joinRequest)(const DiscordJoinRequest *request); } DiscordEventHandlers; #define DISCORD_REPLY_NO 0 #define DISCORD_REPLY_YES 1 #define DISCORD_REPLY_IGNORE 2 -DISCORD_EXPORT void Discord_Initialize(const char* applicationId, - DiscordEventHandlers* handlers, +DISCORD_EXPORT void Discord_Initialize(const char *applicationId, + DiscordEventHandlers *handlers, int autoRegister, - const char* optionalSteamId); + const char *optionalSteamId); DISCORD_EXPORT void Discord_Shutdown(void); /* checks for incoming messages, dispatches callbacks */ DISCORD_EXPORT void Discord_RunCallbacks(void); -/* If you disable the lib starting its own io thread, you'll need to call this from your own */ +/* If you disable the lib starting its own io thread, you'll need to call this + * from your own */ #ifdef DISCORD_DISABLE_IO_THREAD DISCORD_EXPORT void Discord_UpdateConnection(void); #endif -DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence); +DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence); DISCORD_EXPORT void Discord_ClearPresence(void); -DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply); +DISCORD_EXPORT void Discord_Respond(const char *userid, + /* DISCORD_REPLY_ */ int reply); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/discord_register.h b/include/discord_register.h index 4c16b68..655a3df 100644 --- a/include/discord_register.h +++ b/include/discord_register.h @@ -1,25 +1,27 @@ #pragma once #if defined(DISCORD_DYNAMIC_LIB) -# if defined(_WIN32) -# if defined(DISCORD_BUILDING_SDK) -# define DISCORD_EXPORT __declspec(dllexport) -# else -# define DISCORD_EXPORT __declspec(dllimport) -# endif -# else -# define DISCORD_EXPORT __attribute__((visibility("default"))) -# endif +#if defined(_WIN32) +#if defined(DISCORD_BUILDING_SDK) +#define DISCORD_EXPORT __declspec(dllexport) #else -# define DISCORD_EXPORT +#define DISCORD_EXPORT __declspec(dllimport) +#endif +#else +#define DISCORD_EXPORT __attribute__((visibility("default"))) +#endif +#else +#define DISCORD_EXPORT #endif #ifdef __cplusplus extern "C" { #endif -DISCORD_EXPORT void Discord_Register(const char* applicationId, const char* command); -DISCORD_EXPORT void Discord_RegisterSteamGame(const char* applicationId, const char* steamId); +DISCORD_EXPORT void Discord_Register(const char *applicationId, + const char *command); +DISCORD_EXPORT void Discord_RegisterSteamGame(const char *applicationId, + const char *steamId); #ifdef __cplusplus } diff --git a/include/discord_rich_presence.h b/include/discord_rich_presence.h index 4115b51..71c85e2 100644 --- a/include/discord_rich_presence.h +++ b/include/discord_rich_presence.h @@ -1,11 +1,11 @@ #ifndef DISCORD_RICH_PRESENCE_H #define DISCORD_RICH_PRESENCE_H +#include +#include #include #include -#include #include -#include #include @@ -16,14 +16,14 @@ namespace AttorneyOnline { -class Discord -{ +class Discord { Q_DECLARE_TR_FUNCTIONS(Discord) private: - const char* APPLICATION_ID = "399779271737868288"; + 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 diff --git a/include/discord_rpc.h b/include/discord_rpc.h index 3e1441e..6bd4404 100644 --- a/include/discord_rpc.h +++ b/include/discord_rpc.h @@ -24,63 +24,65 @@ extern "C" { #endif typedef struct DiscordRichPresence { - const char* state; /* max 128 bytes */ - const char* details; /* max 128 bytes */ - int64_t startTimestamp; - int64_t endTimestamp; - const char* largeImageKey; /* max 32 bytes */ - const char* largeImageText; /* max 128 bytes */ - const char* smallImageKey; /* max 32 bytes */ - const char* smallImageText; /* max 128 bytes */ - const char* partyId; /* max 128 bytes */ - int partySize; - int partyMax; - const char* matchSecret; /* max 128 bytes */ - const char* joinSecret; /* max 128 bytes */ - const char* spectateSecret; /* max 128 bytes */ - int8_t instance; + const char *state; /* max 128 bytes */ + const char *details; /* max 128 bytes */ + int64_t startTimestamp; + int64_t endTimestamp; + const char *largeImageKey; /* max 32 bytes */ + const char *largeImageText; /* max 128 bytes */ + const char *smallImageKey; /* max 32 bytes */ + const char *smallImageText; /* max 128 bytes */ + const char *partyId; /* max 128 bytes */ + int partySize; + int partyMax; + const char *matchSecret; /* max 128 bytes */ + const char *joinSecret; /* max 128 bytes */ + const char *spectateSecret; /* max 128 bytes */ + int8_t instance; } DiscordRichPresence; typedef struct DiscordUser { - const char* userId; - const char* username; - const char* discriminator; - const char* avatar; + const char *userId; + const char *username; + const char *discriminator; + const char *avatar; } DiscordUser; typedef struct DiscordEventHandlers { - void (*ready)(const DiscordUser* request); - void (*disconnected)(int errorCode, const char* message); - void (*errored)(int errorCode, const char* message); - void (*joinGame)(const char* joinSecret); - void (*spectateGame)(const char* spectateSecret); - void (*joinRequest)(const DiscordUser* request); + void (*ready)(const DiscordUser *request); + void (*disconnected)(int errorCode, const char *message); + void (*errored)(int errorCode, const char *message); + void (*joinGame)(const char *joinSecret); + void (*spectateGame)(const char *spectateSecret); + void (*joinRequest)(const DiscordUser *request); } DiscordEventHandlers; #define DISCORD_REPLY_NO 0 #define DISCORD_REPLY_YES 1 #define DISCORD_REPLY_IGNORE 2 -DISCORD_EXPORT void Discord_Initialize(const char* applicationId, - DiscordEventHandlers* handlers, +DISCORD_EXPORT void Discord_Initialize(const char *applicationId, + DiscordEventHandlers *handlers, int autoRegister, - const char* optionalSteamId); + const char *optionalSteamId); DISCORD_EXPORT void Discord_Shutdown(void); /* checks for incoming messages, dispatches callbacks */ DISCORD_EXPORT void Discord_RunCallbacks(void); -/* If you disable the lib starting its own io thread, you'll need to call this from your own */ +/* If you disable the lib starting its own io thread, you'll need to call this + * from your own */ #ifdef DISCORD_DISABLE_IO_THREAD DISCORD_EXPORT void Discord_UpdateConnection(void); #endif -DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence* presence); +DISCORD_EXPORT void Discord_UpdatePresence(const DiscordRichPresence *presence); DISCORD_EXPORT void Discord_ClearPresence(void); -DISCORD_EXPORT void Discord_Respond(const char* userid, /* DISCORD_REPLY_ */ int reply); +DISCORD_EXPORT void Discord_Respond(const char *userid, + /* DISCORD_REPLY_ */ int reply); -DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers* handlers); +DISCORD_EXPORT void Discord_UpdateHandlers(DiscordEventHandlers *handlers); #ifdef __cplusplus } /* extern "C" */ diff --git a/include/encryption_functions.h b/include/encryption_functions.h index dc67d12..b70e8e6 100644 --- a/include/encryption_functions.h +++ b/include/encryption_functions.h @@ -3,11 +3,11 @@ #include -#include -#include -#include -#include #include +#include +#include +#include +#include QString fanta_encrypt(QString p_input, unsigned int key); QString fanta_decrypt(QString p_input, unsigned int key); diff --git a/include/file_functions.h b/include/file_functions.h index 6937ed8..8bb2e5f 100644 --- a/include/file_functions.h +++ b/include/file_functions.h @@ -1,8 +1,8 @@ #ifndef FILE_FUNCTIONS_H #define FILE_FUNCTIONS_H -#include #include +#include #include bool file_exists(QString file_path); diff --git a/include/hex_functions.h b/include/hex_functions.h index 285f096..d178ba1 100644 --- a/include/hex_functions.h +++ b/include/hex_functions.h @@ -1,17 +1,16 @@ #ifndef HEX_OPERATIONS_H #define HEX_OPERATIONS_H +#include #include #include -#include -#include -#include #include +#include #include +#include -namespace omni -{ - std::string int_to_hex(unsigned int input); +namespace omni { +std::string int_to_hex(unsigned int input); } -#endif //HEX_OPERATIONS_H +#endif // HEX_OPERATIONS_H diff --git a/include/lobby.h b/include/lobby.h index 0dca3d6..a9b6057 100644 --- a/include/lobby.h +++ b/include/lobby.h @@ -1,16 +1,16 @@ #ifndef LOBBY_H #define LOBBY_H -#include "aoimage.h" #include "aobutton.h" +#include "aoimage.h" #include "aopacket.h" #include "aotextarea.h" -#include -#include #include -#include #include +#include +#include +#include #include #include @@ -19,8 +19,7 @@ class AOApplication; -class Lobby : public QMainWindow -{ +class Lobby : public QMainWindow { Q_OBJECT public: @@ -33,8 +32,8 @@ public: void append_error(QString f_message); void set_player_count(int players_online, int max_players); void set_loading_text(QString p_text); - void show_loading_overlay(){ui_loading_background->show();} - void hide_loading_overlay(){ui_loading_background->hide();} + void show_loading_overlay() { ui_loading_background->show(); } + void hide_loading_overlay() { ui_loading_background->hide(); } QString get_chatlog(); int get_selected_server(); void enable_connect_button(); diff --git a/include/misc_functions.h b/include/misc_functions.h index 026c635..5287bee 100644 --- a/include/misc_functions.h +++ b/include/misc_functions.h @@ -1,8 +1,8 @@ #ifndef MISC_FUNCTIONS_H #define MISC_FUNCTIONS_H -#include #include +#include void delay(int p_milliseconds); diff --git a/include/networkmanager.h b/include/networkmanager.h index 08b10db..ed57a95 100644 --- a/include/networkmanager.h +++ b/include/networkmanager.h @@ -1,8 +1,8 @@ #ifndef NETWORKMANAGER_H #define NETWORKMANAGER_H -// Qt for Android has stubbed QDnsLookup. This is not documented in any part of their wiki. -// This prevents SRV lookup/failover behavior from functioning. +// Qt for Android has stubbed QDnsLookup. This is not documented in any part of +// their wiki. This prevents SRV lookup/failover behavior from functioning. // https://bugreports.qt.io/browse/QTBUG-56143 #ifndef ANDROID #define MS_FAILOVER_SUPPORTED @@ -14,17 +14,16 @@ #undef MS_FAILOVER_SUPPORTED #endif -#include "aopacket.h" #include "aoapplication.h" +#include "aopacket.h" -#include #include +#include #include #include #include -class NetworkManager : public QObject -{ +class NetworkManager : public QObject { Q_OBJECT public: diff --git a/include/text_file_functions.h b/include/text_file_functions.h index 119f38e..1da4d92 100644 --- a/include/text_file_functions.h +++ b/include/text_file_functions.h @@ -3,11 +3,11 @@ #include "aoapplication.h" #include "file_functions.h" -#include -#include -#include -#include #include +#include #include +#include +#include +#include #endif // TEXT_FILE_FUNCTIONS_H diff --git a/scripts/configure_ubuntu.sh b/scripts/configure_ubuntu.sh index a3d07ed..280dfdf 100755 --- a/scripts/configure_ubuntu.sh +++ b/scripts/configure_ubuntu.sh @@ -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 diff --git a/src/aoapplication.cpp b/src/aoapplication.cpp index 8546566..3b5e836 100644 --- a/src/aoapplication.cpp +++ b/src/aoapplication.cpp @@ -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; } @@ -38,8 +37,8 @@ void AOApplication::construct_lobby() lobby_constructed = true; QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width()-w_lobby->width()) / 2; - int y = (geometry.height()-w_lobby->height()) / 2; + int x = (geometry.width() - w_lobby->width()) / 2; + int y = (geometry.height() - w_lobby->height()) / 2; w_lobby->move(x, y); if (is_discord_enabled()) @@ -50,8 +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; } @@ -73,15 +70,14 @@ void AOApplication::construct_courtroom() courtroom_constructed = true; QRect geometry = QGuiApplication::primaryScreen()->geometry(); - int x = (geometry.width()-w_courtroom->width()) / 2; - int y = (geometry.height()-w_courtroom->height()) / 2; + int x = (geometry.width() - w_courtroom->width()) / 2; + int y = (geometry.height() - w_courtroom->height()) / 2; w_courtroom->move(x, y); } void AOApplication::destruct_courtroom() { - if (!courtroom_constructed) - { + if (!courtroom_constructed) { qDebug() << "W: courtroom was attempted destructed when it did not exist"; return; } @@ -93,16 +89,11 @@ void AOApplication::destruct_courtroom() QString AOApplication::get_version_string() { - return - QString::number(RELEASE) + "." + - QString::number(MAJOR_VERSION) + "." + - QString::number(MINOR_VERSION); + return QString::number(RELEASE) + "." + QString::number(MAJOR_VERSION) + "." + + QString::number(MINOR_VERSION); } -void AOApplication::reload_theme() -{ - current_theme = read_theme(); -} +void AOApplication::reload_theme() { current_theme = read_theme(); } void AOApplication::set_favorite_list() { @@ -133,8 +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,43 +135,44 @@ 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 " - "and connecting to one.\n" - "Please check your Internet connection and firewall, and please try again.")); + "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.")); } } } void AOApplication::call_settings_menu() { - AOOptionsDialog settings(nullptr, this); - settings.exec(); + AOOptionsDialog settings(nullptr, this); + settings.exec(); } void AOApplication::call_announce_menu(Courtroom *court) { - AOCaseAnnouncerDialog announcer(nullptr, this, court); - announcer.exec(); + AOCaseAnnouncerDialog announcer(nullptr, this, court); + announcer.exec(); } diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp index 9b548c3..7d598b5 100644 --- a/src/aoblipplayer.cpp +++ b/src/aoblipplayer.cpp @@ -1,6 +1,6 @@ #include "aoblipplayer.h" -#if defined(BASSAUDIO) //Using bass.dll for the blips +#if defined(BASSAUDIO) // Using bass.dll for the blips AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; @@ -11,11 +11,11 @@ void AOBlipPlayer::set_blips(QString p_sfx) { QString f_path = ao_app->get_sounds_path(p_sfx); - for (int n_stream = 0 ; n_stream < 5 ; ++n_stream) - { + for (int n_stream = 0; n_stream < 5; ++n_stream) { BASS_StreamFree(m_stream_list[n_stream]); - m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); + m_stream_list[n_stream] = BASS_StreamCreateFile( + FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE); } set_volume_internal(m_volume); @@ -44,12 +44,11 @@ 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); } } -#elif defined(QTAUDIO) //Using Qt's QSoundEffect class +#elif defined(QTAUDIO) // Using Qt's QSoundEffect class AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; @@ -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)); } @@ -88,30 +86,18 @@ void AOBlipPlayer::set_volume_internal(qreal p_value) { m_blips.setVolume(m_volume); } -#else //No audio +#else // No audio AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; ao_app = p_ao_app; } -void AOBlipPlayer::set_blips(QString p_sfx) -{ +void AOBlipPlayer::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 diff --git a/src/aobutton.cpp b/src/aobutton.cpp index 5be2e67..fee946a 100644 --- a/src/aobutton.cpp +++ b/src/aobutton.cpp @@ -3,15 +3,13 @@ #include "debug_functions.h" #include "file_functions.h" -AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) : QPushButton(parent) +AOButton::AOButton(QWidget *parent, AOApplication *p_ao_app) + : QPushButton(parent) { ao_app = p_ao_app; } -AOButton::~AOButton() -{ - -} +AOButton::~AOButton() {} void AOButton::set_image(QString p_image) { @@ -23,4 +21,3 @@ void AOButton::set_image(QString p_image) else this->setStyleSheet("border-image:url(\"" + default_image_path + "\")"); } - diff --git a/src/aocaseannouncerdialog.cpp b/src/aocaseannouncerdialog.cpp index 4b36fe6..0a287c3 100644 --- a/src/aocaseannouncerdialog.cpp +++ b/src/aocaseannouncerdialog.cpp @@ -1,7 +1,9 @@ #include "aocaseannouncerdialog.h" -AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_ao_app, Courtroom *p_court) - : QDialog(parent) +AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, + AOApplication *p_ao_app, + Courtroom *p_court) + : QDialog(parent) { ao_app = p_ao_app; court = p_court; @@ -14,21 +16,27 @@ AOCaseAnnouncerDialog::AOCaseAnnouncerDialog(QWidget *parent, AOApplication *p_a QSizePolicy sizepolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); sizepolicy.setHorizontalStretch(0); sizepolicy.setVerticalStretch(0); - sizepolicy.setHeightForWidth(ui_announcer_buttons->sizePolicy().hasHeightForWidth()); + sizepolicy.setHeightForWidth( + ui_announcer_buttons->sizePolicy().hasHeightForWidth()); ui_announcer_buttons->setSizePolicy(sizepolicy); ui_announcer_buttons->setOrientation(Qt::Horizontal); - ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); + ui_announcer_buttons->setStandardButtons(QDialogButtonBox::Ok | + QDialogButtonBox::Cancel); - QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this, SLOT(ok_pressed())); - QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this, SLOT(cancel_pressed())); + QObject::connect(ui_announcer_buttons, SIGNAL(accepted()), this, + SLOT(ok_pressed())); + QObject::connect(ui_announcer_buttons, SIGNAL(rejected()), this, + SLOT(cancel_pressed())); setUpdatesEnabled(false); ui_vbox_layout = new QVBoxLayout(this); ui_form_layout = new QFormLayout(this); - ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignVCenter); - ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | Qt::AlignTop); + ui_form_layout->setLabelAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignVCenter); + ui_form_layout->setFormAlignment(Qt::AlignLeading | Qt::AlignLeft | + Qt::AlignTop); ui_form_layout->setContentsMargins(6, 6, 6, 6); ui_vbox_layout->addItem(ui_form_layout); @@ -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(), - ui_witness_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); } diff --git a/src/aocharbutton.cpp b/src/aocharbutton.cpp index 7661027..5c8a73b 100644 --- a/src/aocharbutton.cpp +++ b/src/aocharbutton.cpp @@ -2,7 +2,9 @@ #include "file_functions.h" -AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, int y_pos, bool is_taken) : QPushButton(parent) +AOCharButton::AOCharButton(QWidget *parent, AOApplication *p_ao_app, int x_pos, + int y_pos, bool is_taken) + : QPushButton(parent) { m_parent = parent; @@ -40,45 +42,35 @@ void AOCharButton::reset() ui_selector->hide(); } -void AOCharButton::set_taken(bool is_taken) -{ - taken = is_taken; -} +void AOCharButton::set_taken(bool is_taken) { taken = is_taken; } void AOCharButton::apply_taken_image() { - if (taken) - { - ui_taken->move(0,0); + if (taken) { + ui_taken->move(0, 0); ui_taken->show(); } - else - { + else { ui_taken->hide(); } } -void AOCharButton::set_passworded() -{ - ui_passworded->show(); -} +void AOCharButton::set_passworded() { ui_passworded->show(); } void AOCharButton::set_image(QString p_character) { 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); } } -void AOCharButton::enterEvent(QEvent * e) +void AOCharButton::enterEvent(QEvent *e) { ui_selector->move(this->x() - 1, this->y() - 1); ui_selector->raise(); @@ -88,10 +80,8 @@ void AOCharButton::enterEvent(QEvent * e) QPushButton::enterEvent(e); } -void AOCharButton::leaveEvent(QEvent * e) +void AOCharButton::leaveEvent(QEvent *e) { ui_selector->hide(); QPushButton::leaveEvent(e); } - - diff --git a/src/aocharmovie.cpp b/src/aocharmovie.cpp index f0dad42..4252923 100644 --- a/src/aocharmovie.cpp +++ b/src/aocharmovie.cpp @@ -1,10 +1,11 @@ #include "aocharmovie.h" -#include "misc_functions.h" -#include "file_functions.h" #include "aoapplication.h" +#include "file_functions.h" +#include "misc_functions.h" -AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) +AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) + : QLabel(p_parent) { ao_app = p_ao_app; 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,148 +69,147 @@ 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) - { - this->sfx_two_network_boogaloo(); + 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) - { - this->screenshake_two_network_boogaloo(); + 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) - { - this->realization_two_network_boogaloo(); + else if (use_networked_framehell) { + this->realization_two_network_boogaloo(); } } void AOCharMovie::realization_two_network_boogaloo() { - int current_frame = m_movie->currentFrameNumber(); - QStringList realizationList = this->frame_realization_hellstring.split("^"); - for (int i = 0; i < realizationList.length(); i++) { - QString screenshakeList = realizationList.at(i); - QStringList extra_garbage = screenshakeList.split("|"); - if(extra_garbage.at(0) != current_emote){ - continue; - } - for (int ii = 1; ii < extra_garbage.length(); ii++) { - QString levels_of_garbage = extra_garbage.at(ii); - QStringList that_shouldnt_be_possible = levels_of_garbage.split("="); - if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") { - mycourtroom->doRealization(); - } - } + int current_frame = m_movie->currentFrameNumber(); + QStringList realizationList = this->frame_realization_hellstring.split("^"); + for (int i = 0; i < realizationList.length(); i++) { + QString screenshakeList = realizationList.at(i); + QStringList extra_garbage = screenshakeList.split("|"); + if (extra_garbage.at(0) != current_emote) { + continue; } + for (int ii = 1; ii < extra_garbage.length(); ii++) { + QString levels_of_garbage = extra_garbage.at(ii); + QStringList that_shouldnt_be_possible = levels_of_garbage.split("="); + if (that_shouldnt_be_possible.at(0).toInt() == current_frame && + that_shouldnt_be_possible.at(1) != "") { + mycourtroom->doRealization(); + } + } + } } void AOCharMovie::screenshake_two_network_boogaloo() { - int current_frame = m_movie->currentFrameNumber(); - QStringList realizationList = this->frame_screenshake_hellstring.split("^"); - for (int i = 0; i < realizationList.length(); i++) { - QString screenshakeList = realizationList.at(i); - QStringList extra_garbage = screenshakeList.split("|"); - if(extra_garbage.at(0) != current_emote){ - continue; - } - for (int ii = 1; ii < extra_garbage.length(); ii++) { - QString levels_of_garbage = extra_garbage.at(ii); - QStringList that_shouldnt_be_possible = levels_of_garbage.split("="); - if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") { - mycourtroom->doScreenShake(); - } - } + int current_frame = m_movie->currentFrameNumber(); + QStringList realizationList = this->frame_screenshake_hellstring.split("^"); + for (int i = 0; i < realizationList.length(); i++) { + QString screenshakeList = realizationList.at(i); + QStringList extra_garbage = screenshakeList.split("|"); + if (extra_garbage.at(0) != current_emote) { + continue; } + for (int ii = 1; ii < extra_garbage.length(); ii++) { + QString levels_of_garbage = extra_garbage.at(ii); + QStringList that_shouldnt_be_possible = levels_of_garbage.split("="); + if (that_shouldnt_be_possible.at(0).toInt() == current_frame && + that_shouldnt_be_possible.at(1) != "") { + mycourtroom->doScreenShake(); + } + } + } } void AOCharMovie::sfx_two_network_boogaloo() { - int current_frame = m_movie->currentFrameNumber(); - QStringList realizationList = this->frame_sfx_hellstring.split("^"); - for (int i = 0; i < realizationList.length(); i++) { - QString screenshakeList = realizationList.at(i); - QStringList extra_garbage = screenshakeList.split("|"); - if(extra_garbage.at(0) != current_emote){ - continue; - } - for (int ii = 1; ii < extra_garbage.length(); ii++) { - QString levels_of_garbage = extra_garbage.at(ii); - QStringList that_shouldnt_be_possible = levels_of_garbage.split("="); - if(that_shouldnt_be_possible.at(0).toInt() == current_frame && that_shouldnt_be_possible.at(1) != "") { - frame_specific_sfx_player->play(ao_app->get_sfx_suffix(that_shouldnt_be_possible.at(1))); - } - } + int current_frame = m_movie->currentFrameNumber(); + QStringList realizationList = this->frame_sfx_hellstring.split("^"); + for (int i = 0; i < realizationList.length(); i++) { + QString screenshakeList = realizationList.at(i); + QStringList extra_garbage = screenshakeList.split("|"); + if (extra_garbage.at(0) != current_emote) { + continue; } + for (int ii = 1; ii < extra_garbage.length(); ii++) { + QString levels_of_garbage = extra_garbage.at(ii); + QStringList that_shouldnt_be_possible = levels_of_garbage.split("="); + if (that_shouldnt_be_possible.at(0).toInt() == current_frame && + that_shouldnt_be_possible.at(1) != "") { + frame_specific_sfx_player->play( + ao_app->get_sfx_suffix(that_shouldnt_be_possible.at(1))); + } + } + } } - 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) - { - timer_done(); + 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()); } } void AOCharMovie::LoadImageWithStupidMethodForFlipSupport(QImage image) { - QPixmap f_pixmap; - if(m_flipped) - f_pixmap = QPixmap::fromImage(image.mirrored(true, false)); - else - f_pixmap = QPixmap::fromImage(image); - auto aspect_ratio = Qt::KeepAspectRatio; + QPixmap f_pixmap; + if (m_flipped) + f_pixmap = QPixmap::fromImage(image.mirrored(true, false)); + else + f_pixmap = QPixmap::fromImage(image); + auto aspect_ratio = Qt::KeepAspectRatio; - if (f_pixmap.size().width() > f_pixmap.size().height()) - aspect_ratio = Qt::KeepAspectRatioByExpanding; + 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)); - else - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), aspect_ratio, Qt::FastTransformation)); + 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)); - QLabel::move(x + (this->width() - this->pixmap()->width())/2, y); + QLabel::move(x + (this->width() - this->pixmap()->width()) / 2, y); } void AOCharMovie::play_pre(QString p_char, QString p_emote, int duration) @@ -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(); } diff --git a/src/aoemotebutton.cpp b/src/aoemotebutton.cpp index 9c1d388..29329c9 100644 --- a/src/aoemotebutton.cpp +++ b/src/aoemotebutton.cpp @@ -2,7 +2,9 @@ #include "file_functions.h" -AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent) +AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, + int p_x, int p_y) + : QPushButton(p_parent) { parent = p_parent; ao_app = p_ao_app; @@ -16,21 +18,17 @@ AOEmoteButton::AOEmoteButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x void AOEmoteButton::set_image(QString p_char, int p_emote, QString suffix) { QString emotion_number = QString::number(p_emote + 1); - QString image_path = ao_app->get_character_path(p_char, "emotions/button" + emotion_number + suffix); + QString image_path = ao_app->get_character_path( + p_char, "emotions/button" + emotion_number + suffix); - if (file_exists(image_path)) - { + if (file_exists(image_path)) { this->setText(""); this->setStyleSheet("border-image:url(\"" + image_path + "\")"); } - else - { + else { this->setText(ao_app->get_emote_comment(p_char, p_emote)); this->setStyleSheet("border-image:url(\"\")"); } } -void AOEmoteButton::on_clicked() -{ - emote_clicked(m_id); -} +void AOEmoteButton::on_clicked() { emote_clicked(m_id); } diff --git a/src/aoevidencebutton.cpp b/src/aoevidencebutton.cpp index 4dc0395..d0a6ac1 100644 --- a/src/aoevidencebutton.cpp +++ b/src/aoevidencebutton.cpp @@ -2,7 +2,9 @@ #include "file_functions.h" -AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, int p_x, int p_y) : QPushButton(p_parent) +AOEvidenceButton::AOEvidenceButton(QWidget *p_parent, AOApplication *p_ao_app, + int p_x, int p_y) + : QPushButton(p_parent) { ao_app = p_ao_app; m_parent = p_parent; @@ -39,13 +41,11 @@ void AOEvidenceButton::set_image(QString p_image) { QString image_path = ao_app->get_evidence_path(p_image); - if (file_exists(image_path)) - { + if (file_exists(image_path)) { this->setText(""); this->setStyleSheet("border-image:url(\"" + image_path + "\")"); } - else - { + else { this->setText(p_image); this->setStyleSheet(""); } @@ -75,10 +75,7 @@ void AOEvidenceButton::set_selected(bool p_selected) ui_selected->hide(); } -void AOEvidenceButton::on_clicked() -{ - evidence_clicked(m_id); -} +void AOEvidenceButton::on_clicked() { evidence_clicked(m_id); } void AOEvidenceButton::mouseDoubleClickEvent(QMouseEvent *e) { @@ -98,7 +95,7 @@ void AOEvidenceButton::dragEnterEvent(QMouseEvent *e) } */ -void AOEvidenceButton::enterEvent(QEvent * e) +void AOEvidenceButton::enterEvent(QEvent *e) { ui_selector->show(); @@ -108,7 +105,7 @@ void AOEvidenceButton::enterEvent(QEvent * e) QPushButton::enterEvent(e); } -void AOEvidenceButton::leaveEvent(QEvent * e) +void AOEvidenceButton::leaveEvent(QEvent *e) { ui_selector->hide(); diff --git a/src/aoevidencedisplay.cpp b/src/aoevidencedisplay.cpp index 9ec105d..9dd062b 100644 --- a/src/aoevidencedisplay.cpp +++ b/src/aoevidencedisplay.cpp @@ -1,10 +1,11 @@ #include "aoevidencedisplay.h" -#include "file_functions.h" #include "datatypes.h" +#include "file_functions.h" #include "misc_functions.h" -AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) +AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) + : QLabel(p_parent) { ao_app = p_ao_app; @@ -12,10 +13,12 @@ AOEvidenceDisplay::AOEvidenceDisplay(QWidget *p_parent, AOApplication *p_ao_app) evidence_icon = new QLabel(this); sfx_player = new AOSfxPlayer(this, ao_app); - connect(evidence_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(evidence_movie, SIGNAL(frameChanged(int)), this, + SLOT(frame_change(int))); } -void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_side, int p_volume) +void AOEvidenceDisplay::show_evidence(QString p_evidence_image, + bool is_left_side, int p_volume) { this->reset(); @@ -29,23 +32,23 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid QString gif_name; QString icon_identifier; - if (is_left_side) - { + if (is_left_side) { icon_identifier = "left_evidence_icon"; gif_name = "evidence_appear_left.gif"; } - else - { + else { icon_identifier = "right_evidence_icon"; gif_name = "evidence_appear_right.gif"; } - pos_size_type icon_dimensions = ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini"); + pos_size_type icon_dimensions = + ao_app->get_element_dimensions(icon_identifier, "courtroom_design.ini"); evidence_icon->move(icon_dimensions.x, icon_dimensions.y); evidence_icon->resize(icon_dimensions.width, icon_dimensions.height); - evidence_icon->setPixmap(f_pixmap.scaled(evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio)); + evidence_icon->setPixmap(f_pixmap.scaled( + evidence_icon->width(), evidence_icon->height(), Qt::IgnoreAspectRatio)); QString f_default_gif_path = ao_app->get_default_theme_path(gif_name); QString f_gif_path = ao_app->get_theme_path(gif_name); @@ -57,7 +60,7 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid evidence_movie->setFileName(final_gif_path); - if(evidence_movie->frameCount() < 1) + if (evidence_movie->frameCount() < 1) return; this->setMovie(evidence_movie); @@ -68,9 +71,8 @@ void AOEvidenceDisplay::show_evidence(QString p_evidence_image, bool is_left_sid void AOEvidenceDisplay::frame_change(int p_frame) { - if (p_frame == (evidence_movie->frameCount() - 1)) - { - //we need this or else the last frame wont show + if (p_frame == (evidence_movie->frameCount() - 1)) { + // we need this or else the last frame wont show delay(evidence_movie->nextFrameDelay()); evidence_movie->stop(); @@ -88,9 +90,4 @@ void AOEvidenceDisplay::reset() this->clear(); } -QLabel* AOEvidenceDisplay::get_evidence_icon() -{ - return evidence_icon; -} - - +QLabel *AOEvidenceDisplay::get_evidence_icon() { return evidence_icon; } diff --git a/src/aoimage.cpp b/src/aoimage.cpp index 7bb56bb..ffdf25a 100644 --- a/src/aoimage.cpp +++ b/src/aoimage.cpp @@ -8,10 +8,7 @@ AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) ao_app = p_ao_app; } -AOImage::~AOImage() -{ - -} +AOImage::~AOImage() {} void AOImage::set_image(QString p_image) { @@ -27,7 +24,8 @@ void AOImage::set_image(QString p_image) QPixmap f_pixmap(final_image_path); - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + this->setPixmap( + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); } void AOImage::set_image_from_path(QString p_path) @@ -43,5 +41,6 @@ void AOImage::set_image_from_path(QString p_path) QPixmap f_pixmap(final_path); - this->setPixmap(f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); + this->setPixmap( + f_pixmap.scaled(this->width(), this->height(), Qt::IgnoreAspectRatio)); } diff --git a/src/aolineedit.cpp b/src/aolineedit.cpp index f6026e1..211d9f7 100644 --- a/src/aolineedit.cpp +++ b/src/aolineedit.cpp @@ -15,7 +15,4 @@ void AOLineEdit::mouseDoubleClickEvent(QMouseEvent *e) this->setReadOnly(false); } -void AOLineEdit::on_enter_pressed() -{ - this->setReadOnly(true); -} +void AOLineEdit::on_enter_pressed() { this->setReadOnly(true); } diff --git a/src/aomovie.cpp b/src/aomovie.cpp index bb8e53d..9ffd62f 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -1,119 +1,116 @@ -#include "aomovie.h" - -#include "courtroom.h" +#include "aomovie.h" + +#include "courtroom.h" #include "file_functions.h" -#include "misc_functions.h" - -AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) -{ - ao_app = p_ao_app; - - m_movie = new QMovie(); - - this->setMovie(m_movie); - timer = new QTimer(this); - timer->setTimerType(Qt::PreciseTimer); - timer->setSingleShot(true); - connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); - connect(timer, SIGNAL(timeout()), this, SLOT(timer_done())); -} - -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, - int duration) -{ - - m_movie->stop(); - // this->timer_done(); - QString shout_path = p_gif; - QList pathlist; - - if (ao_app->get_character_path(p_char, p_gif) - .contains( - "custom_objections")) // checks if the file is located within the - // folder of custom objections - pathlist << ao_app->get_character_path( - p_char, - p_gif); // get_image_suffix is unecessery as it is already given. - else if (p_gif == "custom") - pathlist << ao_app->get_image_suffix( - ao_app->get_character_path(p_char, p_gif)); - else - pathlist << ao_app->get_image_suffix( - ao_app->get_character_path(p_char, p_gif + "_bubble")); - - QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + - p_gif + "_bubble.gif"; - QString custom_theme_path = - ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif"); - QString theme_path = ao_app->get_theme_path(p_gif + ".gif"); - QString default_theme_path = ao_app->get_default_theme_path(p_gif + ".gif"); - QString placeholder_path = ao_app->get_theme_path("placeholder.gif"); - QString default_placeholder_path = - ao_app->get_default_theme_path("placeholder.gif"); - - pathlist << ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + - p_custom_theme + "/" + p_gif + "_bubble") - << // Misc path - ao_app->get_image_suffix( - ao_app->get_custom_theme_path(p_custom_theme, p_gif)) - << // Custom theme path - ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)) << // Theme path - ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif)) - << // Default theme path - ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")) - << // Placeholder path - ao_app->get_image_suffix(ao_app->get_default_theme_path( - "placeholder")); // Default placeholder path - - for (QString path : pathlist) { - if (file_exists(path)) { - shout_path = path; - break; - } - } - m_movie->setFileName(shout_path); - if (m_movie->loopCount() == 0) - play_once = true; - - this->show(); - m_movie->start(); - if (m_movie->frameCount() == 0 && duration > 0) - timer->start(duration); -} - -void AOMovie::stop() -{ - m_movie->stop(); - this->hide(); -} - -void AOMovie::frame_change(int n_frame) -{ - // If it's a "static movie" (only one frame - png image), we can't change - // frames - ignore this function (use timer instead). If the frame didn't - // reach the last frame or the movie is continuous, don't stop the movie. - if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || - !play_once) - return; - // we need this or else the last frame wont show - timer->start(m_movie->nextFrameDelay()); -} - -void AOMovie::timer_done() -{ - this->stop(); - done(); -} - -void AOMovie::combo_resize(int w, int h) -{ - QSize f_size(w, h); - this->resize(f_size); - m_movie->setScaledSize(f_size); -} +#include "misc_functions.h" + +AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) +{ + ao_app = p_ao_app; + + m_movie = new QMovie(); + + this->setMovie(m_movie); + timer = new QTimer(this); + timer->setTimerType(Qt::PreciseTimer); + timer->setSingleShot(true); + connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(timer, SIGNAL(timeout()), this, SLOT(timer_done())); +} + +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, + int duration) +{ + + m_movie->stop(); + // this->timer_done(); + QString shout_path = p_gif; + QList pathlist; + + if (ao_app->get_character_path(p_char, p_gif) + .contains( + "custom_objections")) // checks if the file is located within the + // folder of custom objections + pathlist << ao_app->get_character_path( + p_char, + p_gif); // get_image_suffix is unecessery as it is already given. + else if (p_gif == "custom") + pathlist << ao_app->get_image_suffix( + ao_app->get_character_path(p_char, p_gif)); + else + pathlist << ao_app->get_image_suffix( + ao_app->get_character_path(p_char, p_gif + "_bubble")); + + QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + + p_gif + "_bubble.gif"; + QString custom_theme_path = + ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif"); + QString theme_path = ao_app->get_theme_path(p_gif + ".gif"); + QString default_theme_path = ao_app->get_default_theme_path(p_gif + ".gif"); + QString placeholder_path = ao_app->get_theme_path("placeholder.gif"); + QString default_placeholder_path = + ao_app->get_default_theme_path("placeholder.gif"); + + pathlist << ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + + p_custom_theme + "/" + p_gif + "_bubble") + << // Misc path + ao_app->get_image_suffix( + ao_app->get_custom_theme_path(p_custom_theme, p_gif)) + << // Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)) << // Theme path + ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif)) + << // Default theme path + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")) + << // Placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path( + "placeholder")); // Default placeholder path + + for (QString path : pathlist) { + if (file_exists(path)) { + shout_path = path; + break; + } + } + m_movie->setFileName(shout_path); + if (m_movie->loopCount() == 0) + play_once = true; + + this->show(); + m_movie->start(); + if (m_movie->frameCount() == 0 && duration > 0) + timer->start(duration); +} + +void AOMovie::stop() +{ + m_movie->stop(); + this->hide(); +} + +void AOMovie::frame_change(int n_frame) +{ + // If it's a "static movie" (only one frame - png image), we can't change + // frames - ignore this function (use timer instead). If the frame didn't + // reach the last frame or the movie is continuous, don't stop the movie. + if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || + !play_once) + return; + // we need this or else the last frame wont show + timer->start(m_movie->nextFrameDelay()); +} + +void AOMovie::timer_done() +{ + this->stop(); + done(); +} + +void AOMovie::combo_resize(int w, int h) +{ + QSize f_size(w, h); + this->resize(f_size); + m_movie->setScaledSize(f_size); +} diff --git a/src/aomusicplayer.cpp b/src/aomusicplayer.cpp index 74dcc63..e767435 100644 --- a/src/aomusicplayer.cpp +++ b/src/aomusicplayer.cpp @@ -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) { @@ -88,47 +75,27 @@ void AOMusicPlayer::set_volume(int p_value) QAudio::LogarithmicVolumeScale, QAudio::LinearVolumeScale); - m_player.setVolume(linearVolume*100); + 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 diff --git a/src/aopacket.cpp b/src/aopacket.cpp index b957efe..6afd39e 100644 --- a/src/aopacket.cpp +++ b/src/aopacket.cpp @@ -8,8 +8,7 @@ AOPacket::AOPacket(QString p_packet_string) m_header = packet_contents.at(0); - for(int n_string = 1 ; n_string < packet_contents.size() - 1 ; ++n_string) - { + for (int n_string = 1; n_string < packet_contents.size() - 1; ++n_string) { m_contents.append(packet_contents.at(n_string)); } } @@ -20,23 +19,18 @@ AOPacket::AOPacket(QString p_header, QStringList &p_contents) m_contents = p_contents; } -AOPacket::~AOPacket() -{ - -} +AOPacket::~AOPacket() {} QString AOPacket::to_string() { QString f_string = m_header; - for (QString i_string : m_contents) - { + for (QString i_string : m_contents) { f_string += ("#" + i_string); } f_string += "#%"; - if (encrypted) return "#" + f_string; else @@ -59,10 +53,12 @@ void AOPacket::decrypt_header(unsigned int p_key) void AOPacket::net_encode() { - for (int n_element = 0 ; n_element < m_contents.size() ; ++n_element) - { + for (int n_element = 0; n_element < m_contents.size(); ++n_element) { QString f_element = m_contents.at(n_element); - f_element.replace("#", "").replace("%", "").replace("$", "").replace("&", ""); + f_element.replace("#", "") + .replace("%", "") + .replace("$", "") + .replace("&", ""); 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("", "#").replace("", "%").replace("", "$").replace("", "&"); + f_element.replace("", "#") + .replace("", "%") + .replace("", "$") + .replace("", "&"); m_contents.removeAt(n_element); m_contents.insert(n_element, f_element); } } - diff --git a/src/aosfxplayer.cpp b/src/aosfxplayer.cpp index d2140e3..4684acd 100644 --- a/src/aosfxplayer.cpp +++ b/src/aosfxplayer.cpp @@ -1,8 +1,8 @@ #include "aosfxplayer.h" #include "file_functions.h" -#if defined(BASSAUDIO) //Using bass.dll for sfx -AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject() +#if defined(BASSAUDIO) // Using bass.dll for sfx +AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject() { m_parent = parent; ao_app = p_ao_app; @@ -11,7 +11,7 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject() void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) { BASS_ChannelStop(m_stream); - + QString misc_path = ""; QString char_path = ""; QString sound_path = ao_app->get_sounds_path(p_sfx); @@ -24,38 +24,35 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) QString f_path; if (file_exists(char_path)) - f_path = char_path; + f_path = char_path; else if (file_exists(misc_path)) f_path = misc_path; else f_path = sound_path; 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); } } void AOSfxPlayer::setLooping(bool is_looping) { - this->looping_sfx = 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) { @@ -65,11 +62,11 @@ void AOSfxPlayer::set_volume(qreal p_value) void AOSfxPlayer::set_volume_internal(qreal p_value) { - float volume = p_value; - BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume); + float volume = p_value; + BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume); } -#elif defined(QTAUDIO) //Using Qt's QSoundEffect class -AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject() +#elif defined(QTAUDIO) // Using Qt's QSoundEffect class +AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject() { m_parent = parent; ao_app = p_ao_app; @@ -91,35 +88,32 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) QString f_path; if (file_exists(char_path)) - f_path = char_path; + f_path = char_path; else if (file_exists(misc_path)) f_path = misc_path; else f_path = sound_path; - if (file_exists(f_path)) //if its missing, it will glitch out + if (file_exists(f_path)) // if its missing, it will glitch out { - m_sfx.setSource(QUrl::fromLocalFile(f_path)); + m_sfx.setSource(QUrl::fromLocalFile(f_path)); - set_volume_internal(m_volume); + set_volume_internal(m_volume); - m_sfx.play(); + m_sfx.play(); } } void AOSfxPlayer::setLooping(bool is_looping) { - this->looping_sfx = 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) { - m_volume = p_value/100; + m_volume = p_value / 100; set_volume_internal(m_volume); } @@ -128,34 +122,22 @@ void AOSfxPlayer::set_volume_internal(qreal p_value) m_sfx.setVolume(m_volume); } #else -AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app): QObject() +AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) : QObject() { m_parent = parent; 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; + 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 diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp index c741569..04d4431 100644 --- a/src/aotextarea.cpp +++ b/src/aotextarea.cpp @@ -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); @@ -22,9 +20,11 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message, this->insertHtml("" + p_name.toHtmlEscaped() + ": "); - //cheap workarounds ahoy + // cheap workarounds ahoy p_message += " "; - QString result = p_message.toHtmlEscaped().replace("\n", "
").replace(omnis_dank_url_regex, "\\1" ); + QString result = p_message.toHtmlEscaped() + .replace("\n", "
") + .replace(omnis_dank_url_regex, "\\1"); this->insertHtml(result); @@ -35,32 +35,35 @@ void AOTextArea::append_error(QString p_message) { const QTextCursor old_cursor = this->textCursor(); const int old_scrollbar_value = this->verticalScrollBar()->value(); - const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); + const bool is_scrolled_down = + old_scrollbar_value == this->verticalScrollBar()->maximum(); this->moveCursor(QTextCursor::End); this->append(""); p_message += " "; - QString result = p_message.replace("\n", "
").replace(omnis_dank_url_regex, "\\1" ); + QString result = p_message.replace("\n", "
") + .replace(omnis_dank_url_regex, "\\1"); this->insertHtml("" + result + ""); this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down); } -void AOTextArea::auto_scroll(QTextCursor old_cursor, int old_scrollbar_value, bool is_scrolled_down) +void AOTextArea::auto_scroll(QTextCursor old_cursor, int old_scrollbar_value, + bool is_scrolled_down) { - if (old_cursor.hasSelection() || !is_scrolled_down) - { - // The user has selected text or scrolled away from the bottom: maintain position. - this->setTextCursor(old_cursor); - this->verticalScrollBar()->setValue(old_scrollbar_value); + if (old_cursor.hasSelection() || !is_scrolled_down) { + // The user has selected text or scrolled away from the bottom: maintain + // position. + this->setTextCursor(old_cursor); + this->verticalScrollBar()->setValue(old_scrollbar_value); } - else - { - // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. - this->moveCursor(QTextCursor::End); - this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum()); + else { + // The user hasn't selected any text and the scrollbar is at the bottom: + // scroll to the bottom. + this->moveCursor(QTextCursor::End); + this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum()); } } diff --git a/src/aotextedit.cpp b/src/aotextedit.cpp index 30e48b7..22d9a62 100644 --- a/src/aotextedit.cpp +++ b/src/aotextedit.cpp @@ -4,7 +4,7 @@ AOTextEdit::AOTextEdit(QWidget *parent) : QPlainTextEdit(parent) { this->setReadOnly(true); - //connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed())); + // connect(this, SIGNAL(returnPressed()), this, SLOT(on_enter_pressed())); } void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e) @@ -14,8 +14,4 @@ void AOTextEdit::mouseDoubleClickEvent(QMouseEvent *e) this->setReadOnly(false); } -void AOTextEdit::on_enter_pressed() -{ - this->setReadOnly(true); -} - +void AOTextEdit::on_enter_pressed() { this->setReadOnly(true); } diff --git a/src/charselect.cpp b/src/charselect.cpp index e942fbe..9dee237 100644 --- a/src/charselect.cpp +++ b/src/charselect.cpp @@ -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,25 +142,22 @@ void Courtroom::set_char_select_page() ui_char_select_left->hide(); ui_char_select_right->hide(); - for (AOCharButton *i_button : ui_char_button_list) - { + for (AOCharButton *i_button : ui_char_button_list) { i_button->reset(); i_button->hide(); - i_button->move(0,0); + i_button->move(0, 0); } int total_pages = ui_char_button_list_filtered.size() / max_chars_on_page; int chars_on_page = 0; - if (ui_char_button_list_filtered.size() % max_chars_on_page != 0) - { + if (ui_char_button_list_filtered.size() % max_chars_on_page != 0) { ++total_pages; - //i. e. not on the last page + // i. e. not on the last page if (total_pages > current_char_page + 1) chars_on_page = max_chars_on_page; else chars_on_page = ui_char_button_list_filtered.size() % max_chars_on_page; - } else chars_on_page = max_chars_on_page; @@ -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); @@ -194,53 +199,55 @@ void Courtroom::char_clicked(int n_char) void Courtroom::put_button_in_place(int starting, int chars_on_this_page) { - if (ui_char_button_list_filtered.size() == 0) - return; + if (ui_char_button_list_filtered.size() == 0) + return; - QPoint f_spacing = ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini"); + QPoint f_spacing = + ao_app->get_button_spacing("char_button_spacing", "courtroom_design.ini"); - int x_spacing = f_spacing.x(); - int x_mod_count = 0; + int x_spacing = f_spacing.x(); + int x_mod_count = 0; - int y_spacing = f_spacing.y(); - int y_mod_count = 0; + int y_spacing = f_spacing.y(); + int y_mod_count = 0; - char_columns = ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) + 1; - char_rows = ((ui_char_buttons->height() - button_height) / (y_spacing + button_height)) + 1; + char_columns = + ((ui_char_buttons->width() - button_width) / (x_spacing + button_width)) + + 1; + char_rows = ((ui_char_buttons->height() - button_height) / + (y_spacing + button_height)) + + 1; - max_chars_on_page = char_columns * char_rows; + max_chars_on_page = char_columns * char_rows; - int startout = starting; - for (int n = starting ; n < startout+chars_on_this_page ; ++n) - { - int x_pos = (button_width + x_spacing) * x_mod_count; - int y_pos = (button_height + y_spacing) * y_mod_count; + int startout = starting; + for (int n = starting; n < startout + chars_on_this_page; ++n) { + int x_pos = (button_width + x_spacing) * x_mod_count; + int y_pos = (button_height + y_spacing) * y_mod_count; - ui_char_button_list_filtered.at(n)->move(x_pos, y_pos); - ui_char_button_list_filtered.at(n)->show(); - ui_char_button_list_filtered.at(n)->apply_taken_image(); + ui_char_button_list_filtered.at(n)->move(x_pos, y_pos); + ui_char_button_list_filtered.at(n)->show(); + ui_char_button_list_filtered.at(n)->apply_taken_image(); - ++x_mod_count; + ++x_mod_count; - if (x_mod_count == char_columns) - { - ++y_mod_count; - x_mod_count = 0; - } + if (x_mod_count == char_columns) { + ++y_mod_count; + x_mod_count = 0; } + } } void Courtroom::character_loading_finished() { - // Zeroeth, we'll clear any leftover characters from previous server visits. - ao_app->generated_chars = 0; - if (ui_char_button_list.size() > 0) - { - foreach (AOCharButton* item, ui_char_button_list) { - delete item; - } - ui_char_button_list.clear(); + // Zeroeth, we'll clear any leftover characters from previous server visits. + ao_app->generated_chars = 0; + if (ui_char_button_list.size() > 0) { + foreach (AOCharButton *item, ui_char_button_list) { + delete item; } + ui_char_button_list.clear(); + } // First, we'll make all the character buttons in the very beginning. // Since we can't trust what will happen during the multi threading process, @@ -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(); } diff --git a/src/chatlogpiece.cpp b/src/chatlogpiece.cpp index b96d502..9017b96 100644 --- a/src/chatlogpiece.cpp +++ b/src/chatlogpiece.cpp @@ -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() diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 71910ab..ca1c789 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1,136 +1,134 @@ -#include "courtroom.h" -Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() -{ - ao_app = p_ao_app; - #ifdef BASSAUDIO - // Change the default audio output device to be the one the user has given - // in his config.ini file for now. - unsigned int a = 0; - BASS_DEVICEINFO info; - - if (ao_app->get_audio_output_device() == "default") - { - BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); - load_bass_opus_plugin(); - } - else - { - for (a = 0; BASS_GetDeviceInfo(a, &info); a++) - { - if (ao_app->get_audio_output_device() == info.name) - { - BASS_SetDevice(a); - BASS_Init(static_cast(a), 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); - load_bass_opus_plugin(); - qDebug() << info.name << "was set as the default audio output device."; - break; - } - } - } - #elif defined QTAUDIO - - if (ao_app->get_audio_output_device() != "default") - { - foreach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) - { - if (ao_app->get_audio_output_device() == deviceInfo.deviceName()) - { - ao_app->QtAudioDevice = deviceInfo; - qDebug() << deviceInfo.deviceName() << "was set as the default audio output device."; - break; - } - } - } - #endif - - keepalive_timer = new QTimer(this); - keepalive_timer->start(60000); - - chat_tick_timer = new QTimer(this); - - text_delay_timer = new QTimer(this); - text_delay_timer->setSingleShot(true); - - sfx_delay_timer = new QTimer(this); - sfx_delay_timer->setSingleShot(true); - - realization_timer = new QTimer(this); - realization_timer->setSingleShot(true); - - char_button_mapper = new QSignalMapper(this); - - music_player = new AOMusicPlayer(this, ao_app); - music_player->set_volume(0); - - sfx_player = new AOSfxPlayer(this, ao_app); - sfx_player->set_volume(0); - - objection_player = new AOSfxPlayer(this, ao_app); - objection_player->set_volume(0); - - misc_sfx_player = new AOSfxPlayer(this, ao_app); - misc_sfx_player->set_volume(0); - frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); - frame_emote_sfx_player->set_volume(0); - pair_frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); - pair_frame_emote_sfx_player->set_volume(0); - +#include "courtroom.h" + +Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() +{ + ao_app = p_ao_app; +#ifdef BASSAUDIO + // Change the default audio output device to be the one the user has given + // in his config.ini file for now. + unsigned int a = 0; + BASS_DEVICEINFO info; + + if (ao_app->get_audio_output_device() == "default") { + BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, nullptr, nullptr); + load_bass_opus_plugin(); + } + else { + for (a = 0; BASS_GetDeviceInfo(a, &info); a++) { + if (ao_app->get_audio_output_device() == info.name) { + BASS_SetDevice(a); + BASS_Init(static_cast(a), 48000, BASS_DEVICE_LATENCY, nullptr, + nullptr); + load_bass_opus_plugin(); + qDebug() << info.name << "was set as the default audio output device."; + break; + } + } + } +#elif defined QTAUDIO + + if (ao_app->get_audio_output_device() != "default") { + foreach (const QAudioDeviceInfo &deviceInfo, + QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) { + if (ao_app->get_audio_output_device() == deviceInfo.deviceName()) { + ao_app->QtAudioDevice = deviceInfo; + qDebug() << deviceInfo.deviceName() + << "was set as the default audio output device."; + break; + } + } + } +#endif + + keepalive_timer = new QTimer(this); + keepalive_timer->start(60000); + + chat_tick_timer = new QTimer(this); + + text_delay_timer = new QTimer(this); + text_delay_timer->setSingleShot(true); + + sfx_delay_timer = new QTimer(this); + sfx_delay_timer->setSingleShot(true); + + realization_timer = new QTimer(this); + realization_timer->setSingleShot(true); + char_button_mapper = new QSignalMapper(this); - blip_player = new AOBlipPlayer(this, ao_app); - blip_player->set_volume(0); - - modcall_player = new AOSfxPlayer(this, ao_app); - modcall_player->set_volume(50); - - ui_background = new AOImage(this, ao_app); - - ui_viewport = new QWidget(this); - ui_vp_background = new AOScene(ui_viewport, ao_app); - ui_vp_speedlines = new AOMovie(ui_viewport, ao_app); - ui_vp_speedlines->set_play_once(false); - ui_vp_player_char = new AOCharMovie(ui_viewport, ao_app); - ui_vp_player_char->frame_specific_sfx_player = frame_emote_sfx_player; - ui_vp_player_char->mycourtroom = this; - ui_vp_sideplayer_char = new AOCharMovie(ui_viewport, ao_app); - ui_vp_sideplayer_char->frame_specific_sfx_player = pair_frame_emote_sfx_player; - ui_vp_sideplayer_char->mycourtroom = this; - ui_vp_sideplayer_char->hide(); - ui_vp_desk = new AOScene(ui_viewport, ao_app); - ui_vp_legacy_desk = new AOScene(ui_viewport, ao_app); - - ui_vp_evidence_display = new AOEvidenceDisplay(this, ao_app); - - ui_vp_chatbox = new AOImage(this, ao_app); - ui_vp_showname = new QLabel(ui_vp_chatbox); - ui_vp_message = new QTextEdit(ui_vp_chatbox); - ui_vp_message->setFrameStyle(QFrame::NoFrame); - ui_vp_message->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui_vp_message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui_vp_message->setReadOnly(true); - + music_player = new AOMusicPlayer(this, ao_app); + music_player->set_volume(0); + + sfx_player = new AOSfxPlayer(this, ao_app); + sfx_player->set_volume(0); + + objection_player = new AOSfxPlayer(this, ao_app); + objection_player->set_volume(0); + + misc_sfx_player = new AOSfxPlayer(this, ao_app); + misc_sfx_player->set_volume(0); + frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); + frame_emote_sfx_player->set_volume(0); + pair_frame_emote_sfx_player = new AOSfxPlayer(this, ao_app); + pair_frame_emote_sfx_player->set_volume(0); + + char_button_mapper = new QSignalMapper(this); + + blip_player = new AOBlipPlayer(this, ao_app); + blip_player->set_volume(0); + + modcall_player = new AOSfxPlayer(this, ao_app); + modcall_player->set_volume(50); + + ui_background = new AOImage(this, ao_app); + + ui_viewport = new QWidget(this); + ui_vp_background = new AOScene(ui_viewport, ao_app); + ui_vp_speedlines = new AOMovie(ui_viewport, ao_app); + ui_vp_speedlines->set_play_once(false); + ui_vp_player_char = new AOCharMovie(ui_viewport, ao_app); + ui_vp_player_char->frame_specific_sfx_player = frame_emote_sfx_player; + ui_vp_player_char->mycourtroom = this; + ui_vp_sideplayer_char = new AOCharMovie(ui_viewport, ao_app); + ui_vp_sideplayer_char->frame_specific_sfx_player = + pair_frame_emote_sfx_player; + ui_vp_sideplayer_char->mycourtroom = this; + ui_vp_sideplayer_char->hide(); + ui_vp_desk = new AOScene(ui_viewport, ao_app); + ui_vp_legacy_desk = new AOScene(ui_viewport, ao_app); + + ui_vp_evidence_display = new AOEvidenceDisplay(this, ao_app); + + ui_vp_chatbox = new AOImage(this, ao_app); + ui_vp_showname = new QLabel(ui_vp_chatbox); + ui_vp_message = new QTextEdit(ui_vp_chatbox); + ui_vp_message->setFrameStyle(QFrame::NoFrame); + ui_vp_message->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui_vp_message->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui_vp_message->setReadOnly(true); + ui_vp_testimony = new AOMovie(this, ao_app); ui_vp_testimony->set_play_once(false); ui_vp_realization = new AOMovie(this, ao_app); - ui_vp_wtce = new AOMovie(this, ao_app); - ui_vp_objection = new AOMovie(this, ao_app); - - ui_ic_chatlog = new QTextEdit(this); - ui_ic_chatlog->setReadOnly(true); - - log_maximum_blocks = ao_app->get_max_log_size(); - log_goes_downwards = ao_app->get_log_goes_downwards(); - - ui_ms_chatlog = new AOTextArea(this); - ui_ms_chatlog->setReadOnly(true); - ui_ms_chatlog->setOpenExternalLinks(true); - ui_ms_chatlog->hide(); - - ui_server_chatlog = new AOTextArea(this); - ui_server_chatlog->setReadOnly(true); - ui_server_chatlog->setOpenExternalLinks(true); - - ui_area_list = new QListWidget(this); + ui_vp_wtce = new AOMovie(this, ao_app); + ui_vp_objection = new AOMovie(this, ao_app); + + ui_ic_chatlog = new QTextEdit(this); + ui_ic_chatlog->setReadOnly(true); + + log_maximum_blocks = ao_app->get_max_log_size(); + log_goes_downwards = ao_app->get_log_goes_downwards(); + + ui_ms_chatlog = new AOTextArea(this); + ui_ms_chatlog->setReadOnly(true); + ui_ms_chatlog->setOpenExternalLinks(true); + ui_ms_chatlog->hide(); + + ui_server_chatlog = new AOTextArea(this); + ui_server_chatlog->setReadOnly(true); + ui_server_chatlog->setOpenExternalLinks(true); + + ui_area_list = new QListWidget(this); ui_music_list = new QTreeWidget(this); ui_music_list->setColumnCount(2); @@ -145,907 +143,913 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_music_list->setContextMenuPolicy(Qt::CustomContextMenu); ui_music_list->hide(); - - ui_ic_chat_name = new QLineEdit(this); - ui_ic_chat_name->setFrame(false); - ui_ic_chat_name->setPlaceholderText(tr("Showname")); - - ui_ic_chat_message = new QLineEdit(this); - ui_ic_chat_message->setFrame(false); - ui_ic_chat_message->setPlaceholderText(tr("Message")); - - ui_muted = new AOImage(ui_ic_chat_message, ao_app); - ui_muted->hide(); - - ui_ooc_chat_message = new QLineEdit(this); - ui_ooc_chat_message->setFrame(false); - ui_ooc_chat_message->setPlaceholderText(tr("OOC Message")); - - ui_ooc_chat_name = new QLineEdit(this); - ui_ooc_chat_name->setFrame(false); - ui_ooc_chat_name->setPlaceholderText(tr("Name")); - ui_ooc_chat_name->setMaxLength(30); - ui_ooc_chat_name->setText(p_ao_app->get_default_username()); - + + ui_ic_chat_name = new QLineEdit(this); + ui_ic_chat_name->setFrame(false); + ui_ic_chat_name->setPlaceholderText(tr("Showname")); + + ui_ic_chat_message = new QLineEdit(this); + ui_ic_chat_message->setFrame(false); + ui_ic_chat_message->setPlaceholderText(tr("Message")); + + ui_muted = new AOImage(ui_ic_chat_message, ao_app); + ui_muted->hide(); + + ui_ooc_chat_message = new QLineEdit(this); + ui_ooc_chat_message->setFrame(false); + ui_ooc_chat_message->setPlaceholderText(tr("OOC Message")); + + ui_ooc_chat_name = new QLineEdit(this); + ui_ooc_chat_name->setFrame(false); + ui_ooc_chat_name->setPlaceholderText(tr("Name")); + ui_ooc_chat_name->setMaxLength(30); + ui_ooc_chat_name->setText(p_ao_app->get_default_username()); + punctuation_modifier = p_ao_app->get_pundelay(); colorf_iclog = p_ao_app->get_colored_iclog_enabled(); mirror_iclog = p_ao_app->get_iclmir_enabled(); colorf_limit = p_ao_app->colorlog_restricted_enabled(); keep_evidence_display = p_ao_app->is_keepevi_enabled(); - //ui_area_password = new QLineEdit(this); - //ui_area_password->setFrame(false); - ui_music_search = new QLineEdit(this); - ui_music_search->setFrame(false); - ui_music_search->setPlaceholderText(tr("Search")); - - construct_emotes(); - - ui_emote_left = new AOButton(this, ao_app); - ui_emote_right = new AOButton(this, ao_app); - - ui_emote_dropdown = new QComboBox(this); - ui_pos_dropdown = new QComboBox(this); - ui_pos_dropdown->addItem("wit"); - ui_pos_dropdown->addItem("def"); - ui_pos_dropdown->addItem("pro"); - ui_pos_dropdown->addItem("jud"); - ui_pos_dropdown->addItem("hld"); - ui_pos_dropdown->addItem("hlp"); - ui_pos_dropdown->addItem("jur"); - ui_pos_dropdown->addItem("sea"); - - ui_defense_bar = new AOImage(this, ao_app); - ui_prosecution_bar = new AOImage(this, ao_app); - - ui_music_label = new QLabel(this); - ui_sfx_label = new QLabel(this); - ui_blip_label = new QLabel(this); - - ui_log_limit_label = new QLabel(this); - - ui_hold_it = new AOButton(this, ao_app); - ui_objection = new AOButton(this, ao_app); - ui_take_that = new AOButton(this, ao_app); - - ui_ooc_toggle = new AOButton(this, ao_app); - ui_witness_testimony = new AOButton(this, ao_app); - ui_cross_examination = new AOButton(this, ao_app); - ui_guilty = new AOButton(this, ao_app); - ui_not_guilty = new AOButton(this, ao_app); - - ui_change_character = new AOButton(this, ao_app); - ui_reload_theme = new AOButton(this, ao_app); - ui_call_mod = new AOButton(this, ao_app); - ui_settings = new AOButton(this, ao_app); - ui_announce_casing = new AOButton(this, ao_app); - ui_switch_area_music = new AOButton(this, ao_app); - - ui_pre = new QCheckBox(this); - ui_pre->setText(tr("Pre")); - - ui_flip = new QCheckBox(this); - ui_flip->setText(tr("Flip")); - ui_flip->hide(); - - ui_guard = new QCheckBox(this); - - ui_guard->setText(tr("Disable Modcalls")); - - ui_guard->hide(); - - ui_casing = new QCheckBox(this); - ui_casing->setChecked(ao_app->get_casing_enabled()); - ui_casing->setText(tr("Casing")); - ui_casing->hide(); - - ui_showname_enable = new QCheckBox(this); - ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); - ui_showname_enable->setText(tr("Shownames")); - - ui_pre_non_interrupt = new QCheckBox(this); - ui_pre_non_interrupt->setText(tr("No Interrupt")); - ui_pre_non_interrupt->hide(); - - ui_custom_objection = new AOButton(this, ao_app); + // ui_area_password = new QLineEdit(this); + // ui_area_password->setFrame(false); + ui_music_search = new QLineEdit(this); + ui_music_search->setFrame(false); + ui_music_search->setPlaceholderText(tr("Search")); + + construct_emotes(); + + ui_emote_left = new AOButton(this, ao_app); + ui_emote_right = new AOButton(this, ao_app); + + ui_emote_dropdown = new QComboBox(this); + ui_pos_dropdown = new QComboBox(this); + ui_pos_dropdown->addItem("wit"); + ui_pos_dropdown->addItem("def"); + ui_pos_dropdown->addItem("pro"); + ui_pos_dropdown->addItem("jud"); + ui_pos_dropdown->addItem("hld"); + ui_pos_dropdown->addItem("hlp"); + ui_pos_dropdown->addItem("jur"); + ui_pos_dropdown->addItem("sea"); + + ui_defense_bar = new AOImage(this, ao_app); + ui_prosecution_bar = new AOImage(this, ao_app); + + ui_music_label = new QLabel(this); + ui_sfx_label = new QLabel(this); + ui_blip_label = new QLabel(this); + + ui_log_limit_label = new QLabel(this); + + ui_hold_it = new AOButton(this, ao_app); + ui_objection = new AOButton(this, ao_app); + ui_take_that = new AOButton(this, ao_app); + + ui_ooc_toggle = new AOButton(this, ao_app); + ui_witness_testimony = new AOButton(this, ao_app); + ui_cross_examination = new AOButton(this, ao_app); + ui_guilty = new AOButton(this, ao_app); + ui_not_guilty = new AOButton(this, ao_app); + + ui_change_character = new AOButton(this, ao_app); + ui_reload_theme = new AOButton(this, ao_app); + ui_call_mod = new AOButton(this, ao_app); + ui_settings = new AOButton(this, ao_app); + ui_announce_casing = new AOButton(this, ao_app); + ui_switch_area_music = new AOButton(this, ao_app); + + ui_pre = new QCheckBox(this); + ui_pre->setText(tr("Pre")); + + ui_flip = new QCheckBox(this); + ui_flip->setText(tr("Flip")); + ui_flip->hide(); + + ui_guard = new QCheckBox(this); + + ui_guard->setText(tr("Disable Modcalls")); + + ui_guard->hide(); + + ui_casing = new QCheckBox(this); + ui_casing->setChecked(ao_app->get_casing_enabled()); + ui_casing->setText(tr("Casing")); + ui_casing->hide(); + + ui_showname_enable = new QCheckBox(this); + ui_showname_enable->setChecked(ao_app->get_showname_enabled_by_default()); + ui_showname_enable->setText(tr("Shownames")); + + ui_pre_non_interrupt = new QCheckBox(this); + ui_pre_non_interrupt->setText(tr("No Interrupt")); + ui_pre_non_interrupt->hide(); + + ui_custom_objection = new AOButton(this, ao_app); ui_custom_objection->setContextMenuPolicy(Qt::CustomContextMenu); custom_obj_menu = new QMenu; - ui_realization = new AOButton(this, ao_app); - ui_screenshake = new AOButton(this, ao_app); - ui_mute = new AOButton(this, ao_app); - - ui_defense_plus = new AOButton(this, ao_app); - ui_defense_minus = new AOButton(this, ao_app); - - ui_prosecution_plus = new AOButton(this, ao_app); - ui_prosecution_minus = new AOButton(this, ao_app); - - ui_text_color = new QComboBox(this); - ui_text_color->addItem(tr("White")); - ui_text_color->addItem(tr("Green")); - ui_text_color->addItem(tr("Red")); - ui_text_color->addItem(tr("Orange")); - ui_text_color->addItem(tr("Blue")); - ui_text_color->addItem(tr("Yellow")); - ui_text_color->addItem(tr("Rainbow")); - ui_text_color->addItem(tr("Pink")); - ui_text_color->addItem(tr("Cyan")); - - ui_music_slider = new QSlider(Qt::Horizontal, this); - ui_music_slider->setRange(0, 100); - ui_music_slider->setValue(ao_app->get_default_music()); - - ui_sfx_slider = new QSlider(Qt::Horizontal, this); - ui_sfx_slider->setRange(0, 100); - ui_sfx_slider->setValue(ao_app->get_default_sfx()); - - ui_blip_slider = new QSlider(Qt::Horizontal, this); - ui_blip_slider->setRange(0, 100); - ui_blip_slider->setValue(ao_app->get_default_blip()); - - ui_log_limit_spinbox = new QSpinBox(this); - ui_log_limit_spinbox->setRange(0, 10000); - ui_log_limit_spinbox->setValue(ao_app->get_max_log_size()); - - ui_mute_list = new QListWidget(this); - - ui_pair_list = new QListWidget(this); - ui_pair_offset_spinbox = new QSpinBox(this); - ui_pair_offset_spinbox->setRange(-100,100); - ui_pair_offset_spinbox->setSuffix(tr("% offset")); - ui_pair_button = new AOButton(this, ao_app); - - ui_evidence_button = new AOButton(this, ao_app); - - construct_evidence(); - - construct_char_select(); - - connect(keepalive_timer, SIGNAL(timeout()), this, SLOT(ping_server())); - - connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done())); - connect(ui_vp_player_char, SIGNAL(done()), this, SLOT(preanim_done())); - - connect(text_delay_timer, SIGNAL(timeout()), this, SLOT(start_chat_ticking())); - connect(sfx_delay_timer, SIGNAL(timeout()), this, SLOT(play_sfx())); - - connect(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick())); - - connect(realization_timer, SIGNAL(timeout()), this, SLOT(realization_done())); - - - connect(ui_emote_left, SIGNAL(clicked()), this, SLOT(on_emote_left_clicked())); - connect(ui_emote_right, SIGNAL(clicked()), this, SLOT(on_emote_right_clicked())); - - connect(ui_emote_dropdown, SIGNAL(activated(int)), this, SLOT(on_emote_dropdown_changed(int))); - connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, SLOT(on_pos_dropdown_changed(int))); + ui_realization = new AOButton(this, ao_app); + ui_screenshake = new AOButton(this, ao_app); + ui_mute = new AOButton(this, ao_app); + + ui_defense_plus = new AOButton(this, ao_app); + ui_defense_minus = new AOButton(this, ao_app); + + ui_prosecution_plus = new AOButton(this, ao_app); + ui_prosecution_minus = new AOButton(this, ao_app); + + ui_text_color = new QComboBox(this); + ui_text_color->addItem(tr("White")); + ui_text_color->addItem(tr("Green")); + ui_text_color->addItem(tr("Red")); + ui_text_color->addItem(tr("Orange")); + ui_text_color->addItem(tr("Blue")); + ui_text_color->addItem(tr("Yellow")); + ui_text_color->addItem(tr("Rainbow")); + ui_text_color->addItem(tr("Pink")); + ui_text_color->addItem(tr("Cyan")); + + ui_music_slider = new QSlider(Qt::Horizontal, this); + ui_music_slider->setRange(0, 100); + ui_music_slider->setValue(ao_app->get_default_music()); + + ui_sfx_slider = new QSlider(Qt::Horizontal, this); + ui_sfx_slider->setRange(0, 100); + ui_sfx_slider->setValue(ao_app->get_default_sfx()); + + ui_blip_slider = new QSlider(Qt::Horizontal, this); + ui_blip_slider->setRange(0, 100); + ui_blip_slider->setValue(ao_app->get_default_blip()); + + ui_log_limit_spinbox = new QSpinBox(this); + ui_log_limit_spinbox->setRange(0, 10000); + ui_log_limit_spinbox->setValue(ao_app->get_max_log_size()); + + ui_mute_list = new QListWidget(this); + + ui_pair_list = new QListWidget(this); + ui_pair_offset_spinbox = new QSpinBox(this); + ui_pair_offset_spinbox->setRange(-100, 100); + ui_pair_offset_spinbox->setSuffix(tr("% offset")); + ui_pair_button = new AOButton(this, ao_app); + + ui_evidence_button = new AOButton(this, ao_app); + + construct_evidence(); + + construct_char_select(); + + connect(keepalive_timer, SIGNAL(timeout()), this, SLOT(ping_server())); + + connect(ui_vp_objection, SIGNAL(done()), this, SLOT(objection_done())); + connect(ui_vp_player_char, SIGNAL(done()), this, SLOT(preanim_done())); + + connect(text_delay_timer, SIGNAL(timeout()), this, + SLOT(start_chat_ticking())); + connect(sfx_delay_timer, SIGNAL(timeout()), this, SLOT(play_sfx())); + + connect(chat_tick_timer, SIGNAL(timeout()), this, SLOT(chat_tick())); + connect(realization_timer, SIGNAL(timeout()), this, SLOT(realization_done())); + + connect(ui_emote_left, SIGNAL(clicked()), this, + SLOT(on_emote_left_clicked())); + connect(ui_emote_right, SIGNAL(clicked()), this, + SLOT(on_emote_right_clicked())); + + connect(ui_emote_dropdown, SIGNAL(activated(int)), this, + SLOT(on_emote_dropdown_changed(int))); + connect(ui_pos_dropdown, SIGNAL(currentIndexChanged(int)), this, + SLOT(on_pos_dropdown_changed(int))); + connect(ui_mute_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_mute_list_clicked(QModelIndex))); - - - connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, SLOT(on_chat_return_pressed())); - - connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, SLOT(on_ooc_return_pressed())); + + connect(ui_ic_chat_message, SIGNAL(returnPressed()), this, + SLOT(on_chat_return_pressed())); + + connect(ui_ooc_chat_message, SIGNAL(returnPressed()), this, + SLOT(on_ooc_return_pressed())); + connect(ui_music_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(on_music_list_double_clicked(QTreeWidgetItem *, int))); connect(ui_area_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_area_list_double_clicked(QModelIndex))); - connect(ui_hold_it, SIGNAL(clicked()), this, SLOT(on_hold_it_clicked())); - connect(ui_objection, SIGNAL(clicked()), this, SLOT(on_objection_clicked())); - connect(ui_take_that, SIGNAL(clicked()), this, SLOT(on_take_that_clicked())); - - connect(ui_realization, SIGNAL(clicked()), this, SLOT(on_realization_clicked())); - connect(ui_screenshake, SIGNAL(clicked()), this, SLOT(on_screenshake_clicked())); + connect(ui_hold_it, SIGNAL(clicked()), this, SLOT(on_hold_it_clicked())); + connect(ui_objection, SIGNAL(clicked()), this, SLOT(on_objection_clicked())); + connect(ui_take_that, SIGNAL(clicked()), this, SLOT(on_take_that_clicked())); connect(ui_custom_objection, SIGNAL(clicked()), this, SLOT(on_custom_objection_clicked())); connect(ui_custom_objection, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(ShowContextMenu(const QPoint &))); - connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked())); - - connect(ui_defense_minus, SIGNAL(clicked()), this, SLOT(on_defense_minus_clicked())); - connect(ui_defense_plus, SIGNAL(clicked()), this, SLOT(on_defense_plus_clicked())); - connect(ui_prosecution_minus, SIGNAL(clicked()), this, SLOT(on_prosecution_minus_clicked())); - connect(ui_prosecution_plus, SIGNAL(clicked()), this, SLOT(on_prosecution_plus_clicked())); - - connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this, SLOT(on_text_color_changed(int))); - - connect(ui_music_slider, SIGNAL(valueChanged(int)), this, SLOT(on_music_slider_moved(int))); - connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this, SLOT(on_sfx_slider_moved(int))); - connect(ui_blip_slider, SIGNAL(valueChanged(int)), this, SLOT(on_blip_slider_moved(int))); - - connect(ui_log_limit_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_log_limit_changed(int))); - - connect(ui_ooc_toggle, SIGNAL(clicked()), this, SLOT(on_ooc_toggle_clicked())); - - connect(ui_music_search, SIGNAL(textChanged(QString)), this, SLOT(on_music_search_edited(QString))); - - connect(ui_witness_testimony, SIGNAL(clicked()), this, SLOT(on_witness_testimony_clicked())); - connect(ui_cross_examination, SIGNAL(clicked()), this, SLOT(on_cross_examination_clicked())); - connect(ui_guilty, SIGNAL(clicked()), this, SLOT(on_guilty_clicked())); - connect(ui_not_guilty, SIGNAL(clicked()), this, SLOT(on_not_guilty_clicked())); - - connect(ui_change_character, SIGNAL(clicked()), this, SLOT(on_change_character_clicked())); - connect(ui_reload_theme, SIGNAL(clicked()), this, SLOT(on_reload_theme_clicked())); - connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked())); - connect(ui_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); - connect(ui_announce_casing, SIGNAL(clicked()), this, SLOT(on_announce_casing_clicked())); - connect(ui_switch_area_music, SIGNAL(clicked()), this, SLOT(on_switch_area_music_clicked())); - - connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); - connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); - connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); - connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked())); - - connect(ui_showname_enable, SIGNAL(clicked()), this, SLOT(on_showname_enable_clicked())); - - connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked())); - connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, SLOT(on_pair_list_clicked(QModelIndex))); - connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, SLOT(on_pair_offset_changed(int))); - - connect(ui_evidence_button, SIGNAL(clicked()), this, SLOT(on_evidence_button_clicked())); - - set_widgets(); - - set_char_select(); - detect_fallback_text(); -} - -void Courtroom::set_mute_list() -{ - mute_map.clear(); - - //maps which characters are muted based on cid, none are muted by default - for (int n_cid = 0 ; n_cid < char_list.size() ; n_cid++) - { - mute_map.insert(n_cid, false); - } - - QStringList sorted_mute_list; - - for (char_type i_char : char_list) - sorted_mute_list.append(i_char.name); - - sorted_mute_list.sort(); - - for (QString i_name : sorted_mute_list) - { - //mute_map.insert(i_name, false); - ui_mute_list->addItem(i_name); - } -} - -void Courtroom::set_pair_list() -{ - QStringList sorted_pair_list; - - for (char_type i_char : char_list) - sorted_pair_list.append(i_char.name); - - sorted_pair_list.sort(); - - for (QString i_name : sorted_pair_list) - { - ui_pair_list->addItem(i_name); - } -} - -void Courtroom::set_widgets() -{ - blip_rate = ao_app->read_blip_rate(); - blank_blip = ao_app->get_blank_blip(); - - QString filename = "courtroom_design.ini"; - - pos_size_type f_courtroom = ao_app->get_element_dimensions("courtroom", filename); - - if (f_courtroom.width < 0 || f_courtroom.height < 0) - { - qDebug() << "W: did not find courtroom width or height in " << filename; - - this->resize(714, 668); - } - else - { - m_courtroom_width = f_courtroom.width; - m_courtroom_height = f_courtroom.height; - - this->resize(f_courtroom.width, f_courtroom.height); - } - - set_fonts(); - - ui_background->move(0, 0); - ui_background->resize(m_courtroom_width, m_courtroom_height); - ui_background->set_image("courtroombackground.png"); - - set_size_and_pos(ui_viewport, "viewport"); - - // If there is a point to it, show all CCCC features. - // We also do this this soon so that set_size_and_pos can hide them all later, if needed. - if (ao_app->cccc_ic_support_enabled) - { - ui_pair_button->show(); - ui_pre_non_interrupt->show(); - ui_showname_enable->show(); - ui_ic_chat_name->show(); - ui_ic_chat_name->setEnabled(true); - } - else - { - ui_pair_button->hide(); - ui_pre_non_interrupt->hide(); - ui_showname_enable->hide(); - ui_ic_chat_name->hide(); - ui_ic_chat_name->setEnabled(false); - } - - if (ao_app->casing_alerts_enabled) - { - ui_announce_casing->show(); - } - else - { - ui_announce_casing->hide(); - } - - // We also show the non-server-dependent client additions. - // Once again, if the theme can't display it, set_move_and_pos will catch them. - ui_settings->show(); - ui_log_limit_label->show(); - ui_log_limit_spinbox->show(); - - ui_vp_background->move(0, 0); - ui_vp_background->resize(ui_viewport->width(), ui_viewport->height()); - - ui_vp_speedlines->move(0, 0); - ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height()); - - ui_vp_player_char->move(0, 0); - ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height()); - - ui_vp_sideplayer_char->move(0, 0); - ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), ui_viewport->height()); - - //the AO2 desk element - ui_vp_desk->move(0, 0); - ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height()); - - //the size of the ui_vp_legacy_desk element relies on various factors and is set in set_scene() - - double y_modifier = 147.0 / 192.0; - int final_y = static_cast(y_modifier * ui_viewport->height()); - ui_vp_legacy_desk->move(0, final_y); - ui_vp_legacy_desk->hide(); - - ui_vp_evidence_display->move(0, 0); - ui_vp_evidence_display->resize(ui_viewport->width(), ui_viewport->height()); - - set_size_and_pos(ui_vp_showname, "showname"); - - set_size_and_pos(ui_vp_message, "message"); - ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); - ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: white"); - - ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y()); + connect(ui_realization, SIGNAL(clicked()), this, + SLOT(on_realization_clicked())); + connect(ui_screenshake, SIGNAL(clicked()), this, + SLOT(on_screenshake_clicked())); + connect(ui_mute, SIGNAL(clicked()), this, SLOT(on_mute_clicked())); + + connect(ui_defense_minus, SIGNAL(clicked()), this, + SLOT(on_defense_minus_clicked())); + connect(ui_defense_plus, SIGNAL(clicked()), this, + SLOT(on_defense_plus_clicked())); + connect(ui_prosecution_minus, SIGNAL(clicked()), this, + SLOT(on_prosecution_minus_clicked())); + connect(ui_prosecution_plus, SIGNAL(clicked()), this, + SLOT(on_prosecution_plus_clicked())); + + connect(ui_text_color, SIGNAL(currentIndexChanged(int)), this, + SLOT(on_text_color_changed(int))); + + connect(ui_music_slider, SIGNAL(valueChanged(int)), this, + SLOT(on_music_slider_moved(int))); + connect(ui_sfx_slider, SIGNAL(valueChanged(int)), this, + SLOT(on_sfx_slider_moved(int))); + connect(ui_blip_slider, SIGNAL(valueChanged(int)), this, + SLOT(on_blip_slider_moved(int))); + + connect(ui_log_limit_spinbox, SIGNAL(valueChanged(int)), this, + SLOT(on_log_limit_changed(int))); + + connect(ui_ooc_toggle, SIGNAL(clicked()), this, + SLOT(on_ooc_toggle_clicked())); + + connect(ui_music_search, SIGNAL(returnPressed()), this, + SLOT(on_music_search_keypr())); + connect(ui_music_search, SIGNAL(textChanged(QString)), this, + SLOT(on_music_search_edited(QString))); + + connect(ui_witness_testimony, SIGNAL(clicked()), this, + SLOT(on_witness_testimony_clicked())); + connect(ui_cross_examination, SIGNAL(clicked()), this, + SLOT(on_cross_examination_clicked())); + connect(ui_guilty, SIGNAL(clicked()), this, SLOT(on_guilty_clicked())); + connect(ui_not_guilty, SIGNAL(clicked()), this, + SLOT(on_not_guilty_clicked())); + + connect(ui_change_character, SIGNAL(clicked()), this, + SLOT(on_change_character_clicked())); + connect(ui_reload_theme, SIGNAL(clicked()), this, + SLOT(on_reload_theme_clicked())); + connect(ui_call_mod, SIGNAL(clicked()), this, SLOT(on_call_mod_clicked())); + connect(ui_settings, SIGNAL(clicked()), this, SLOT(on_settings_clicked())); + connect(ui_announce_casing, SIGNAL(clicked()), this, + SLOT(on_announce_casing_clicked())); + connect(ui_switch_area_music, SIGNAL(clicked()), this, + SLOT(on_switch_area_music_clicked())); + + connect(ui_pre, SIGNAL(clicked()), this, SLOT(on_pre_clicked())); + connect(ui_flip, SIGNAL(clicked()), this, SLOT(on_flip_clicked())); + connect(ui_guard, SIGNAL(clicked()), this, SLOT(on_guard_clicked())); + connect(ui_casing, SIGNAL(clicked()), this, SLOT(on_casing_clicked())); + + connect(ui_showname_enable, SIGNAL(clicked()), this, + SLOT(on_showname_enable_clicked())); + + connect(ui_pair_button, SIGNAL(clicked()), this, SLOT(on_pair_clicked())); + connect(ui_pair_list, SIGNAL(clicked(QModelIndex)), this, + SLOT(on_pair_list_clicked(QModelIndex))); + connect(ui_pair_offset_spinbox, SIGNAL(valueChanged(int)), this, + SLOT(on_pair_offset_changed(int))); + + connect(ui_evidence_button, SIGNAL(clicked()), this, + SLOT(on_evidence_button_clicked())); + + set_widgets(); + + set_char_select(); + detect_fallback_text(); +} + +void Courtroom::set_mute_list() +{ + mute_map.clear(); + + // maps which characters are muted based on cid, none are muted by default + for (int n_cid = 0; n_cid < char_list.size(); n_cid++) { + mute_map.insert(n_cid, false); + } + + QStringList sorted_mute_list; + + for (char_type i_char : char_list) + sorted_mute_list.append(i_char.name); + + sorted_mute_list.sort(); + + for (QString i_name : sorted_mute_list) { + // mute_map.insert(i_name, false); + ui_mute_list->addItem(i_name); + } +} + +void Courtroom::set_pair_list() +{ + QStringList sorted_pair_list; + + for (char_type i_char : char_list) + sorted_pair_list.append(i_char.name); + + sorted_pair_list.sort(); + + for (QString i_name : sorted_pair_list) { + ui_pair_list->addItem(i_name); + } +} + +void Courtroom::set_widgets() +{ + blip_rate = ao_app->read_blip_rate(); + blank_blip = ao_app->get_blank_blip(); + + QString filename = "courtroom_design.ini"; + + pos_size_type f_courtroom = + ao_app->get_element_dimensions("courtroom", filename); + + if (f_courtroom.width < 0 || f_courtroom.height < 0) { + qDebug() << "W: did not find courtroom width or height in " << filename; + + this->resize(714, 668); + } + else { + m_courtroom_width = f_courtroom.width; + m_courtroom_height = f_courtroom.height; + + this->resize(f_courtroom.width, f_courtroom.height); + } + + set_fonts(); + + ui_background->move(0, 0); + ui_background->resize(m_courtroom_width, m_courtroom_height); + ui_background->set_image("courtroombackground.png"); + + set_size_and_pos(ui_viewport, "viewport"); + + // If there is a point to it, show all CCCC features. + // We also do this this soon so that set_size_and_pos can hide them all later, + // if needed. + if (ao_app->cccc_ic_support_enabled) { + ui_pair_button->show(); + ui_pre_non_interrupt->show(); + ui_showname_enable->show(); + ui_ic_chat_name->show(); + ui_ic_chat_name->setEnabled(true); + } + else { + ui_pair_button->hide(); + ui_pre_non_interrupt->hide(); + ui_showname_enable->hide(); + ui_ic_chat_name->hide(); + ui_ic_chat_name->setEnabled(false); + } + + if (ao_app->casing_alerts_enabled) { + ui_announce_casing->show(); + } + else { + ui_announce_casing->hide(); + } + + // We also show the non-server-dependent client additions. + // Once again, if the theme can't display it, set_move_and_pos will catch + // them. + ui_settings->show(); + ui_log_limit_label->show(); + ui_log_limit_spinbox->show(); + + ui_vp_background->move(0, 0); + ui_vp_background->resize(ui_viewport->width(), ui_viewport->height()); + + ui_vp_speedlines->move(0, 0); + ui_vp_speedlines->combo_resize(ui_viewport->width(), ui_viewport->height()); + + ui_vp_player_char->move(0, 0); + ui_vp_player_char->combo_resize(ui_viewport->width(), ui_viewport->height()); + + ui_vp_sideplayer_char->move(0, 0); + ui_vp_sideplayer_char->combo_resize(ui_viewport->width(), + ui_viewport->height()); + + // the AO2 desk element + ui_vp_desk->move(0, 0); + ui_vp_desk->resize(ui_viewport->width(), ui_viewport->height()); + + // the size of the ui_vp_legacy_desk element relies on various factors and is + // set in set_scene() + + double y_modifier = 147.0 / 192.0; + int final_y = static_cast(y_modifier * ui_viewport->height()); + ui_vp_legacy_desk->move(0, final_y); + ui_vp_legacy_desk->hide(); + + ui_vp_evidence_display->move(0, 0); + ui_vp_evidence_display->resize(ui_viewport->width(), ui_viewport->height()); + + set_size_and_pos(ui_vp_showname, "showname"); + + set_size_and_pos(ui_vp_message, "message"); + ui_vp_message->setTextInteractionFlags(Qt::NoTextInteraction); + ui_vp_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "color: white"); + + ui_vp_testimony->move(ui_viewport->x(), ui_viewport->y()); ui_vp_testimony->combo_resize(ui_viewport->width(), ui_viewport->height()); - - ui_vp_realization->move(ui_viewport->x(), ui_viewport->y()); + + ui_vp_realization->move(ui_viewport->x(), ui_viewport->y()); ui_vp_realization->combo_resize(ui_viewport->width(), ui_viewport->height()); - - ui_vp_wtce->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height()); - - ui_vp_objection->move(ui_viewport->x(), ui_viewport->y()); - ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height()); - - set_size_and_pos(ui_ic_chatlog, "ic_chatlog"); - - set_size_and_pos(ui_ms_chatlog, "ms_chatlog"); - - set_size_and_pos(ui_server_chatlog, "server_chatlog"); - - set_size_and_pos(ui_mute_list, "mute_list"); - ui_mute_list->hide(); - - set_size_and_pos(ui_pair_list, "pair_list"); - ui_pair_list->hide(); - set_size_and_pos(ui_pair_offset_spinbox, "pair_offset_spinbox"); - ui_pair_offset_spinbox->hide(); - set_size_and_pos(ui_pair_button, "pair_button"); - ui_pair_button->set_image("pair_button.png"); - - set_size_and_pos(ui_area_list, "music_list"); - ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - + + ui_vp_wtce->move(ui_viewport->x(), ui_viewport->y()); + ui_vp_wtce->combo_resize(ui_viewport->width(), ui_viewport->height()); + + ui_vp_objection->move(ui_viewport->x(), ui_viewport->y()); + ui_vp_objection->combo_resize(ui_viewport->width(), ui_viewport->height()); + + set_size_and_pos(ui_ic_chatlog, "ic_chatlog"); + + set_size_and_pos(ui_ms_chatlog, "ms_chatlog"); + + set_size_and_pos(ui_server_chatlog, "server_chatlog"); + + set_size_and_pos(ui_mute_list, "mute_list"); + ui_mute_list->hide(); + + set_size_and_pos(ui_pair_list, "pair_list"); + ui_pair_list->hide(); + set_size_and_pos(ui_pair_offset_spinbox, "pair_offset_spinbox"); + ui_pair_offset_spinbox->hide(); + set_size_and_pos(ui_pair_button, "pair_button"); + ui_pair_button->set_image("pair_button.png"); + + set_size_and_pos(ui_area_list, "music_list"); + ui_area_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + ui_music_list->setStyleSheet("background-color: rgba(100, 103, 132, 225);"); ui_music_list->collapseAll(); - set_size_and_pos(ui_music_list, "music_list"); - - if (is_ao2_bg) - { - set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); - set_size_and_pos(ui_vp_chatbox, "ao2_chatbox"); - set_size_and_pos(ui_ic_chat_name, "ao2_ic_chat_name"); - } - else - { - set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); - set_size_and_pos(ui_vp_chatbox, "chatbox"); - set_size_and_pos(ui_ic_chat_name, "ic_chat_name"); - } - - ui_ic_chat_message->setStyleSheet("QLineEdit{background-color: rgba(100, 100, 100, 255);}"); - ui_ic_chat_name->setStyleSheet("QLineEdit{background-color: rgba(180, 180, 180, 255);}"); - - ui_vp_chatbox->set_image("chatmed.png"); - ui_vp_chatbox->hide(); - - ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); - ui_muted->set_image("muted.png"); - - set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message"); - ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - - set_size_and_pos(ui_ooc_chat_name, "ooc_chat_name"); - ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); - - //set_size_and_pos(ui_area_password, "area_password"); - set_size_and_pos(ui_music_search, "music_search"); - - set_size_and_pos(ui_emotes, "emotes"); - - set_size_and_pos(ui_emote_left, "emote_left"); - ui_emote_left->set_image("arrow_left.png"); - - set_size_and_pos(ui_emote_right, "emote_right"); - ui_emote_right->set_image("arrow_right.png"); - - set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); - set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); - - set_size_and_pos(ui_defense_bar, "defense_bar"); - ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state) + ".png"); - - set_size_and_pos(ui_prosecution_bar, "prosecution_bar"); - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(prosecution_bar_state) + ".png"); - - set_size_and_pos(ui_music_label, "music_label"); - ui_music_label->setText(tr("Music")); - set_size_and_pos(ui_sfx_label, "sfx_label"); - ui_sfx_label->setText(tr("Sfx")); - set_size_and_pos(ui_blip_label, "blip_label"); - ui_blip_label->setText(tr("Blips")); - - set_size_and_pos(ui_log_limit_label, "log_limit_label"); - ui_log_limit_label->setText(tr("Log limit")); - - set_size_and_pos(ui_hold_it, "hold_it"); - ui_hold_it->set_image("holdit.png"); - set_size_and_pos(ui_objection, "objection"); - ui_objection->set_image("objection.png"); - set_size_and_pos(ui_take_that, "take_that"); - ui_take_that->set_image("takethat.png"); - - set_size_and_pos(ui_ooc_toggle, "ooc_toggle"); - if (ooc_toggle_fallback) - { - ui_ooc_toggle->setText(tr("Server")); - } - else - { - ui_ooc_toggle->set_image("ooc_toggle_server.png"); - ui_ooc_toggle->setText(tr("")); - } - - set_size_and_pos(ui_witness_testimony, "witness_testimony"); - ui_witness_testimony->set_image("witnesstestimony.png"); - set_size_and_pos(ui_cross_examination, "cross_examination"); - ui_cross_examination->set_image("crossexamination.png"); - - set_size_and_pos(ui_guilty, "guilty"); - ui_guilty->set_image("guilty.png"); - set_size_and_pos(ui_not_guilty, "not_guilty"); - ui_not_guilty->set_image("notguilty.png"); - - set_size_and_pos(ui_change_character, "change_character"); - if (change_char_fallback) - { - ui_change_character->setText(tr("Change character")); - } - else - { - ui_change_character->set_image("change_character.png"); - ui_change_character->setText(tr("")); // set text to empty otherwise it just sits there - } - - set_size_and_pos(ui_reload_theme, "reload_theme"); - if (reload_theme_fallback) - { - ui_reload_theme->setText(tr("Reload theme")); - } - else - { - ui_reload_theme->set_image("reload_theme.png"); - ui_reload_theme->setText(tr("")); - } - - set_size_and_pos(ui_call_mod, "call_mod"); - if (call_mod_fallback) - { - ui_call_mod->setText(tr("Call mod")); - } - else - { - ui_call_mod->set_image("call_mod.png"); - ui_call_mod->setText(tr("")); - } - - set_size_and_pos(ui_settings, "settings"); - if (settings_fallback) - { - ui_settings->setText(tr("Settings")); - } - else - { - ui_settings->set_image("settings.png"); - ui_settings->setText(tr("")); - } - - set_size_and_pos(ui_announce_casing, "casing_button"); - if (casing_fallback) - { - ui_announce_casing->setText(tr("Casing")); - } - else - { - ui_announce_casing->set_image("casing.png"); - ui_announce_casing->setText(tr("")); - } - - set_size_and_pos(ui_switch_area_music, "switch_area_music"); - if (amswap_fallback) - { - ui_switch_area_music->setText(tr("A/M")); - } - else - { - ui_switch_area_music->set_image("amswap.png"); - ui_switch_area_music->setText(tr("")); - } - - set_size_and_pos(ui_pre, "pre"); - ui_pre->setText(tr("Preanim")); - - set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); - set_size_and_pos(ui_flip, "flip"); - - set_size_and_pos(ui_guard, "guard"); - - set_size_and_pos(ui_casing, "casing"); - - set_size_and_pos(ui_showname_enable, "showname_enable"); - - set_size_and_pos(ui_custom_objection, "custom_objection"); - ui_custom_objection->set_image("custom.png"); - - set_size_and_pos(ui_realization, "realization"); - ui_realization->set_image("realization.png"); - - set_size_and_pos(ui_screenshake, "screenshake"); - ui_screenshake->set_image("screenshake.png"); - - set_size_and_pos(ui_mute, "mute_button"); - ui_mute->set_image("mute.png"); - - set_size_and_pos(ui_defense_plus, "defense_plus"); - ui_defense_plus->set_image("defplus.png"); - - set_size_and_pos(ui_defense_minus, "defense_minus"); - ui_defense_minus->set_image("defminus.png"); - - set_size_and_pos(ui_prosecution_plus, "prosecution_plus"); - ui_prosecution_plus->set_image("proplus.png"); - - set_size_and_pos(ui_prosecution_minus, "prosecution_minus"); - ui_prosecution_minus->set_image("prominus.png"); - - set_size_and_pos(ui_text_color, "text_color"); - - set_size_and_pos(ui_music_slider, "music_slider"); - set_size_and_pos(ui_sfx_slider, "sfx_slider"); - set_size_and_pos(ui_blip_slider, "blip_slider"); - - set_size_and_pos(ui_log_limit_spinbox, "log_limit_spinbox"); - - set_size_and_pos(ui_evidence_button, "evidence_button"); - ui_evidence_button->set_image("evidencebutton.png"); - - set_size_and_pos(ui_evidence, "evidence_background"); - ui_evidence->set_image("evidencebackground.png"); - - set_size_and_pos(ui_evidence_name, "evidence_name"); - - set_size_and_pos(ui_evidence_buttons, "evidence_buttons"); - - set_size_and_pos(ui_evidence_left, "evidence_left"); - ui_evidence_left->set_image("arrow_left.png"); - - set_size_and_pos(ui_evidence_right, "evidence_right"); - ui_evidence_right->set_image("arrow_right.png"); - - set_size_and_pos(ui_evidence_present, "evidence_present"); - ui_evidence_present->set_image("present_disabled.png"); - - set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); - ui_evidence_overlay->set_image("evidenceoverlay.png"); - - set_size_and_pos(ui_evidence_delete, "evidence_delete"); - ui_evidence_delete->set_image("deleteevidence.png"); - - set_size_and_pos(ui_evidence_image_name, "evidence_image_name"); - - set_size_and_pos(ui_evidence_image_button, "evidence_image_button"); - - set_size_and_pos(ui_evidence_x, "evidence_x"); - ui_evidence_x->set_image("evidencex.png"); - - set_size_and_pos(ui_evidence_description, "evidence_description"); - - ui_selector->set_image("char_selector.png"); - ui_selector->hide(); - - set_size_and_pos(ui_back_to_lobby, "back_to_lobby"); - ui_back_to_lobby->setText(tr("Back to Lobby")); - - set_size_and_pos(ui_char_password, "char_password"); - - set_size_and_pos(ui_char_buttons, "char_buttons"); - - set_size_and_pos(ui_char_select_left, "char_select_left"); - ui_char_select_left->set_image("arrow_left.png"); - - set_size_and_pos(ui_char_select_right, "char_select_right"); - ui_char_select_right->set_image("arrow_right.png"); - - set_size_and_pos(ui_spectator, "spectator"); -} - -void Courtroom::set_fonts() -{ - set_font(ui_vp_showname, "showname"); - set_font(ui_vp_message, "message"); - set_font(ui_ic_chatlog, "ic_chatlog"); - set_font(ui_ms_chatlog, "ms_chatlog"); - set_font(ui_server_chatlog, "server_chatlog"); - set_font(ui_music_list, "music_list"); + set_size_and_pos(ui_music_list, "music_list"); + + if (is_ao2_bg) { + set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); + set_size_and_pos(ui_vp_chatbox, "ao2_chatbox"); + set_size_and_pos(ui_ic_chat_name, "ao2_ic_chat_name"); + } + else { + set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); + set_size_and_pos(ui_vp_chatbox, "chatbox"); + set_size_and_pos(ui_ic_chat_name, "ic_chat_name"); + } + + ui_ic_chat_message->setStyleSheet( + "QLineEdit{background-color: rgba(100, 100, 100, 255);}"); + ui_ic_chat_name->setStyleSheet( + "QLineEdit{background-color: rgba(180, 180, 180, 255);}"); + + ui_vp_chatbox->set_image("chatmed.png"); + ui_vp_chatbox->hide(); + + ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); + ui_muted->set_image("muted.png"); + + set_size_and_pos(ui_ooc_chat_message, "ooc_chat_message"); + ui_ooc_chat_message->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + + set_size_and_pos(ui_ooc_chat_name, "ooc_chat_name"); + ui_ooc_chat_name->setStyleSheet("background-color: rgba(0, 0, 0, 0);"); + + // set_size_and_pos(ui_area_password, "area_password"); + set_size_and_pos(ui_music_search, "music_search"); + + set_size_and_pos(ui_emotes, "emotes"); + + set_size_and_pos(ui_emote_left, "emote_left"); + ui_emote_left->set_image("arrow_left.png"); + + set_size_and_pos(ui_emote_right, "emote_right"); + ui_emote_right->set_image("arrow_right.png"); + + set_size_and_pos(ui_emote_dropdown, "emote_dropdown"); + set_size_and_pos(ui_pos_dropdown, "pos_dropdown"); + + set_size_and_pos(ui_defense_bar, "defense_bar"); + ui_defense_bar->set_image("defensebar" + QString::number(defense_bar_state) + + ".png"); + + set_size_and_pos(ui_prosecution_bar, "prosecution_bar"); + ui_prosecution_bar->set_image( + "prosecutionbar" + QString::number(prosecution_bar_state) + ".png"); + + set_size_and_pos(ui_music_label, "music_label"); + ui_music_label->setText(tr("Music")); + set_size_and_pos(ui_sfx_label, "sfx_label"); + ui_sfx_label->setText(tr("Sfx")); + set_size_and_pos(ui_blip_label, "blip_label"); + ui_blip_label->setText(tr("Blips")); + + set_size_and_pos(ui_log_limit_label, "log_limit_label"); + ui_log_limit_label->setText(tr("Log limit")); + + set_size_and_pos(ui_hold_it, "hold_it"); + ui_hold_it->set_image("holdit.png"); + set_size_and_pos(ui_objection, "objection"); + ui_objection->set_image("objection.png"); + set_size_and_pos(ui_take_that, "take_that"); + ui_take_that->set_image("takethat.png"); + + set_size_and_pos(ui_ooc_toggle, "ooc_toggle"); + if (ooc_toggle_fallback) { + ui_ooc_toggle->setText(tr("Server")); + } + else { + ui_ooc_toggle->set_image("ooc_toggle_server.png"); + ui_ooc_toggle->setText(tr("")); + } + + set_size_and_pos(ui_witness_testimony, "witness_testimony"); + ui_witness_testimony->set_image("witnesstestimony.png"); + set_size_and_pos(ui_cross_examination, "cross_examination"); + ui_cross_examination->set_image("crossexamination.png"); + + set_size_and_pos(ui_guilty, "guilty"); + ui_guilty->set_image("guilty.png"); + set_size_and_pos(ui_not_guilty, "not_guilty"); + ui_not_guilty->set_image("notguilty.png"); + + set_size_and_pos(ui_change_character, "change_character"); + if (change_char_fallback) { + ui_change_character->setText(tr("Change character")); + } + else { + ui_change_character->set_image("change_character.png"); + ui_change_character->setText( + tr("")); // set text to empty otherwise it just sits there + } + + set_size_and_pos(ui_reload_theme, "reload_theme"); + if (reload_theme_fallback) { + ui_reload_theme->setText(tr("Reload theme")); + } + else { + ui_reload_theme->set_image("reload_theme.png"); + ui_reload_theme->setText(tr("")); + } + + set_size_and_pos(ui_call_mod, "call_mod"); + if (call_mod_fallback) { + ui_call_mod->setText(tr("Call mod")); + } + else { + ui_call_mod->set_image("call_mod.png"); + ui_call_mod->setText(tr("")); + } + + set_size_and_pos(ui_settings, "settings"); + if (settings_fallback) { + ui_settings->setText(tr("Settings")); + } + else { + ui_settings->set_image("settings.png"); + ui_settings->setText(tr("")); + } + + set_size_and_pos(ui_announce_casing, "casing_button"); + if (casing_fallback) { + ui_announce_casing->setText(tr("Casing")); + } + else { + ui_announce_casing->set_image("casing.png"); + ui_announce_casing->setText(tr("")); + } + + set_size_and_pos(ui_switch_area_music, "switch_area_music"); + if (amswap_fallback) { + ui_switch_area_music->setText(tr("A/M")); + } + else { + ui_switch_area_music->set_image("amswap.png"); + ui_switch_area_music->setText(tr("")); + } + + set_size_and_pos(ui_pre, "pre"); + ui_pre->setText(tr("Preanim")); + + set_size_and_pos(ui_pre_non_interrupt, "pre_no_interrupt"); + set_size_and_pos(ui_flip, "flip"); + + set_size_and_pos(ui_guard, "guard"); + + set_size_and_pos(ui_casing, "casing"); + + set_size_and_pos(ui_showname_enable, "showname_enable"); + + set_size_and_pos(ui_custom_objection, "custom_objection"); + ui_custom_objection->set_image("custom.png"); + + set_size_and_pos(ui_realization, "realization"); + ui_realization->set_image("realization.png"); + + set_size_and_pos(ui_screenshake, "screenshake"); + ui_screenshake->set_image("screenshake.png"); + + set_size_and_pos(ui_mute, "mute_button"); + ui_mute->set_image("mute.png"); + + set_size_and_pos(ui_defense_plus, "defense_plus"); + ui_defense_plus->set_image("defplus.png"); + + set_size_and_pos(ui_defense_minus, "defense_minus"); + ui_defense_minus->set_image("defminus.png"); + + set_size_and_pos(ui_prosecution_plus, "prosecution_plus"); + ui_prosecution_plus->set_image("proplus.png"); + + set_size_and_pos(ui_prosecution_minus, "prosecution_minus"); + ui_prosecution_minus->set_image("prominus.png"); + + set_size_and_pos(ui_text_color, "text_color"); + + set_size_and_pos(ui_music_slider, "music_slider"); + set_size_and_pos(ui_sfx_slider, "sfx_slider"); + set_size_and_pos(ui_blip_slider, "blip_slider"); + + set_size_and_pos(ui_log_limit_spinbox, "log_limit_spinbox"); + + set_size_and_pos(ui_evidence_button, "evidence_button"); + ui_evidence_button->set_image("evidencebutton.png"); + + set_size_and_pos(ui_evidence, "evidence_background"); + ui_evidence->set_image("evidencebackground.png"); + + set_size_and_pos(ui_evidence_name, "evidence_name"); + + set_size_and_pos(ui_evidence_buttons, "evidence_buttons"); + + set_size_and_pos(ui_evidence_left, "evidence_left"); + ui_evidence_left->set_image("arrow_left.png"); + + set_size_and_pos(ui_evidence_right, "evidence_right"); + ui_evidence_right->set_image("arrow_right.png"); + + set_size_and_pos(ui_evidence_present, "evidence_present"); + ui_evidence_present->set_image("present_disabled.png"); + + set_size_and_pos(ui_evidence_overlay, "evidence_overlay"); + ui_evidence_overlay->set_image("evidenceoverlay.png"); + + set_size_and_pos(ui_evidence_delete, "evidence_delete"); + ui_evidence_delete->set_image("deleteevidence.png"); + + set_size_and_pos(ui_evidence_image_name, "evidence_image_name"); + + set_size_and_pos(ui_evidence_image_button, "evidence_image_button"); + + set_size_and_pos(ui_evidence_x, "evidence_x"); + ui_evidence_x->set_image("evidencex.png"); + + set_size_and_pos(ui_evidence_description, "evidence_description"); + + ui_selector->set_image("char_selector.png"); + ui_selector->hide(); + + set_size_and_pos(ui_back_to_lobby, "back_to_lobby"); + ui_back_to_lobby->setText(tr("Back to Lobby")); + + set_size_and_pos(ui_char_password, "char_password"); + + set_size_and_pos(ui_char_buttons, "char_buttons"); + + set_size_and_pos(ui_char_select_left, "char_select_left"); + ui_char_select_left->set_image("arrow_left.png"); + + set_size_and_pos(ui_char_select_right, "char_select_right"); + ui_char_select_right->set_image("arrow_right.png"); + + set_size_and_pos(ui_spectator, "spectator"); +} + +void Courtroom::set_fonts() +{ + set_font(ui_vp_showname, "showname"); + set_font(ui_vp_message, "message"); + set_font(ui_ic_chatlog, "ic_chatlog"); + set_font(ui_ms_chatlog, "ms_chatlog"); + set_font(ui_server_chatlog, "server_chatlog"); + set_font(ui_music_list, "music_list"); set_font(ui_area_list, "area_list"); - - // Set color of labels and checkboxes - const QString design_file = "courtroom_fonts.ini"; - QColor f_color = ao_app->get_color("label_color", design_file); - QString color_string = "color: rgba(" + - QString::number(f_color.red()) + ", " + - QString::number(f_color.green()) + ", " + - QString::number(f_color.blue()) + ", 255); }"; - QString style_sheet_string = "QLabel {" + color_string + "}" - "QCheckBox {" + color_string + "}"; - setStyleSheet(style_sheet_string); -} - -void Courtroom::set_font(QWidget *widget, QString p_identifier) -{ - QString design_file = "courtroom_fonts.ini"; - int f_weight = ao_app->get_font_size(p_identifier, design_file); - QString class_name = widget->metaObject()->className(); - - QString fontt = ao_app->get_font_name(p_identifier + "_font", design_file); - widget->setFont(QFont(fontt, f_weight)); - - - QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); - - QString style_sheet_string = class_name + " { background-color: rgba(0, 0, 0, 0);\n" + - "color: rgba(" + - QString::number(f_color.red()) + ", " + - QString::number(f_color.green()) + ", " + - QString::number(f_color.blue()) + ", 255); }"; - - widget->setStyleSheet(style_sheet_string); -} - -void Courtroom::set_window_title(QString p_title) -{ - this->setWindowTitle(p_title); -} - -void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) -{ - QString filename = "courtroom_design.ini"; - - pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); - - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { - qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename; - p_widget->hide(); - } - else - { - p_widget->move(design_ini_result.x, design_ini_result.y); - p_widget->resize(design_ini_result.width, design_ini_result.height); - } -} - -QPoint Courtroom::get_theme_pos(QString p_identifier) -{ - QString filename = "courtroom_design.ini"; - - 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) - { - qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename; - return QPoint(0,0); - } - else - { - return QPoint(design_ini_result.x, design_ini_result.y); - } -} - - -void Courtroom::set_taken(int n_char, bool p_taken) -{ - if (n_char >= char_list.size()) - { - qDebug() << "W: set_taken attempted to set an index bigger than char_list size"; - return; - } - - char_type f_char; - f_char.name = char_list.at(n_char).name; - f_char.description = char_list.at(n_char).description; - f_char.taken = p_taken; - f_char.evidence_string = char_list.at(n_char).evidence_string; - - char_list.replace(n_char, f_char); -} - -void Courtroom::done_received() -{ - m_cid = -1; - - music_player->set_volume(0); - sfx_player->set_volume(0); - objection_player->set_volume(0); - blip_player->set_volume(0); - - set_char_select_page(); - - set_mute_list(); - set_pair_list(); - - set_char_select(); - - show(); - - ui_spectator->show(); -} - -void Courtroom::set_background(QString p_background) -{ + + // Set color of labels and checkboxes + const QString design_file = "courtroom_fonts.ini"; + QColor f_color = ao_app->get_color("label_color", design_file); + QString color_string = "color: rgba(" + QString::number(f_color.red()) + + ", " + QString::number(f_color.green()) + ", " + + QString::number(f_color.blue()) + ", 255); }"; + QString style_sheet_string = "QLabel {" + color_string + + "}" + "QCheckBox {" + + color_string + "}"; + setStyleSheet(style_sheet_string); +} + +void Courtroom::set_font(QWidget *widget, QString p_identifier) +{ + QString design_file = "courtroom_fonts.ini"; + int f_weight = ao_app->get_font_size(p_identifier, design_file); + QString class_name = widget->metaObject()->className(); + + QString fontt = ao_app->get_font_name(p_identifier + "_font", design_file); + widget->setFont(QFont(fontt, f_weight)); + + QColor f_color = ao_app->get_color(p_identifier + "_color", design_file); + + QString style_sheet_string = + class_name + " { background-color: rgba(0, 0, 0, 0);\n" + "color: rgba(" + + QString::number(f_color.red()) + ", " + QString::number(f_color.green()) + + ", " + QString::number(f_color.blue()) + ", 255); }"; + + widget->setStyleSheet(style_sheet_string); +} + +void Courtroom::set_window_title(QString p_title) +{ + this->setWindowTitle(p_title); +} + +void Courtroom::set_size_and_pos(QWidget *p_widget, QString p_identifier) +{ + QString filename = "courtroom_design.ini"; + + pos_size_type design_ini_result = + ao_app->get_element_dimensions(p_identifier, filename); + + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename; + p_widget->hide(); + } + else { + p_widget->move(design_ini_result.x, design_ini_result.y); + p_widget->resize(design_ini_result.width, design_ini_result.height); + } +} + +QPoint Courtroom::get_theme_pos(QString p_identifier) +{ + QString filename = "courtroom_design.ini"; + + 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) { + qDebug() << "W: could not find \"" << p_identifier << "\" in " << filename; + return QPoint(0, 0); + } + else { + return QPoint(design_ini_result.x, design_ini_result.y); + } +} + +void Courtroom::set_taken(int n_char, bool p_taken) +{ + if (n_char >= char_list.size()) { + qDebug() + << "W: set_taken attempted to set an index bigger than char_list size"; + return; + } + + char_type f_char; + f_char.name = char_list.at(n_char).name; + f_char.description = char_list.at(n_char).description; + f_char.taken = p_taken; + f_char.evidence_string = char_list.at(n_char).evidence_string; + + char_list.replace(n_char, f_char); +} + +void Courtroom::done_received() +{ + m_cid = -1; + + music_player->set_volume(0); + sfx_player->set_volume(0); + objection_player->set_volume(0); + blip_player->set_volume(0); + + set_char_select_page(); + + set_mute_list(); + set_pair_list(); + + set_char_select(); + + show(); + + ui_spectator->show(); +} + +void Courtroom::set_background(QString p_background) +{ ui_vp_testimony->stop(); - - current_background = p_background; - - is_ao2_bg = file_exists(ao_app->get_background_path("defensedesk.png")) && - file_exists(ao_app->get_background_path("prosecutiondesk.png")) && - file_exists(ao_app->get_background_path("stand.png")); - - if (is_ao2_bg) - { - set_size_and_pos(ui_vp_chatbox, "ao2_chatbox"); - set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); - } - else - { - set_size_and_pos(ui_vp_chatbox, "chatbox"); - set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); - } -} - -void Courtroom::set_character(int char_id) -{ - m_cid = char_id; - - QString f_char; - - if (m_cid == -1) - { - if (ao_app->is_discord_enabled()) - ao_app->discord->state_spectate(); - f_char = ""; - } - else - { - f_char = ao_app->get_char_name(char_list.at(m_cid).name); - - if (ao_app->is_discord_enabled()) - ao_app->discord->state_character(f_char.toStdString()); - } - - current_char = f_char; - - current_emote_page = 0; - current_emote = 0; - - if (m_cid == -1) - ui_emotes->hide(); - else - ui_emotes->show(); - - set_emote_page(); - set_emote_dropdown(); - - if (ao_app->custom_objection_enabled && - (file_exists(ao_app->get_character_path(current_char, "custom.gif")) || - file_exists(ao_app->get_character_path(current_char, "custom.apng"))) && - file_exists(ao_app->get_character_path(current_char, "custom.wav"))) - ui_custom_objection->show(); - else - ui_custom_objection->hide(); -} - -void Courtroom::enter_courtroom(int p_cid) -{ - this->set_character(p_cid); - - current_evidence_page = 0; - current_evidence = 0; - - set_evidence_page(); - - QString side = ao_app->get_char_side(current_char); - - // We block signals from ui_pos_dropdown to stop on_pos_dropdown_changed from firing here. - // Per the Qt docs, QSignalBlocker only affects the rest of this function, - // so it doesn't stop the dropdown from working once we finish here. - const QSignalBlocker blocker(ui_pos_dropdown); - ui_pos_dropdown->setCurrentText(side); - - if (side == "jud") - { - ui_witness_testimony->show(); - ui_cross_examination->show(); - ui_not_guilty->show(); - ui_guilty->show(); - ui_defense_minus->show(); - ui_defense_plus->show(); - ui_prosecution_minus->show(); - ui_prosecution_plus->show(); - } - else - { - ui_witness_testimony->hide(); - ui_cross_examination->hide(); - ui_guilty->hide(); - ui_not_guilty->hide(); - ui_defense_minus->hide(); - ui_defense_plus->hide(); - ui_prosecution_minus->hide(); - ui_prosecution_plus->hide(); - } - + + current_background = p_background; + + is_ao2_bg = file_exists(ao_app->get_background_path("defensedesk.png")) && + file_exists(ao_app->get_background_path("prosecutiondesk.png")) && + file_exists(ao_app->get_background_path("stand.png")); + + if (is_ao2_bg) { + set_size_and_pos(ui_vp_chatbox, "ao2_chatbox"); + set_size_and_pos(ui_ic_chat_message, "ao2_ic_chat_message"); + } + else { + set_size_and_pos(ui_vp_chatbox, "chatbox"); + set_size_and_pos(ui_ic_chat_message, "ic_chat_message"); + } +} + +void Courtroom::set_character(int char_id) +{ + m_cid = char_id; + + QString f_char; + + if (m_cid == -1) { + if (ao_app->is_discord_enabled()) + ao_app->discord->state_spectate(); + f_char = ""; + } + else { + f_char = ao_app->get_char_name(char_list.at(m_cid).name); + + if (ao_app->is_discord_enabled()) + ao_app->discord->state_character(f_char.toStdString()); + } + + current_char = f_char; + + current_emote_page = 0; + current_emote = 0; + + if (m_cid == -1) + ui_emotes->hide(); + else + ui_emotes->show(); + + set_emote_page(); + set_emote_dropdown(); + + if (ao_app->custom_objection_enabled && + (file_exists(ao_app->get_character_path(current_char, "custom.gif")) || + file_exists(ao_app->get_character_path(current_char, "custom.apng"))) && + file_exists(ao_app->get_character_path(current_char, "custom.wav"))) + ui_custom_objection->show(); + else + ui_custom_objection->hide(); +} + +void Courtroom::enter_courtroom(int p_cid) +{ + this->set_character(p_cid); + current_evidence_page = 0; + current_evidence = 0; + + set_evidence_page(); + + QString side = ao_app->get_char_side(current_char); + + // We block signals from ui_pos_dropdown to stop on_pos_dropdown_changed from + // firing here. Per the Qt docs, QSignalBlocker only affects the rest of this + // function, so it doesn't stop the dropdown from working once we finish here. + const QSignalBlocker blocker(ui_pos_dropdown); + ui_pos_dropdown->setCurrentText(side); + + if (side == "jud") { + + ui_witness_testimony->show(); + ui_cross_examination->show(); + ui_not_guilty->show(); + ui_guilty->show(); + ui_defense_minus->show(); + ui_defense_plus->show(); + ui_prosecution_minus->show(); + ui_prosecution_plus->show(); + } + else { + ui_witness_testimony->hide(); + ui_cross_examination->hide(); + ui_guilty->hide(); + ui_not_guilty->hide(); + ui_defense_minus->hide(); + ui_defense_plus->hide(); + ui_prosecution_minus->hide(); + ui_prosecution_plus->hide(); + } + if (ao_app->custom_objection_enabled && // if setting is enabled (file_exists(ao_app->get_image_suffix( ao_app->get_character_path(current_char, "custom"))) && file_exists(ao_app->get_character_path(current_char, "custom.wav")))) { - ui_custom_objection->show(); + ui_custom_objection->show(); if (dir_exists( ao_app->get_character_path(current_char, "custom_objections"))) { custom_obj_menu->clear(); @@ -1059,69 +1063,69 @@ void Courtroom::enter_courtroom(int p_cid) } } } - else - ui_custom_objection->hide(); - - if (ao_app->flipping_enabled) - ui_flip->show(); - else - ui_flip->hide(); - - if (ao_app->casing_alerts_enabled) - ui_casing->show(); - else - ui_casing->hide(); - - list_music(); - list_areas(); - - music_player->set_volume(ui_music_slider->value()); - sfx_player->set_volume(ui_sfx_slider->value()); - objection_player->set_volume(ui_sfx_slider->value()); - misc_sfx_player->set_volume(ui_sfx_slider->value()); - frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); - pair_frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); - blip_player->set_volume(ui_blip_slider->value()); - + else + ui_custom_objection->hide(); + + if (ao_app->flipping_enabled) + ui_flip->show(); + else + ui_flip->hide(); + + if (ao_app->casing_alerts_enabled) + ui_casing->show(); + else + ui_casing->hide(); + + list_music(); + list_areas(); + + music_player->set_volume(ui_music_slider->value()); + sfx_player->set_volume(ui_sfx_slider->value()); + objection_player->set_volume(ui_sfx_slider->value()); + misc_sfx_player->set_volume(ui_sfx_slider->value()); + frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); + pair_frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); + blip_player->set_volume(ui_blip_slider->value()); + misc_sfx_player->set_volume(ui_sfx_slider->value()); frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); pair_frame_emote_sfx_player->set_volume(ui_sfx_slider->value()); ui_vp_testimony->stop(); - - set_widgets(); - - //ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); - - ui_char_select_background->hide(); - - ui_ic_chat_message->setEnabled(m_cid != -1); - ui_ic_chat_message->setFocus(); -} - -void Courtroom::list_music() -{ - ui_music_list->clear(); - - QString f_file = "courtroom_design.ini"; - - QBrush found_brush(ao_app->get_color("found_song_color", f_file)); - QBrush missing_brush(ao_app->get_color("missing_song_color", f_file)); - - int n_listed_songs = 0; - + + set_widgets(); + + // ui_server_chatlog->setHtml(ui_server_chatlog->toHtml()); + + ui_char_select_background->hide(); + + ui_ic_chat_message->setEnabled(m_cid != -1); + ui_ic_chat_message->setFocus(); +} + +void Courtroom::list_music() +{ + ui_music_list->clear(); + + QString f_file = "courtroom_design.ini"; + + QBrush found_brush(ao_app->get_color("found_song_color", f_file)); + QBrush missing_brush(ao_app->get_color("missing_song_color", f_file)); + + int n_listed_songs = 0; + QTreeWidgetItem *parent = nullptr; for (int n_song = 0; n_song < music_list.size(); ++n_song) { - QString i_song = music_list.at(n_song); + QString i_song = music_list.at(n_song); QString i_song_listname = i_song.left(i_song.lastIndexOf(".")); i_song_listname = i_song_listname.right( i_song_listname.length() - (i_song_listname.lastIndexOf("/") + 1)); - + QTreeWidgetItem *treeItem; if (i_song_listname != i_song && parent != nullptr && i_song.toLower().contains( ui_music_search->text().toLower())) // not a category, parent exists - { + { treeItem = new QTreeWidgetItem(parent); treeItem->setText(0, i_song_listname); treeItem->setText(1, i_song); @@ -1142,620 +1146,666 @@ void Courtroom::list_music() treeItem = new QTreeWidgetItem(ui_music_list); treeItem->setText(0, i_song_listname); treeItem->setText(1, i_song); - - QString song_path = ao_app->get_music_path(i_song); - - if (file_exists(song_path)) + + QString song_path = ao_app->get_music_path(i_song); + + if (file_exists(song_path)) treeItem->setBackground(0, found_brush); - else + else treeItem->setBackground(0, missing_brush); - + if (i_song_listname == i_song) // Not supposed to be a song to begin with - a category? parent = treeItem; - ++n_listed_songs; - } - } + ++n_listed_songs; + } + } ui_music_list->expandAll(); // Needs to somehow remember which categories were // expanded/collapsed if the music list didn't // change since last time -} - -void Courtroom::list_areas() -{ - ui_area_list->clear(); - area_row_to_number.clear(); - - QString f_file = "courtroom_design.ini"; - - QBrush free_brush(ao_app->get_color("area_free_color", f_file)); - QBrush lfp_brush(ao_app->get_color("area_lfp_color", f_file)); - QBrush casing_brush(ao_app->get_color("area_casing_color", f_file)); - QBrush recess_brush(ao_app->get_color("area_recess_color", f_file)); - QBrush rp_brush(ao_app->get_color("area_rp_color", f_file)); - QBrush gaming_brush(ao_app->get_color("area_gaming_color", f_file)); - QBrush locked_brush(ao_app->get_color("area_locked_color", f_file)); - - int n_listed_areas = 0; - - for (int n_area = 0 ; n_area < area_list.size() ; ++n_area) - { - QString i_area = ""; -// i_area.append("["); -// i_area.append(QString::number(n_area)); -// i_area.append("] "); - - i_area.append(area_list.at(n_area)); - - if (ao_app->arup_enabled) - { - i_area.append("\n "); - - i_area.append(arup_statuses.at(n_area)); - i_area.append(" | CM: "); - i_area.append(arup_cms.at(n_area)); - - i_area.append("\n "); - - i_area.append(QString::number(arup_players.at(n_area))); - i_area.append(" users | "); - - i_area.append(arup_locks.at(n_area)); - } - - if (i_area.toLower().contains(ui_music_search->text().toLower())) - { - ui_area_list->addItem(i_area); - area_row_to_number.append(n_area); - - if (ao_app->arup_enabled) - { - // Colouring logic here. - ui_area_list->item(n_listed_areas)->setBackground(free_brush); - if (arup_locks.at(n_area) == "LOCKED") - { - ui_area_list->item(n_listed_areas)->setBackground(locked_brush); - } - else - { - if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") - ui_area_list->item(n_listed_areas)->setBackground(lfp_brush); - else if (arup_statuses.at(n_area) == "CASING") - ui_area_list->item(n_listed_areas)->setBackground(casing_brush); - else if (arup_statuses.at(n_area) == "RECESS") - ui_area_list->item(n_listed_areas)->setBackground(recess_brush); - else if (arup_statuses.at(n_area) == "RP") - ui_area_list->item(n_listed_areas)->setBackground(rp_brush); - else if (arup_statuses.at(n_area) == "GAMING") - ui_area_list->item(n_listed_areas)->setBackground(gaming_brush); - } - } - else - { - ui_area_list->item(n_listed_areas)->setBackground(free_brush); - } - - ++n_listed_areas; - } - } -} - -void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) -{ - ui_ms_chatlog->append_chatmessage(f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name()); -} - -void Courtroom::append_server_chatmessage(QString p_name, QString p_message, QString p_colour) -{ - QString colour = "#000000"; - - if (p_colour == "0") - colour = ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(); - if (p_colour == "1") - colour = ao_app->get_color("ooc_server_color", "courtroom_design.ini").name(); - if(p_message == "Logged in as a moderator.") - { - ui_guard->show(); - append_server_chatmessage("CLIENT", tr("You were granted the Disable Modcalls button."), "1"); - } - +} + +void Courtroom::list_areas() +{ + ui_area_list->clear(); + area_row_to_number.clear(); + + QString f_file = "courtroom_design.ini"; + + QBrush free_brush(ao_app->get_color("area_free_color", f_file)); + QBrush lfp_brush(ao_app->get_color("area_lfp_color", f_file)); + QBrush casing_brush(ao_app->get_color("area_casing_color", f_file)); + QBrush recess_brush(ao_app->get_color("area_recess_color", f_file)); + QBrush rp_brush(ao_app->get_color("area_rp_color", f_file)); + QBrush gaming_brush(ao_app->get_color("area_gaming_color", f_file)); + QBrush locked_brush(ao_app->get_color("area_locked_color", f_file)); + + int n_listed_areas = 0; + + for (int n_area = 0; n_area < area_list.size(); ++n_area) { + QString i_area = ""; + + // i_area.append("["); + // i_area.append(QString::number(n_area)); + // i_area.append("] "); + + i_area.append(area_list.at(n_area)); + + if (ao_app->arup_enabled) { + i_area.append("\n "); + + i_area.append(arup_statuses.at(n_area)); + i_area.append(" | CM: "); + i_area.append(arup_cms.at(n_area)); + + i_area.append("\n "); + + i_area.append(QString::number(arup_players.at(n_area))); + i_area.append(" users | "); + + i_area.append(arup_locks.at(n_area)); + } + + if (i_area.toLower().contains(ui_music_search->text().toLower())) { + ui_area_list->addItem(i_area); + area_row_to_number.append(n_area); + + if (ao_app->arup_enabled) { + // Colouring logic here. + ui_area_list->item(n_listed_areas)->setBackground(free_brush); + if (arup_locks.at(n_area) == "LOCKED") { + ui_area_list->item(n_listed_areas)->setBackground(locked_brush); + } + else { + if (arup_statuses.at(n_area) == "LOOKING-FOR-PLAYERS") + ui_area_list->item(n_listed_areas)->setBackground(lfp_brush); + else if (arup_statuses.at(n_area) == "CASING") + ui_area_list->item(n_listed_areas)->setBackground(casing_brush); + else if (arup_statuses.at(n_area) == "RECESS") + ui_area_list->item(n_listed_areas)->setBackground(recess_brush); + else if (arup_statuses.at(n_area) == "RP") + ui_area_list->item(n_listed_areas)->setBackground(rp_brush); + else if (arup_statuses.at(n_area) == "GAMING") + ui_area_list->item(n_listed_areas)->setBackground(gaming_brush); + } + } + else { + ui_area_list->item(n_listed_areas)->setBackground(free_brush); + } + + ++n_listed_areas; + } + } +} + +void Courtroom::append_ms_chatmessage(QString f_name, QString f_message) +{ + ui_ms_chatlog->append_chatmessage( + f_name, f_message, + ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(), + false); +} + +void Courtroom::append_server_chatmessage(QString p_name, QString p_message, + QString p_colour) +{ + QString colour = "#000000"; + + if (p_colour == "0") + colour = + ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(); + if (p_colour == "1") + + colour = + ao_app->get_color("ooc_server_color", "courtroom_design.ini").name(); + if (p_message == "Logged in as a moderator.") { + ui_guard->show(); + append_server_chatmessage( + "CLIENT", tr("You were granted the Disable Modcalls button."), "1"); + } + ui_server_chatlog->append_chatmessage(p_name, p_message, colour, false); -} - -void Courtroom::detect_fallback_text() -{ - QString change_char_path = ao_app->get_theme_path("change_character.png"); - QString reload_theme_path = ao_app->get_theme_path("reload_theme.png"); - QString settings_path = ao_app->get_theme_path("settings.png"); - QString call_mod_path = ao_app->get_theme_path("call_mod.png"); - QString casing_path = ao_app->get_theme_path("casing.png"); - QString amswap_path = ao_app->get_theme_path("amswap.png"); - QString ooc_toggle_path = ao_app->get_theme_path("ooc_toggle_ms.png"); - - if (file_exists(change_char_path)) {change_char_fallback = false;} - else {change_char_fallback = true;} - if (file_exists(reload_theme_path)) {reload_theme_fallback = false;} - else {reload_theme_fallback = true;} - if (file_exists(settings_path)) {settings_fallback = false;} - else {settings_fallback = true;} - if (file_exists(call_mod_path)) {call_mod_fallback = false;} - else {call_mod_fallback = true;} - if (file_exists(casing_path)) {casing_fallback = false;} - else {casing_fallback = true;} - if (file_exists(amswap_path)) {amswap_fallback = false;} - else {amswap_fallback = true;} - if (file_exists(ooc_toggle_path)) {ooc_toggle_fallback = false;} - else {ooc_toggle_fallback = true;} -} - -class AOFrameThreadingPre : public QRunnable -{ -public: - Courtroom *thisCourtroom; - int my_frameNumber; - AOFrameThreadingPre(Courtroom *my_courtroom, int frameNumber){ - thisCourtroom = my_courtroom; - my_frameNumber = frameNumber; - } - void run() - { - qDebug() << my_frameNumber << " FRAME NUMBER" << " from" << QThread::currentThread(); - QString sfx_to_play = thisCourtroom->ao_app->get_frame_sfx_name(thisCourtroom->current_char, thisCourtroom->ao_app->get_pre_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); - QString screenshake_to_play = thisCourtroom->ao_app->get_screenshake_frame(thisCourtroom->current_char, thisCourtroom->ao_app->get_pre_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); - QString realization_to_play = thisCourtroom->ao_app->get_realization_frame(thisCourtroom->current_char, thisCourtroom->ao_app->get_pre_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); - if(sfx_to_play != "") - { - thisCourtroom->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; - } - if(screenshake_to_play != "") - { - thisCourtroom->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; - } - if(realization_to_play != "") - { - thisCourtroom->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play; - } - } -}; - - -class AOFrameThreading : public QRunnable -{ -public: - Courtroom *thisCourtroom; - int my_frameNumber; - AOFrameThreading(Courtroom *my_courtroom, int frameNumber){ - thisCourtroom = my_courtroom; - my_frameNumber = frameNumber; - } - void run() - { - QString sfx_to_play = thisCourtroom->ao_app->get_frame_sfx_name(thisCourtroom->current_char, thisCourtroom->threading_prefix + thisCourtroom->ao_app->get_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); - QString screenshake_to_play = thisCourtroom->ao_app->get_screenshake_frame(thisCourtroom->current_char, thisCourtroom->threading_prefix + thisCourtroom->ao_app->get_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); - QString realization_to_play = thisCourtroom->ao_app->get_realization_frame(thisCourtroom->current_char, thisCourtroom->threading_prefix + thisCourtroom->ao_app->get_emote(thisCourtroom->current_char, thisCourtroom->current_emote), my_frameNumber); - if(sfx_to_play != "") - { - thisCourtroom->threading_sfx += "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; - } - if(screenshake_to_play != "") - { - thisCourtroom->threading_shake += "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; - } - if(realization_to_play != "") - { - thisCourtroom->threading_flash += "|" + QString::number(my_frameNumber) + "=" + realization_to_play; - } - } -}; - -void Courtroom::on_chat_return_pressed() -{ - if (ui_ic_chat_message->text() == "" || is_muted) - return; - - if ((anim_state < 3 || text_state < 2) && - objection_state == 0) - return; - - //MS# - //deskmod# - //pre-emote# - //character# - //emote# - //message# - //side# - //sfx-name# - //emote_modifier# - //char_id# - //sfx_delay# - //objection_modifier# - //evidence# - //placeholder# - //realization# - //text_color#% - - // Additionally, in our case: - - //showname# - //other_charid# - //self_offset# - //noninterrupting_preanim#% - - QStringList packet_contents; - - QString f_side = ao_app->get_char_side(current_char); - - QString f_desk_mod = "chat"; - - if (ao_app->desk_mod_enabled) - { - f_desk_mod = QString::number(ao_app->get_desk_mod(current_char, current_emote)); - if (f_desk_mod == "-1") - f_desk_mod = "chat"; - } - - packet_contents.append(f_desk_mod); - - packet_contents.append(ao_app->get_pre_emote(current_char, current_emote)); - - packet_contents.append(current_char); - - packet_contents.append(ao_app->get_emote(current_char, current_emote)); - - packet_contents.append(ui_ic_chat_message->text()); - - packet_contents.append(f_side); - - packet_contents.append(ao_app->get_sfx_name(current_char, current_emote)); - - int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote); - - //needed or else legacy won't understand what we're saying +} + +void Courtroom::detect_fallback_text() +{ + QString change_char_path = ao_app->get_theme_path("change_character.png"); + QString reload_theme_path = ao_app->get_theme_path("reload_theme.png"); + QString settings_path = ao_app->get_theme_path("settings.png"); + QString call_mod_path = ao_app->get_theme_path("call_mod.png"); + QString casing_path = ao_app->get_theme_path("casing.png"); + QString amswap_path = ao_app->get_theme_path("amswap.png"); + QString ooc_toggle_path = ao_app->get_theme_path("ooc_toggle_ms.png"); + + if (file_exists(change_char_path)) { + change_char_fallback = false; + } + else { + change_char_fallback = true; + } + if (file_exists(reload_theme_path)) { + reload_theme_fallback = false; + } + else { + reload_theme_fallback = true; + } + if (file_exists(settings_path)) { + settings_fallback = false; + } + else { + settings_fallback = true; + } + if (file_exists(call_mod_path)) { + call_mod_fallback = false; + } + else { + call_mod_fallback = true; + } + if (file_exists(casing_path)) { + casing_fallback = false; + } + else { + casing_fallback = true; + } + if (file_exists(amswap_path)) { + amswap_fallback = false; + } + else { + amswap_fallback = true; + } + if (file_exists(ooc_toggle_path)) { + ooc_toggle_fallback = false; + } + else { + ooc_toggle_fallback = true; + } +} + +class AOFrameThreadingPre : public QRunnable { +public: + Courtroom *thisCourtroom; + int my_frameNumber; + AOFrameThreadingPre(Courtroom *my_courtroom, int frameNumber) + { + thisCourtroom = my_courtroom; + my_frameNumber = frameNumber; + } + void run() + { + qDebug() << my_frameNumber << " FRAME NUMBER" + << " from" << QThread::currentThread(); + QString sfx_to_play = thisCourtroom->ao_app->get_frame_sfx_name( + thisCourtroom->current_char, + thisCourtroom->ao_app->get_pre_emote(thisCourtroom->current_char, + thisCourtroom->current_emote), + my_frameNumber); + QString screenshake_to_play = thisCourtroom->ao_app->get_screenshake_frame( + thisCourtroom->current_char, + thisCourtroom->ao_app->get_pre_emote(thisCourtroom->current_char, + thisCourtroom->current_emote), + my_frameNumber); + QString realization_to_play = thisCourtroom->ao_app->get_realization_frame( + thisCourtroom->current_char, + thisCourtroom->ao_app->get_pre_emote(thisCourtroom->current_char, + thisCourtroom->current_emote), + my_frameNumber); + if (sfx_to_play != "") { + thisCourtroom->threading_sfx += + "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; + } + if (screenshake_to_play != "") { + thisCourtroom->threading_shake += + "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; + } + if (realization_to_play != "") { + thisCourtroom->threading_flash += + "|" + QString::number(my_frameNumber) + "=" + realization_to_play; + } + } +}; + +class AOFrameThreading : public QRunnable { +public: + Courtroom *thisCourtroom; + int my_frameNumber; + AOFrameThreading(Courtroom *my_courtroom, int frameNumber) + { + thisCourtroom = my_courtroom; + my_frameNumber = frameNumber; + } + void run() + { + QString sfx_to_play = thisCourtroom->ao_app->get_frame_sfx_name( + thisCourtroom->current_char, + thisCourtroom->threading_prefix + + thisCourtroom->ao_app->get_emote(thisCourtroom->current_char, + thisCourtroom->current_emote), + my_frameNumber); + QString screenshake_to_play = thisCourtroom->ao_app->get_screenshake_frame( + thisCourtroom->current_char, + thisCourtroom->threading_prefix + + thisCourtroom->ao_app->get_emote(thisCourtroom->current_char, + thisCourtroom->current_emote), + my_frameNumber); + QString realization_to_play = thisCourtroom->ao_app->get_realization_frame( + thisCourtroom->current_char, + thisCourtroom->threading_prefix + + thisCourtroom->ao_app->get_emote(thisCourtroom->current_char, + thisCourtroom->current_emote), + my_frameNumber); + if (sfx_to_play != "") { + thisCourtroom->threading_sfx += + "|" + QString::number(my_frameNumber) + "=" + sfx_to_play; + } + if (screenshake_to_play != "") { + thisCourtroom->threading_shake += + "|" + QString::number(my_frameNumber) + "=" + screenshake_to_play; + } + if (realization_to_play != "") { + thisCourtroom->threading_flash += + "|" + QString::number(my_frameNumber) + "=" + realization_to_play; + } + } +}; + +void Courtroom::on_chat_return_pressed() +{ + if (ui_ic_chat_message->text() == "" || is_muted) + return; + + if ((anim_state < 3 || text_state < 2) && objection_state == 0) + return; + + // MS# + // deskmod# + // pre-emote# + // character# + // emote# + // message# + // side# + // sfx-name# + // emote_modifier# + // char_id# + // sfx_delay# + // objection_modifier# + // evidence# + // placeholder# + // realization# + // text_color#% + + // Additionally, in our case: + + // showname# + // other_charid# + // self_offset# + // noninterrupting_preanim#% + + QStringList packet_contents; + + QString f_side = ao_app->get_char_side(current_char); + + QString f_desk_mod = "chat"; + + if (ao_app->desk_mod_enabled) { + f_desk_mod = + QString::number(ao_app->get_desk_mod(current_char, current_emote)); + if (f_desk_mod == "-1") + f_desk_mod = "chat"; + } + + packet_contents.append(f_desk_mod); + + packet_contents.append(ao_app->get_pre_emote(current_char, current_emote)); + + packet_contents.append(current_char); + + packet_contents.append(ao_app->get_emote(current_char, current_emote)); + + packet_contents.append(ui_ic_chat_message->text()); + + packet_contents.append(f_side); + + packet_contents.append(ao_app->get_sfx_name(current_char, current_emote)); + + int f_emote_mod = ao_app->get_emote_mod(current_char, current_emote); + + // needed or else legacy won't understand what we're saying if (objection_state > 0) { if (ui_pre->isChecked()) { if (f_emote_mod == 5 || f_emote_mod == 4) - f_emote_mod = 6; - else - f_emote_mod = 2; - } - } - else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked()) - { - if (f_emote_mod == 0) - f_emote_mod = 1; - else if (f_emote_mod == 5 && ao_app->prezoom_enabled) - f_emote_mod = 4; - } - else - { - if (f_emote_mod == 1) - f_emote_mod = 0; - else if (f_emote_mod == 4) - f_emote_mod = 5; - } - - packet_contents.append(QString::number(f_emote_mod)); - packet_contents.append(QString::number(m_cid)); - - packet_contents.append(QString::number(ao_app->get_sfx_delay(current_char, current_emote))); - - QString f_obj_state; - - if ((objection_state == 4 && !ao_app->custom_objection_enabled) || - (objection_state < 0)) - f_obj_state = "0"; + f_emote_mod = 6; + else + f_emote_mod = 2; + } + } + else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked()) { + if (f_emote_mod == 0) + f_emote_mod = 1; + else if (f_emote_mod == 5 && ao_app->prezoom_enabled) + f_emote_mod = 4; + } + else { + if (f_emote_mod == 1) + f_emote_mod = 0; + else if (f_emote_mod == 4) + f_emote_mod = 5; + } + + packet_contents.append(QString::number(f_emote_mod)); + packet_contents.append(QString::number(m_cid)); + + packet_contents.append( + QString::number(ao_app->get_sfx_delay(current_char, current_emote))); + + QString f_obj_state; + + if ((objection_state == 4 && !ao_app->custom_objection_enabled) || + (objection_state < 0)) + f_obj_state = "0"; else if (objection_custom != "" && objection_state == 4) { f_obj_state = QString::number(objection_state) + "&" + objection_custom; // we add the name of the objection so the // packet is like: 4&(name of custom obj) } - else - f_obj_state = QString::number(objection_state); - - packet_contents.append(f_obj_state); - - if (is_presenting_evidence) - //the evidence index is shifted by 1 because 0 is no evidence per legacy standards - //besides, older clients crash if we pass -1 - packet_contents.append(QString::number(current_evidence + 1)); - else - packet_contents.append("0"); - - QString f_flip; - - if (ao_app->flipping_enabled) - { - if (ui_flip->isChecked()) - f_flip = "1"; - else - f_flip = "0"; - } - else - f_flip = QString::number(m_cid); - - packet_contents.append(f_flip); - - packet_contents.append(QString::number(realization_state)); - - QString f_text_color; - - if (text_color < 0) - f_text_color = "0"; - else if (text_color > 8) - f_text_color = "0"; - else - f_text_color = QString::number(text_color); - - packet_contents.append(f_text_color); - - // If the server we're on supports CCCC stuff, we should use it! - if (ao_app->cccc_ic_support_enabled) - { - // If there is a showname entered, use that -- else, just send an empty packet-part. - if (!ui_ic_chat_name->text().isEmpty()) - { - packet_contents.append(ui_ic_chat_name->text()); - } - else - { - packet_contents.append(""); - } - - // Similarly, we send over whom we're paired with, unless we have chosen ourselves. - // Or a charid of -1 or lower, through some means. - if (other_charid > -1 && other_charid != m_cid) - { - packet_contents.append(QString::number(other_charid)); - packet_contents.append(QString::number(offset_with_pair)); - } - else - { - packet_contents.append("-1"); - packet_contents.append("0"); - } - - // Finally, we send over if we want our pres to not interrupt. - if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked()) - { - packet_contents.append("1"); - } - else - { - packet_contents.append("0"); - } - } - // If the server we're on supports Looping SFX and Screenshake, use it if the emote uses it. - if (ao_app->looping_sfx_support_enabled) - { - packet_contents.append(ao_app->get_sfx_looping(current_char, current_emote)); - qDebug() << "Are we looping this? " << ao_app->get_sfx_looping(current_char, current_emote); - packet_contents.append(QString::number(screenshake_state)); - qDebug() << "Are we screen shaking this one? " << screenshake_state; - qDebug() << "MAX THREAD COUNT " << QThreadPool::globalInstance()->maxThreadCount(); - QString frame_screenshake = ""; - QString frame_realization = ""; - QString frame_sfx = ""; - - QString preemote_sfx = ""; - QString preemote_shake = ""; - QString preemote_flash = ""; - - QString talkemote_sfx = ""; - QString talkemote_shake = ""; - QString talkemote_flash = ""; - - QString idleemote_sfx = ""; - QString idleemote_shake = ""; - QString idleemote_flash = ""; - - QString preemote = ao_app->get_image_suffix(ao_app->get_character_path(current_char, ao_app->get_pre_emote(current_char, current_emote))); - QString talkemote_to_check = ao_app->get_image_suffix(ao_app->get_character_path(current_char, "(b)" + ao_app->get_emote(current_char, current_emote))); - QString idleemote_to_check = ao_app->get_image_suffix(ao_app->get_character_path(current_char, "(a)" + ao_app->get_emote(current_char, current_emote))); - - frame_emote_checker = new QMovie(this); - frame_emote_checker->setFileName(preemote); - frame_emote_checker->jumpToFrame(0); - qDebug() << "Premote: " << frame_emote_checker->frameCount(); - - preemote_sfx += ao_app->get_pre_emote(current_char, current_emote); - preemote_shake += ao_app->get_pre_emote(current_char, current_emote); - preemote_flash += ao_app->get_pre_emote(current_char, current_emote); - - threading_sfx = preemote_sfx; - threading_shake = preemote_shake; - threading_flash = preemote_flash; - - for(int i=0; i < frame_emote_checker->frameCount(); i++){ + else + f_obj_state = QString::number(objection_state); + packet_contents.append(f_obj_state); + if (is_presenting_evidence) + // the evidence index is shifted by 1 because 0 is no evidence per legacy + // standards besides, older clients crash if we pass -1 + packet_contents.append(QString::number(current_evidence + 1)); + else + packet_contents.append("0"); + + QString f_flip; + + if (ao_app->flipping_enabled) { + if (ui_flip->isChecked()) + f_flip = "1"; + else + f_flip = "0"; + } + else + f_flip = QString::number(m_cid); + + packet_contents.append(f_flip); + + packet_contents.append(QString::number(realization_state)); + + QString f_text_color; + + if (text_color < 0) + f_text_color = "0"; + else if (text_color > 8) + f_text_color = "0"; + else + f_text_color = QString::number(text_color); + + packet_contents.append(f_text_color); + + // If the server we're on supports CCCC stuff, we should use it! + if (ao_app->cccc_ic_support_enabled) { + // If there is a showname entered, use that -- else, just send an empty + // packet-part. + if (!ui_ic_chat_name->text().isEmpty()) { + packet_contents.append(ui_ic_chat_name->text()); + } + else { + packet_contents.append(""); + } + + // Similarly, we send over whom we're paired with, unless we have chosen + // ourselves. Or a charid of -1 or lower, through some means. + if (other_charid > -1 && other_charid != m_cid) { + packet_contents.append(QString::number(other_charid)); + packet_contents.append(QString::number(offset_with_pair)); + } + else { + packet_contents.append("-1"); + packet_contents.append("0"); + } + + // Finally, we send over if we want our pres to not interrupt. + if (ui_pre_non_interrupt->isChecked() && ui_pre->isChecked()) { + packet_contents.append("1"); + } + else { + packet_contents.append("0"); + } + } + // If the server we're on supports Looping SFX and Screenshake, use it if the + // emote uses it. + if (ao_app->looping_sfx_support_enabled) { + packet_contents.append( + ao_app->get_sfx_looping(current_char, current_emote)); + qDebug() << "Are we looping this? " + << ao_app->get_sfx_looping(current_char, current_emote); + packet_contents.append(QString::number(screenshake_state)); + qDebug() << "Are we screen shaking this one? " << screenshake_state; + qDebug() << "MAX THREAD COUNT " + << QThreadPool::globalInstance()->maxThreadCount(); + QString frame_screenshake = ""; + QString frame_realization = ""; + QString frame_sfx = ""; + + QString preemote_sfx = ""; + QString preemote_shake = ""; + QString preemote_flash = ""; + + QString talkemote_sfx = ""; + QString talkemote_shake = ""; + QString talkemote_flash = ""; + + QString idleemote_sfx = ""; + QString idleemote_shake = ""; + QString idleemote_flash = ""; + + QString preemote = ao_app->get_image_suffix(ao_app->get_character_path( + current_char, ao_app->get_pre_emote(current_char, current_emote))); + QString talkemote_to_check = + ao_app->get_image_suffix(ao_app->get_character_path( + current_char, + "(b)" + ao_app->get_emote(current_char, current_emote))); + QString idleemote_to_check = + ao_app->get_image_suffix(ao_app->get_character_path( + current_char, + "(a)" + ao_app->get_emote(current_char, current_emote))); + + frame_emote_checker = new QMovie(this); + frame_emote_checker->setFileName(preemote); + frame_emote_checker->jumpToFrame(0); + qDebug() << "Premote: " << frame_emote_checker->frameCount(); + + preemote_sfx += ao_app->get_pre_emote(current_char, current_emote); + preemote_shake += ao_app->get_pre_emote(current_char, current_emote); + preemote_flash += ao_app->get_pre_emote(current_char, current_emote); + + threading_sfx = preemote_sfx; + threading_shake = preemote_shake; + threading_flash = preemote_flash; + + for (int i = 0; i < frame_emote_checker->frameCount(); i++) { AOFrameThreadingPre *frame_thread = new AOFrameThreadingPre(this, i); QThreadPool::globalInstance()->start(frame_thread); frame_thread->setAutoDelete(true); - } - QThreadPool::globalInstance()->waitForDone(); - preemote_sfx = threading_sfx; - preemote_shake = threading_shake; - preemote_flash = threading_flash; - preemote_sfx += "^"; - preemote_shake += "^"; - preemote_flash += "^"; - delete frame_emote_checker; - - - - talkemote_sfx += "(b)" + ao_app->get_emote(current_char, current_emote); - talkemote_shake += "(b)" + ao_app->get_emote(current_char, current_emote); - talkemote_flash += "(b)" + ao_app->get_emote(current_char, current_emote); - - frame_emote_checker = new QMovie(this); - frame_emote_checker->setFileName(talkemote_to_check); - frame_emote_checker->jumpToFrame(0); - qDebug() << "Talk: " << frame_emote_checker->frameCount(); - - threading_sfx = talkemote_sfx; - threading_shake = talkemote_shake; - threading_flash = talkemote_flash; - threading_prefix = QString("(b)"); - - for(int i=0; i < frame_emote_checker->frameCount(); i++){ + } + QThreadPool::globalInstance()->waitForDone(); + preemote_sfx = threading_sfx; + preemote_shake = threading_shake; + preemote_flash = threading_flash; + preemote_sfx += "^"; + preemote_shake += "^"; + preemote_flash += "^"; + delete frame_emote_checker; + + talkemote_sfx += "(b)" + ao_app->get_emote(current_char, current_emote); + talkemote_shake += "(b)" + ao_app->get_emote(current_char, current_emote); + talkemote_flash += "(b)" + ao_app->get_emote(current_char, current_emote); + + frame_emote_checker = new QMovie(this); + frame_emote_checker->setFileName(talkemote_to_check); + frame_emote_checker->jumpToFrame(0); + qDebug() << "Talk: " << frame_emote_checker->frameCount(); + + threading_sfx = talkemote_sfx; + threading_shake = talkemote_shake; + threading_flash = talkemote_flash; + threading_prefix = QString("(b)"); + + for (int i = 0; i < frame_emote_checker->frameCount(); i++) { AOFrameThreading *frame_thread = new AOFrameThreading(this, i); QThreadPool::globalInstance()->start(frame_thread); frame_thread->setAutoDelete(true); - } - QThreadPool::globalInstance()->waitForDone(); - - talkemote_sfx = threading_sfx; - talkemote_shake = threading_shake; - talkemote_flash = threading_flash; - talkemote_sfx += "^"; - talkemote_shake += "^"; - talkemote_flash += "^"; - delete frame_emote_checker; - - - - idleemote_sfx += "(a)" + ao_app->get_emote(current_char, current_emote); - idleemote_shake += "(a)" + ao_app->get_emote(current_char, current_emote); - idleemote_flash += "(a)" + ao_app->get_emote(current_char, current_emote); - - frame_emote_checker = new QMovie(this); - frame_emote_checker->setFileName(idleemote_to_check); - frame_emote_checker->jumpToFrame(0); - qDebug() << "idle: " << frame_emote_checker->frameCount(); - - threading_sfx = idleemote_sfx; - threading_shake = idleemote_shake; - threading_flash = idleemote_flash; - threading_prefix = QString("(a)"); - for(int i=0; i < frame_emote_checker->frameCount(); i++){ + } + QThreadPool::globalInstance()->waitForDone(); + + talkemote_sfx = threading_sfx; + talkemote_shake = threading_shake; + talkemote_flash = threading_flash; + talkemote_sfx += "^"; + talkemote_shake += "^"; + talkemote_flash += "^"; + delete frame_emote_checker; + + idleemote_sfx += "(a)" + ao_app->get_emote(current_char, current_emote); + idleemote_shake += "(a)" + ao_app->get_emote(current_char, current_emote); + idleemote_flash += "(a)" + ao_app->get_emote(current_char, current_emote); + + frame_emote_checker = new QMovie(this); + frame_emote_checker->setFileName(idleemote_to_check); + frame_emote_checker->jumpToFrame(0); + qDebug() << "idle: " << frame_emote_checker->frameCount(); + + threading_sfx = idleemote_sfx; + threading_shake = idleemote_shake; + threading_flash = idleemote_flash; + threading_prefix = QString("(a)"); + for (int i = 0; i < frame_emote_checker->frameCount(); i++) { AOFrameThreading *frame_thread = new AOFrameThreading(this, i); QThreadPool::globalInstance()->start(frame_thread); frame_thread->setAutoDelete(true); - } - QThreadPool::globalInstance()->waitForDone(); - idleemote_sfx = threading_sfx; - idleemote_shake = threading_shake; - idleemote_flash = threading_flash; - delete frame_emote_checker; - - frame_screenshake += preemote_shake; - frame_screenshake += talkemote_shake; - frame_screenshake += idleemote_shake; - - frame_realization += preemote_flash; - frame_realization += talkemote_flash; - frame_realization += idleemote_flash; - - frame_sfx += preemote_sfx; - frame_sfx += talkemote_sfx; - frame_sfx += idleemote_sfx; - - packet_contents.append(frame_screenshake); - packet_contents.append(frame_realization); - packet_contents.append(frame_sfx); + } + QThreadPool::globalInstance()->waitForDone(); + idleemote_sfx = threading_sfx; + idleemote_shake = threading_shake; + idleemote_flash = threading_flash; + delete frame_emote_checker; + + frame_screenshake += preemote_shake; + frame_screenshake += talkemote_shake; + frame_screenshake += idleemote_shake; + + frame_realization += preemote_flash; + frame_realization += talkemote_flash; + frame_realization += idleemote_flash; + + frame_sfx += preemote_sfx; + frame_sfx += talkemote_sfx; + frame_sfx += idleemote_sfx; + + packet_contents.append(frame_screenshake); + packet_contents.append(frame_realization); + packet_contents.append(frame_sfx); } // Honestly this is a copy paste dump and I have no idea what this does. If // this breaks blame aov thanks - ao_app->send_server_packet(new AOPacket("MS", packet_contents)); -} -void Courtroom::handle_chatmessage(QStringList *p_contents) -{ - // Instead of checking for whether a message has at least chatmessage_size - // amount of packages, we'll check if it has at least 15. - // That was the original chatmessage_size. - if (p_contents->size() < 15) - return; - - for (int n_string = 0 ; n_string < chatmessage_size ; ++n_string) - { - //m_chatmessage[n_string] = p_contents->at(n_string); - - // Note that we have added stuff that vanilla clients and servers simply won't send. - // So now, we have to check if the thing we want even exists amongst the packet's content. - // We also have to check if the server even supports CCCC's IC features, or if it's just japing us. - // Also, don't forget! A size 15 message will have indices from 0 to 14. - if (n_string < p_contents->size() && - (n_string < 15 || ao_app->cccc_ic_support_enabled)) - { - m_chatmessage[n_string] = p_contents->at(n_string); - } - else - { - m_chatmessage[n_string] = ""; - } - } - - int f_char_id = m_chatmessage[CHAR_ID].toInt(); - - if (f_char_id < 0 || f_char_id >= char_list.size()) - return; - - if (mute_map.value(m_chatmessage[CHAR_ID].toInt())) - return; - - QString f_showname; - if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) - { - f_showname = ao_app->get_showname(char_list.at(f_char_id).name); - } - else - { - f_showname = m_chatmessage[SHOWNAME]; - } - - - QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; - - if (f_message == previous_ic_message) - return; - - text_state = 0; - anim_state = 0; - ui_vp_objection->stop(); + ao_app->send_server_packet(new AOPacket("MS", packet_contents)); +} +void Courtroom::handle_chatmessage(QStringList *p_contents) +{ + // Instead of checking for whether a message has at least chatmessage_size + // amount of packages, we'll check if it has at least 15. + // That was the original chatmessage_size. + if (p_contents->size() < 15) + return; + + for (int n_string = 0; n_string < chatmessage_size; ++n_string) { + // m_chatmessage[n_string] = p_contents->at(n_string); + + // Note that we have added stuff that vanilla clients and servers simply + // won't send. So now, we have to check if the thing we want even exists + // amongst the packet's content. We also have to check if the server even + // supports CCCC's IC features, or if it's just japing us. Also, don't + // forget! A size 15 message will have indices from 0 to 14. + if (n_string < p_contents->size() && + (n_string < 15 || ao_app->cccc_ic_support_enabled)) { + m_chatmessage[n_string] = p_contents->at(n_string); + } + else { + m_chatmessage[n_string] = ""; + } + } + + int f_char_id = m_chatmessage[CHAR_ID].toInt(); + + if (f_char_id < 0 || f_char_id >= char_list.size()) + return; + + if (mute_map.value(m_chatmessage[CHAR_ID].toInt())) + return; + + QString f_showname; + if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { + f_showname = ao_app->get_showname(char_list.at(f_char_id).name); + } + else { + f_showname = m_chatmessage[SHOWNAME]; + } + + QString f_message = f_showname + ": " + m_chatmessage[MESSAGE] + '\n'; + + if (f_message == previous_ic_message) + return; + + text_state = 0; + anim_state = 0; + ui_vp_objection->stop(); // ui_vp_player_char->stop(); - chat_tick_timer->stop(); + chat_tick_timer->stop(); if (keep_evidence_display) - ui_vp_evidence_display->reset(); - - chatmessage_is_empty = m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; - - if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && m_chatmessage[CHAR_ID].toInt() == m_cid) - { - ui_ic_chat_message->clear(); - objection_state = 0; + ui_vp_evidence_display->reset(); + + chatmessage_is_empty = + m_chatmessage[MESSAGE] == " " || m_chatmessage[MESSAGE] == ""; + if (m_chatmessage[MESSAGE] == ui_ic_chat_message->text() && + m_chatmessage[CHAR_ID].toInt() == m_cid) { + ui_ic_chat_message->clear(); + objection_state = 0; objection_custom = ""; char_name = m_chatmessage[CHAR_NAME]; - realization_state = 0; - screenshake_state = 0; - is_presenting_evidence = false; - ui_pre->setChecked(false); - ui_hold_it->set_image("holdit.png"); - ui_objection->set_image("objection.png"); - ui_take_that->set_image("takethat.png"); - ui_custom_objection->set_image("custom.png"); - ui_realization->set_image("realization.png"); - ui_screenshake->set_image("screenshake.png"); - ui_evidence_present->set_image("present_disabled.png"); + realization_state = 0; + screenshake_state = 0; + is_presenting_evidence = false; + ui_pre->setChecked(false); + ui_hold_it->set_image("holdit.png"); + ui_objection->set_image("objection.png"); + ui_take_that->set_image("takethat.png"); + ui_custom_objection->set_image("custom.png"); + ui_realization->set_image("realization.png"); ui_screenshake->set_image("screenshake.png"); - } - + ui_evidence_present->set_image("present_disabled.png"); + ui_screenshake->set_image("screenshake.png"); + } + QString tmpmsg = ""; chatlogpiece *temp = new chatlogpiece( ao_app->get_showname(char_list.at(f_char_id).name), f_showname, ": " + m_chatmessage[MESSAGE], false, m_chatmessage[TEXT_COLOR].toInt()); - ic_chatlog_history.append(*temp); - - while(ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) - { - ic_chatlog_history.removeFirst(); - } + ic_chatlog_history.append(*temp); + + while (ic_chatlog_history.size() > log_maximum_blocks && + log_maximum_blocks > 0) { + ic_chatlog_history.removeFirst(); + } refresh_iclog(true); - + if (f_showname == "") f_showname = m_chatmessage[CHAR_NAME]; if (!mirror_iclog) append_ic_text(": " + m_chatmessage[MESSAGE], f_showname, false, true, false, m_chatmessage[TEXT_COLOR].toInt()); - - previous_ic_message = f_message; + + previous_ic_message = f_message; bool ok; int objection_mod = m_chatmessage[OBJECTION_MOD].toInt( &ok, 10); // checks if its a custom obj. @@ -1767,32 +1817,31 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) } QString f_char = char_name; f_char = m_chatmessage[CHAR_NAME]; - QString f_custom_theme = ao_app->get_char_shouts(f_char); + QString f_custom_theme = ao_app->get_char_shouts(f_char); ui_vp_message->clear(); ui_vp_chatbox->hide(); - //if an objection is used - if (objection_mod <= 4 && objection_mod >= 1) - { - switch (objection_mod) - { - case 1: + // if an objection is used + if (objection_mod <= 4 && objection_mod >= 1) { + + switch (objection_mod) { + case 1: ui_vp_objection->play("holdit", f_char, f_custom_theme, shout_stay_time); - objection_player->play("holdit.wav", f_char, f_custom_theme); - break; - case 2: + objection_player->play("holdit.wav", f_char, f_custom_theme); + break; + case 2: ui_vp_objection->play("objection", f_char, f_custom_theme, shout_stay_time); - objection_player->play("objection.wav", f_char, f_custom_theme); - if(ao_app->get_objectmusic()) - music_player->kill_loop(); - break; - case 3: + objection_player->play("objection.wav", f_char, f_custom_theme); + if (ao_app->get_objectmusic()) + music_player->kill_loop(); + break; + case 3: ui_vp_objection->play("takethat", f_char, f_custom_theme, shout_stay_time); - objection_player->play("takethat.wav", f_char, f_custom_theme); - break; - //case 4 is AO2 only - case 4: + objection_player->play("takethat.wav", f_char, f_custom_theme); + break; + // case 4 is AO2 only + case 4: if (custom_objection != "") { ui_vp_objection->play("custom_objections/" + custom_objection, f_char, f_custom_theme, shout_stay_time); @@ -1803,326 +1852,316 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) else { ui_vp_objection->play("custom", f_char, f_custom_theme, shout_stay_time); - objection_player->play("custom.wav", f_char, f_custom_theme); + objection_player->play("custom.wav", f_char, f_custom_theme); } - break; - default: - qDebug() << "W: Logic error in objection switch statement!"; - } - - int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); - - if (emote_mod == 0) - m_chatmessage[EMOTE_MOD] = 1; - } - else - handle_chatmessage_2(); -} - -void Courtroom::objection_done() -{ - handle_chatmessage_2(); -} - -void Courtroom::handle_chatmessage_2() -{ - ui_vp_speedlines->stop(); + break; + default: + qDebug() << "W: Logic error in objection switch statement!"; + } + + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); + + if (emote_mod == 0) + m_chatmessage[EMOTE_MOD] = 1; + } + else { + handle_chatmessage_2(); + } +} + +void Courtroom::objection_done() { handle_chatmessage_2(); } + +void Courtroom::handle_chatmessage_2() +{ + ui_vp_speedlines->stop(); // ui_vp_player_char->stop(); - ui_vp_player_char->frame_sfx_hellstring = m_chatmessage[FRAME_SFX]; + ui_vp_player_char->frame_sfx_hellstring = m_chatmessage[FRAME_SFX]; ui_vp_player_char->frame_realization_hellstring = m_chatmessage[FRAME_REALIZATION]; ui_vp_player_char->frame_screenshake_hellstring = m_chatmessage[FRAME_SCREENSHAKE]; - ui_vp_player_char->use_networked_framehell = true; - if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) - { - QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; - + ui_vp_player_char->use_networked_framehell = true; + if (m_chatmessage[SHOWNAME].isEmpty() || !ui_showname_enable->isChecked()) { + QString real_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; + QString f_showname = ao_app->get_showname(m_chatmessage[CHAR_NAME]); - - ui_vp_showname->setText(f_showname); - } - else - { - ui_vp_showname->setText(m_chatmessage[SHOWNAME]); - } - + + ui_vp_showname->setText(f_showname); + } + + else { + ui_vp_showname->setText(m_chatmessage[SHOWNAME]); + } + QString f_char = m_chatmessage[CHAR_NAME]; QString chatbox = ao_app->get_chat(f_char); - - if (chatbox == "") - ui_vp_chatbox->set_image("chatmed.png"); - else - { - QString chatbox_path; - QString misc_path = ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png"; - // support for 2.4 legacy chatboxes - QString legacy_path = ao_app->get_base_path() + "misc/" + chatbox + ".png"; - if (file_exists(misc_path)) - { - chatbox_path = misc_path; - } - else if (file_exists(legacy_path)) - chatbox_path = legacy_path; - else - { - QString default_chatbox_path = ao_app->get_theme_path("chatmed.png"); - chatbox_path = default_chatbox_path; - } - ui_vp_chatbox->set_image_from_path(chatbox_path); - } - - ui_vp_showname->setStyleSheet("QLabel { color : " + get_text_color("_showname").name() + "; }"); - - set_scene(); - set_text_color(); - - // Check if the message needs to be centered. - QString f_message = m_chatmessage[MESSAGE]; - if (f_message.size() >= 2) - { - if (f_message.startsWith("~~")) - { - message_is_centered = true; - } - else - { - message_is_centered = false; - } - } - else - { - ui_vp_message->setAlignment(Qt::AlignLeft); - } - - - int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); - - if (ao_app->flipping_enabled && m_chatmessage[FLIP].toInt() == 1) - ui_vp_player_char->set_flipped(true); - else - ui_vp_player_char->set_flipped(false); - - QString side = m_chatmessage[SIDE]; + + if (chatbox == "") { + ui_vp_chatbox->set_image("chatmed.png"); + } + else { + QString chatbox_path; + QString misc_path = + ao_app->get_base_path() + "misc/" + chatbox + "/chatbox.png"; + // support for 2.4 legacy chatboxes + QString legacy_path = ao_app->get_base_path() + "misc/" + chatbox + ".png"; + if (file_exists(misc_path)) { + chatbox_path = misc_path; + } + else if (file_exists(legacy_path)) + chatbox_path = legacy_path; + else { + QString default_chatbox_path = ao_app->get_theme_path("chatmed.png"); + chatbox_path = default_chatbox_path; + } + ui_vp_chatbox->set_image_from_path(chatbox_path); + } + + ui_vp_showname->setStyleSheet( + "QLabel { color : " + get_text_color("_showname").name() + "; }"); + + set_scene(); + set_text_color(); + + // Check if the message needs to be centered. + QString f_message = m_chatmessage[MESSAGE]; + if (f_message.size() >= 2) { + if (f_message.startsWith("~~")) { + message_is_centered = true; + } + else { + message_is_centered = false; + } + } + else { + ui_vp_message->setAlignment(Qt::AlignLeft); + } + + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); + + if (ao_app->flipping_enabled && m_chatmessage[FLIP].toInt() == 1) + ui_vp_player_char->set_flipped(true); + else + ui_vp_player_char->set_flipped(false); + + QString side = m_chatmessage[SIDE]; if (side != "wit") ui_vp_testimony->stop(); - - // Making the second character appear. - if (m_chatmessage[OTHER_CHARID].isEmpty()) - { - // If there is no second character, hide 'em, and center the first. - ui_vp_sideplayer_char->hide(); - ui_vp_sideplayer_char->move(0,0); - - ui_vp_player_char->move(0,0); - } - else - { - bool ok; - int got_other_charid = m_chatmessage[OTHER_CHARID].toInt(&ok); - if (ok) - { - if (got_other_charid > -1) - { - // If there is, show them! - ui_vp_sideplayer_char->show(); - - // Depending on where we are, we offset the characters, and reorder their stacking. - if (side == "def") - { - // We also move the character down depending on how far the are to the right. - int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); - int vert_offset = 0; - if (hor_offset > 0) - { - vert_offset = hor_offset / 10; - } - ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100); - - // We do the same with the second character. - int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); - int vert2_offset = 0; - if (hor2_offset > 0) - { - vert2_offset = hor2_offset / 10; - } - ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100); - - // Finally, we reorder them based on who is more to the left. - // The person more to the left is more in the front. - if (hor2_offset >= hor_offset) - { - ui_vp_sideplayer_char->raise(); - ui_vp_player_char->raise(); - } - else - { - ui_vp_player_char->raise(); - ui_vp_sideplayer_char->raise(); - } - ui_vp_desk->raise(); - ui_vp_legacy_desk->raise(); - } - else if (side == "pro") - { - // Almost the same thing happens here, but in reverse. - int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); - int vert_offset = 0; - if (hor_offset < 0) - { - // We don't want to RAISE the char off the floor. - vert_offset = -1 * hor_offset / 10; - } - ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, ui_viewport->height() * vert_offset / 100); - - // We do the same with the second character. - int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); - int vert2_offset = 0; - if (hor2_offset < 0) - { - vert2_offset = -1 * hor2_offset / 10; - } - ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, ui_viewport->height() * vert2_offset / 100); - - // Finally, we reorder them based on who is more to the right. - if (hor2_offset <= hor_offset) - { - ui_vp_sideplayer_char->raise(); - ui_vp_player_char->raise(); - } - else - { - ui_vp_player_char->raise(); - ui_vp_sideplayer_char->raise(); - } - ui_vp_desk->raise(); - ui_vp_legacy_desk->raise(); - } - else - { - // In every other case, the person more to the left is on top. - // These cases also don't move the characters down. - int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); - ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, 0); - - // We do the same with the second character. - int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); - ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, 0); - - // Finally, we reorder them based on who is more to the left. - // The person more to the left is more in the front. - if (hor2_offset >= hor_offset) - { - ui_vp_sideplayer_char->raise(); - ui_vp_player_char->raise(); - } - else - { - ui_vp_player_char->raise(); - ui_vp_sideplayer_char->raise(); - } - ui_vp_desk->raise(); - ui_vp_legacy_desk->raise(); - } - // We should probably also play the other character's idle emote. - if (ao_app->flipping_enabled && m_chatmessage[OTHER_FLIP].toInt() == 1) - ui_vp_sideplayer_char->set_flipped(true); - else - ui_vp_sideplayer_char->set_flipped(false); - ui_vp_sideplayer_char->use_networked_framehell = false; - ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME], m_chatmessage[OTHER_EMOTE]); - } - else - { - // If the server understands other characters, but there - // really is no second character, hide 'em, and center the first. - ui_vp_sideplayer_char->hide(); - ui_vp_sideplayer_char->stop(); - ui_vp_sideplayer_char->move(0,0); - - ui_vp_player_char->move(0,0); - } - } - } - if (m_chatmessage[SCREENSHAKE] == "1") - { - this->doScreenShake(); - } - switch (emote_mod) - { - case 1: case 2: case 6: - play_preanim(false); - break; - case 0: case 5: - if (m_chatmessage[NONINTERRUPTING_PRE].toInt() == 0) - handle_chatmessage_3(); - else - play_preanim(true); - break; - default: - qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); - } -} + + // Making the second character appear. + if (m_chatmessage[OTHER_CHARID].isEmpty()) { + // If there is no second character, hide 'em, and center the first. + ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->move(0, 0); + + ui_vp_player_char->move(0, 0); + } + else { + bool ok; + int got_other_charid = m_chatmessage[OTHER_CHARID].toInt(&ok); + if (ok) { + if (got_other_charid > -1) { + // If there is, show them! + ui_vp_sideplayer_char->show(); + + // Depending on where we are, we offset the characters, and reorder + // their stacking. + if (side == "def") { + + // We also move the character down depending on how far the are to the + // right. + int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); + int vert_offset = 0; + if (hor_offset > 0) { + vert_offset = hor_offset / 10; + } + ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, + ui_viewport->height() * vert_offset / 100); + + // We do the same with the second character. + int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); + int vert2_offset = 0; + if (hor2_offset > 0) { + vert2_offset = hor2_offset / 10; + } + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, + ui_viewport->height() * vert2_offset / + 100); + + // Finally, we reorder them based on who is more to the left. + // The person more to the left is more in the front. + if (hor2_offset >= hor_offset) { + ui_vp_sideplayer_char->raise(); + ui_vp_player_char->raise(); + } + else { + ui_vp_player_char->raise(); + ui_vp_sideplayer_char->raise(); + } + ui_vp_desk->raise(); + ui_vp_legacy_desk->raise(); + } + else if (side == "pro") { + // Almost the same thing happens here, but in reverse. + int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); + int vert_offset = 0; + if (hor_offset < 0) { + // We don't want to RAISE the char off the floor. + vert_offset = -1 * hor_offset / 10; + } + ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, + ui_viewport->height() * vert_offset / 100); + + // We do the same with the second character. + int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); + int vert2_offset = 0; + if (hor2_offset < 0) { + vert2_offset = -1 * hor2_offset / 10; + } + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, + ui_viewport->height() * vert2_offset / + 100); + + // Finally, we reorder them based on who is more to the right. + if (hor2_offset <= hor_offset) { + ui_vp_sideplayer_char->raise(); + ui_vp_player_char->raise(); + } + else { + ui_vp_player_char->raise(); + ui_vp_sideplayer_char->raise(); + } + ui_vp_desk->raise(); + ui_vp_legacy_desk->raise(); + } + else { + // In every other case, the person more to the left is on top. + // These cases also don't move the characters down. + int hor_offset = m_chatmessage[SELF_OFFSET].toInt(); + ui_vp_player_char->move(ui_viewport->width() * hor_offset / 100, 0); + + // We do the same with the second character. + int hor2_offset = m_chatmessage[OTHER_OFFSET].toInt(); + ui_vp_sideplayer_char->move(ui_viewport->width() * hor2_offset / 100, + 0); + + // Finally, we reorder them based on who is more to the left. + // The person more to the left is more in the front. + if (hor2_offset >= hor_offset) { + ui_vp_sideplayer_char->raise(); + ui_vp_player_char->raise(); + } + else { + ui_vp_player_char->raise(); + ui_vp_sideplayer_char->raise(); + } + ui_vp_desk->raise(); + ui_vp_legacy_desk->raise(); + } + // We should probably also play the other character's idle emote. + if (ao_app->flipping_enabled && m_chatmessage[OTHER_FLIP].toInt() == 1) + ui_vp_sideplayer_char->set_flipped(true); + else + ui_vp_sideplayer_char->set_flipped(false); + ui_vp_sideplayer_char->play_idle(m_chatmessage[OTHER_NAME], + m_chatmessage[OTHER_EMOTE]); + ui_vp_sideplayer_char->use_networked_framehell = false; + } + else { + // If the server understands other characters, but there + // really is no second character, hide 'em, and center the first. + ui_vp_sideplayer_char->hide(); + ui_vp_sideplayer_char->stop(); + ui_vp_sideplayer_char->move(0, 0); + + ui_vp_player_char->move(0, 0); + } + } + } + if (m_chatmessage[SCREENSHAKE] == "1") { + this->doScreenShake(); + } + switch (emote_mod) { + case 1: + case 2: + case 6: + play_preanim(false); + break; + case 0: + case 5: + if (m_chatmessage[NONINTERRUPTING_PRE].toInt() == 0) + handle_chatmessage_3(); + else { + + play_preanim(true); + } + break; + default: + qDebug() << "W: invalid emote mod: " << QString::number(emote_mod); + } +} void Courtroom::realization_done() { ui_vp_realization->hide(); } - -void Courtroom::doScreenShake() -{ - if(!ao_app->is_shakeandflash_enabled()) - return; - screenshake_group = new QParallelAnimationGroup; - screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this); - chatbox_screenshake_animation = new QPropertyAnimation(ui_vp_chatbox, "pos", this); - int screen_x = get_theme_pos("viewport").x(); - int screen_y = get_theme_pos("viewport").y(); - QPoint pos_default = QPoint(screen_x, screen_y); - QPoint pos1 = QPoint(screen_x + 3, screen_y + -5); - QPoint pos2 = QPoint(screen_x + 3, screen_y + -5); - QPoint pos3 = QPoint(screen_x + -3, screen_y + 5); - QPoint pos4 = QPoint(screen_x + 3, screen_y + -5); - QPoint pos5 = QPoint(screen_x + -3,screen_y + -5); - - int chatbox_x = get_theme_pos("ao2_chatbox").x(); - int chatbox_y = get_theme_pos("ao2_chatbox").y(); - QPoint chatbox_pos_default = QPoint(chatbox_x, chatbox_y); - QPoint chatbox_pos1 = QPoint(chatbox_x + 3, chatbox_y + -5); - QPoint chatbox_pos2 = QPoint(chatbox_x + 3, chatbox_y + -5); - QPoint chatbox_pos3 = QPoint(chatbox_x + -3, chatbox_y + 5); - QPoint chatbox_pos4 = QPoint(chatbox_x + 3, chatbox_y + -5); - QPoint chatbox_pos5 = QPoint(chatbox_x + -3,chatbox_y + -5); - - screenshake_animation->setDuration(200); - screenshake_animation->setKeyValueAt(0, pos_default); - screenshake_animation->setKeyValueAt(0.1, pos1); - screenshake_animation->setKeyValueAt(0.3, pos2); - screenshake_animation->setKeyValueAt(0.5, pos3); - screenshake_animation->setKeyValueAt(0.7, pos4); - screenshake_animation->setKeyValueAt(0.9, pos5); - screenshake_animation->setEndValue(pos_default); - screenshake_animation->setEasingCurve(QEasingCurve::Linear); - chatbox_screenshake_animation->setDuration(200); - chatbox_screenshake_animation->setKeyValueAt(0, chatbox_pos_default); - chatbox_screenshake_animation->setKeyValueAt(0.1, chatbox_pos3); - chatbox_screenshake_animation->setKeyValueAt(0.3, chatbox_pos5); - chatbox_screenshake_animation->setKeyValueAt(0.5, chatbox_pos2); - chatbox_screenshake_animation->setKeyValueAt(0.7, chatbox_pos1); - chatbox_screenshake_animation->setKeyValueAt(0.9, chatbox_pos4); - chatbox_screenshake_animation->setEndValue(chatbox_pos_default); - chatbox_screenshake_animation->setEasingCurve(QEasingCurve::Linear); - - screenshake_group->addAnimation(screenshake_animation); - screenshake_group->addAnimation(chatbox_screenshake_animation); - screenshake_group->start(QAbstractAnimation::DeletionPolicy::DeleteWhenStopped); -} - -void Courtroom::handle_chatmessage_3() -{ + +void Courtroom::doScreenShake() +{ + if (!ao_app->is_shakeandflash_enabled()) + return; + screenshake_group = new QParallelAnimationGroup; + screenshake_animation = new QPropertyAnimation(ui_viewport, "pos", this); + chatbox_screenshake_animation = + new QPropertyAnimation(ui_vp_chatbox, "pos", this); + int screen_x = get_theme_pos("viewport").x(); + int screen_y = get_theme_pos("viewport").y(); + QPoint pos_default = QPoint(screen_x, screen_y); + QPoint pos1 = QPoint(screen_x + 3, screen_y + -5); + QPoint pos2 = QPoint(screen_x + 3, screen_y + -5); + QPoint pos3 = QPoint(screen_x + -3, screen_y + 5); + QPoint pos4 = QPoint(screen_x + 3, screen_y + -5); + QPoint pos5 = QPoint(screen_x + -3, screen_y + -5); + + int chatbox_x = get_theme_pos("ao2_chatbox").x(); + int chatbox_y = get_theme_pos("ao2_chatbox").y(); + QPoint chatbox_pos_default = QPoint(chatbox_x, chatbox_y); + QPoint chatbox_pos1 = QPoint(chatbox_x + 3, chatbox_y + -5); + QPoint chatbox_pos2 = QPoint(chatbox_x + 3, chatbox_y + -5); + QPoint chatbox_pos3 = QPoint(chatbox_x + -3, chatbox_y + 5); + QPoint chatbox_pos4 = QPoint(chatbox_x + 3, chatbox_y + -5); + QPoint chatbox_pos5 = QPoint(chatbox_x + -3, chatbox_y + -5); + + screenshake_animation->setDuration(200); + screenshake_animation->setKeyValueAt(0, pos_default); + screenshake_animation->setKeyValueAt(0.1, pos1); + screenshake_animation->setKeyValueAt(0.3, pos2); + screenshake_animation->setKeyValueAt(0.5, pos3); + screenshake_animation->setKeyValueAt(0.7, pos4); + screenshake_animation->setKeyValueAt(0.9, pos5); + screenshake_animation->setEndValue(pos_default); + screenshake_animation->setEasingCurve(QEasingCurve::Linear); + chatbox_screenshake_animation->setDuration(200); + chatbox_screenshake_animation->setKeyValueAt(0, chatbox_pos_default); + chatbox_screenshake_animation->setKeyValueAt(0.1, chatbox_pos3); + chatbox_screenshake_animation->setKeyValueAt(0.3, chatbox_pos5); + chatbox_screenshake_animation->setKeyValueAt(0.5, chatbox_pos2); + chatbox_screenshake_animation->setKeyValueAt(0.7, chatbox_pos1); + chatbox_screenshake_animation->setKeyValueAt(0.9, chatbox_pos4); + chatbox_screenshake_animation->setEndValue(chatbox_pos_default); + chatbox_screenshake_animation->setEasingCurve(QEasingCurve::Linear); + + screenshake_group->addAnimation(screenshake_animation); + screenshake_group->addAnimation(chatbox_screenshake_animation); + screenshake_group->start( + QAbstractAnimation::DeletionPolicy::DeleteWhenStopped); +} + +void Courtroom::handle_chatmessage_3() +{ if (!log_goes_downwards && mirror_iclog) ui_ic_chatlog->moveCursor(QTextCursor::Start); else if (mirror_iclog) ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->setTextInteractionFlags(Qt::TextSelectableByMouse); - + if (mirror_iclog) { if (!ui_showname_enable->isChecked() || m_chatmessage[SHOWNAME] == "") { if (first_message_sent && log_goes_downwards) @@ -2150,229 +2189,219 @@ void Courtroom::handle_chatmessage_3() } } start_chat_ticking(); - int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); - QString f_side = m_chatmessage[SIDE]; - - if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size()) - { - //shifted by 1 because 0 is no evidence per legacy standards - QString f_image = local_evidence_list.at(f_evi_id - 1).image; - //def jud and hlp should display the evidence icon on the RIGHT side - bool is_left_side = !(f_side == "def" || f_side == "hlp" || f_side == "jud" || f_side == "jur"); - ui_vp_evidence_display->show_evidence(f_image, is_left_side, ui_sfx_slider->value()); - } - - int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); - - QString side = m_chatmessage[SIDE]; - - if (emote_mod == 5 || - emote_mod == 6) - { - ui_vp_desk->hide(); - ui_vp_legacy_desk->hide(); - - // Since we're zooming, hide the second character, and centre the first. - ui_vp_sideplayer_char->hide(); - ui_vp_player_char->move(0,0); - - if (side == "pro" || - side == "hlp" || - side == "wit") - ui_vp_speedlines->play("prosecution_speedlines"); - else - ui_vp_speedlines->play("defense_speedlines"); - - } - - int f_anim_state = 0; - //BLUE is from an enum in datatypes.h - bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE; - - if (!text_is_blue && text_state == 1) - { - //talking - f_anim_state = 2; - entire_message_is_blue = false; - } - else - { - //idle - f_anim_state = 3; - entire_message_is_blue = true; - } - - if (f_anim_state <= anim_state) - return; - - ui_vp_player_char->stop(); + int f_evi_id = m_chatmessage[EVIDENCE_ID].toInt(); + QString f_side = m_chatmessage[SIDE]; + + if (f_evi_id > 0 && f_evi_id <= local_evidence_list.size()) { + // shifted by 1 because 0 is no evidence per legacy standards + QString f_image = local_evidence_list.at(f_evi_id - 1).image; + // def jud and hlp should display the evidence icon on the RIGHT side + bool is_left_side = !(f_side == "def" || f_side == "hlp" || + f_side == "jud" || f_side == "jur"); + ui_vp_evidence_display->show_evidence(f_image, is_left_side, + ui_sfx_slider->value()); + } + + int emote_mod = m_chatmessage[EMOTE_MOD].toInt(); + + QString side = m_chatmessage[SIDE]; + + if (emote_mod == 5 || emote_mod == 6) { + ui_vp_desk->hide(); + ui_vp_legacy_desk->hide(); + + // Since we're zooming, hide the second character, and centre the first. + ui_vp_sideplayer_char->hide(); + ui_vp_player_char->move(0, 0); + + if (side == "pro" || side == "hlp" || side == "wit") + ui_vp_speedlines->play("prosecution_speedlines"); + else + ui_vp_speedlines->play("defense_speedlines"); + } + + int f_anim_state = 0; + // BLUE is from an enum in datatypes.h + bool text_is_blue = m_chatmessage[TEXT_COLOR].toInt() == BLUE; + + if (!text_is_blue && text_state == 1) { + // talking + f_anim_state = 2; + entire_message_is_blue = false; + } + else { + // idle + f_anim_state = 3; + entire_message_is_blue = true; + } + + if (f_anim_state <= anim_state) + return; + + ui_vp_player_char->stop(); QString f_char = ""; f_char = m_chatmessage[CHAR_NAME]; - QString f_emote = m_chatmessage[EMOTE]; - - if (f_anim_state == 2) { - ui_vp_player_char->play_talking(f_char, f_emote); - anim_state = 2; - } - else - { - ui_vp_player_char->play_idle(f_char, f_emote); - anim_state = 3; - } - - QString f_message = m_chatmessage[MESSAGE]; - QStringList call_words = ao_app->get_call_words(); - - for (QString word : call_words) - { - if (f_message.contains(word, Qt::CaseInsensitive)) - { - modcall_player->play(ao_app->get_sfx("word_call")); - ao_app->alert(this); - - break; - } - } - -} - + QString f_emote = m_chatmessage[EMOTE]; + + if (f_anim_state == 2) { + ui_vp_player_char->play_talking(f_char, f_emote); + anim_state = 2; + } + else { + ui_vp_player_char->play_idle(f_char, f_emote); + anim_state = 3; + } + + QString f_message = m_chatmessage[MESSAGE]; + QStringList call_words = ao_app->get_call_words(); + + for (QString word : call_words) { + if (f_message.contains(word, Qt::CaseInsensitive)) { + modcall_player->play(ao_app->get_sfx("word_call")); + ao_app->alert(this); + + break; + } + } +} + QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, int chat_color) -{ +{ // BMKCOMMENT - // Get rid of centering. + // Get rid of centering. if (p_text.startsWith(": ~~")) { - // Don't forget, the p_text part actually everything after the name! - // Hence why we check for ': ~~'. - - // Let's remove those two tildes, then. - // : _ ~ ~ - // 0 1 2 3 - p_text.remove(2,2); - } - - // Get rid of the inline-colouring. - // I know, I know, excessive code duplication. - // Nobody looks in here, I'm fine. + // Don't forget, the p_text part actually everything after the name! + // Hence why we check for ': ~~'. + + // Let's remove those two tildes, then. + // : _ ~ ~ + // 0 1 2 3 + p_text.remove(2, 2); + } + + // Get rid of the inline-colouring. + // I know, I know, excessive code duplication. + // Nobody looks in here, I'm fine. int trick_check_pos = 1; - bool ic_next_is_not_special = false; - QString f_character = p_text.at(trick_check_pos); - std::stack ic_colour_stack; + bool ic_next_is_not_special = false; + QString f_character = p_text.at(trick_check_pos); + std::stack ic_colour_stack; QString final_text = ": "; bool delay_pop = false; while (trick_check_pos < p_text.size()) { - f_character = p_text.at(trick_check_pos); + f_character = p_text.at(trick_check_pos); if (!skip_filter) { if (f_character == "<") f_character = "<"; else if (f_character == ">") f_character = ">"; } - // Escape character. + // Escape character. if (f_character == "\\" and !ic_next_is_not_special) { - ic_next_is_not_special = true; - p_text.remove(trick_check_pos,1); + ic_next_is_not_special = true; + p_text.remove(trick_check_pos, 1); f_character = ""; if (p_text[trick_check_pos] == 'n') { p_text[trick_check_pos] = ' '; f_character = " "; } - } - - // Text speed modifier. + } + + // Text speed modifier. else if ((f_character == "{" || f_character == "}") && !ic_next_is_not_special) { - p_text.remove(trick_check_pos,1); + p_text.remove(trick_check_pos, 1); f_character = ""; - } + } else if (f_character == "$" and !ic_next_is_not_special) { - p_text.remove(trick_check_pos,1); + p_text.remove(trick_check_pos, 1); f_character = ""; - } + } else if (f_character == "@" and !ic_next_is_not_special) { - p_text.remove(trick_check_pos,1); + p_text.remove(trick_check_pos, 1); f_character = ""; - } - - // Orange inline colourisation. + } + + // Orange inline colourisation. else if (f_character == "|" and !ic_next_is_not_special) { if (!ic_colour_stack.empty()) { if (ic_colour_stack.top() == INLINE_ORANGE) { - ic_colour_stack.pop(); - p_text.remove(trick_check_pos,1); - } + ic_colour_stack.pop(); + p_text.remove(trick_check_pos, 1); + } else { - ic_colour_stack.push(INLINE_ORANGE); - p_text.remove(trick_check_pos,1); - } - } + ic_colour_stack.push(INLINE_ORANGE); + p_text.remove(trick_check_pos, 1); + } + } else { - ic_colour_stack.push(INLINE_ORANGE); - p_text.remove(trick_check_pos,1); - } + ic_colour_stack.push(INLINE_ORANGE); + p_text.remove(trick_check_pos, 1); + } f_character = ""; - } - - // Blue inline colourisation. + } + + // Blue inline colourisation. else if (f_character == "(" and !ic_next_is_not_special) { - ic_colour_stack.push(INLINE_BLUE); + ic_colour_stack.push(INLINE_BLUE); if (!colorf_iclog) - trick_check_pos++; - } + trick_check_pos++; + } else if (f_character == ")" and !ic_next_is_not_special and !ic_colour_stack.empty()) { if (ic_colour_stack.top() == INLINE_BLUE) { // ic_colour_stack.pop(); delay_pop = true; if (!colorf_iclog) - trick_check_pos++; - } + trick_check_pos++; + } else { - ic_next_is_not_special = true; - } - } - - // Grey inline colourisation. + ic_next_is_not_special = true; + } + } + + // Grey inline colourisation. else if (f_character == "[" and !ic_next_is_not_special) { - ic_colour_stack.push(INLINE_GREY); + ic_colour_stack.push(INLINE_GREY); if (!colorf_iclog) - trick_check_pos++; - } + trick_check_pos++; + } else if (f_character == "]" and !ic_next_is_not_special and !ic_colour_stack.empty()) { if (ic_colour_stack.top() == INLINE_GREY) { // ic_colour_stack.pop(); delay_pop = true; if (!colorf_iclog) - trick_check_pos++; - } + trick_check_pos++; + } else { - ic_next_is_not_special = true; - } - } - - // Green inline colourisation. + ic_next_is_not_special = true; + } + } + + // Green inline colourisation. else if (f_character == "`" and !ic_next_is_not_special) { if (!ic_colour_stack.empty()) { if (ic_colour_stack.top() == INLINE_GREEN) { - ic_colour_stack.pop(); - p_text.remove(trick_check_pos,1); - } + ic_colour_stack.pop(); + p_text.remove(trick_check_pos, 1); + } else { - ic_colour_stack.push(INLINE_GREEN); - p_text.remove(trick_check_pos,1); - } - } + ic_colour_stack.push(INLINE_GREEN); + p_text.remove(trick_check_pos, 1); + } + } else { - ic_colour_stack.push(INLINE_GREEN); - p_text.remove(trick_check_pos,1); - } + ic_colour_stack.push(INLINE_GREEN); + p_text.remove(trick_check_pos, 1); + } f_character = ""; - } + } if (colorf_iclog && f_character != "") { - ic_next_is_not_special = false; + ic_next_is_not_special = false; if (!ic_colour_stack.empty()) { // p_text.remove(trick_check_pos,1); trick_check_pos++; @@ -2467,14 +2496,14 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, } else if (f_character != "") { trick_check_pos++; - } - } - + } + } + if (colorf_iclog) return final_text; else { - return p_text; -} + return p_text; + } } /* * Appends text to the ic log. @@ -2486,29 +2515,29 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, * skip_filter If we are sending appending text such as html so we skip the * filter \param chat_color The color of the message sent */ - + void Courtroom::append_ic_text(QString p_text, QString p_name, bool is_songchange, bool force_filter, bool skip_filter, int chat_color) -{ +{ + + QTextCharFormat bold; + QTextCharFormat normal; + QTextCharFormat italics; + bold.setFontWeight(QFont::Bold); + normal.setFontWeight(QFont::Normal); + italics.setFontItalic(true); + const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); + const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); - QTextCharFormat bold; - QTextCharFormat normal; - QTextCharFormat italics; - bold.setFontWeight(QFont::Bold); - normal.setFontWeight(QFont::Normal); - italics.setFontItalic(true); - const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); - const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); - if ((!is_songchange && !mirror_iclog) || force_filter) p_text = filter_ic_text(p_text, skip_filter, chat_color); - + if (log_goes_downwards) { const bool is_scrolled_down = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->maximum(); - - ui_ic_chatlog->moveCursor(QTextCursor::End); + + ui_ic_chatlog->moveCursor(QTextCursor::End); if (!(is_songchange && mirror_iclog)) { // The only case where no new log entry should be made is when there is a // music entry while mirror log is active This is to protect the log, as @@ -2517,63 +2546,63 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, // If the first message hasn't been sent, and we are handling basic // text, we put the name without the newline. - if (!first_message_sent) - ui_ic_chatlog->textCursor().insertText(p_name, bold); + if (!first_message_sent) + ui_ic_chatlog->textCursor().insertText(p_name, bold); else if (force_filter || is_songchange || !mirror_iclog) { // Otherwise we just add the plaintext with the new line. - ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); - } + ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); + } first_message_sent = true; - + if (is_songchange) { // If its a song with mirror mode enabled, we do not need to repeat it // as it is already shown in the ooc. - ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); - } + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + ".", italics); + } else if (colorf_iclog && (!mirror_iclog || force_filter)) { // if we are handling already formatted text and we have enabled colors // in the iclog, then we insert the text ui_ic_chatlog->textCursor().insertHtml(p_text); - } - + } + else if ((!colorf_iclog && !mirror_iclog) || force_filter) { // If html is not enabled then we insert it as plain text. ui_ic_chatlog->textCursor().insertText(p_text, normal); } } - // If we got too many blocks in the current log, delete some from the top. + // If we got too many blocks in the current log, delete some from the top. while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { - ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deleteChar(); + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deleteChar(); // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << // log_maximum_blocks; - } - + } + if (old_cursor.hasSelection() || !is_scrolled_down) { // The user has selected text or scrolled away from the bottom: maintain // position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } else { // The user hasn't selected any text and the scrollbar is at the bottom: // scroll to the bottom. - ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->verticalScrollBar()->setValue( ui_ic_chatlog->verticalScrollBar()->maximum()); - } - } + } + } else { const bool is_scrolled_up = old_scrollbar_value == ui_ic_chatlog->verticalScrollBar()->minimum(); - - ui_ic_chatlog->moveCursor(QTextCursor::Start); + + ui_ic_chatlog->moveCursor(QTextCursor::Start); if (!(is_songchange && mirror_iclog)) { // The only case where no new log entry should be made is when there is a // music entry while mirror log is active This is to protect the log, as @@ -2591,15 +2620,15 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, if (!first_message_sent) first_message_sent = true; - - ui_ic_chatlog->textCursor().insertText(p_name, bold); + + ui_ic_chatlog->textCursor().insertText(p_name, bold); } - + if (is_songchange) { - ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); - } - + ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); + ui_ic_chatlog->textCursor().insertText(p_text + "." + '\n', italics); + } + else if (colorf_iclog && (!mirror_iclog || force_filter)) { ui_ic_chatlog->textCursor().insertHtml(p_text); } @@ -2613,174 +2642,174 @@ void Courtroom::append_ic_text(QString p_text, QString p_name, // bottom. while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { - ui_ic_chatlog->moveCursor(QTextCursor::End); - ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); - ui_ic_chatlog->textCursor().removeSelectedText(); - ui_ic_chatlog->textCursor().deletePreviousChar(); + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); + ui_ic_chatlog->textCursor().removeSelectedText(); + ui_ic_chatlog->textCursor().deletePreviousChar(); // qDebug() << ui_ic_chatlog->document()->blockCount() << " < " << // log_maximum_blocks; - } - + } + if (old_cursor.hasSelection() || !is_scrolled_up) { // The user has selected text or scrolled away from the top: maintain // position. - ui_ic_chatlog->setTextCursor(old_cursor); - ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); - } + ui_ic_chatlog->setTextCursor(old_cursor); + ui_ic_chatlog->verticalScrollBar()->setValue(old_scrollbar_value); + } else { // The user hasn't selected any text and the scrollbar is at the top: // scroll to the top. - ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->verticalScrollBar()->setValue( ui_ic_chatlog->verticalScrollBar()->minimum()); - } - } -} - -void Courtroom::play_preanim(bool noninterrupting) -{ - QString f_char = m_chatmessage[CHAR_NAME]; - QString f_preanim = m_chatmessage[PRE_EMOTE]; - - //all time values in char.inis are multiplied by a constant(time_mod) to get the actual time - int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim); - int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod; - int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60; - bool looping_sfx = m_chatmessage[LOOPING_SFX] == "1"; - int preanim_duration; - - if (ao2_duration < 0) - preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); - else - preanim_duration = ao2_duration; - sfx_player->setLooping(looping_sfx); - sfx_delay_timer->start(sfx_delay); - QString anim_to_find = ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); - if (!file_exists(anim_to_find) || - preanim_duration < 0) - { - if (noninterrupting) - anim_state = 4; - else - anim_state = 1; - preanim_done(); - qDebug() << "could not find " + anim_to_find; - return; - } - - ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); - if (noninterrupting) - anim_state = 4; - else - anim_state = 1; - - if (text_delay >= 0) - text_delay_timer->start(text_delay); - - if (noninterrupting) - handle_chatmessage_3(); -} - -void Courtroom::preanim_done() -{ - anim_state = 1; - handle_chatmessage_3(); -} - -void Courtroom::doRealization() -{ + } + } +} + +void Courtroom::play_preanim(bool noninterrupting) +{ + QString f_char = m_chatmessage[CHAR_NAME]; + QString f_preanim = m_chatmessage[PRE_EMOTE]; + + // all time values in char.inis are multiplied by a constant(time_mod) to get + // the actual time + int ao2_duration = ao_app->get_ao2_preanim_duration(f_char, f_preanim); + int text_delay = ao_app->get_text_delay(f_char, f_preanim) * time_mod; + int sfx_delay = m_chatmessage[SFX_DELAY].toInt() * 60; + bool looping_sfx = m_chatmessage[LOOPING_SFX] == "1"; + int preanim_duration; + + if (ao2_duration < 0) + preanim_duration = ao_app->get_preanim_duration(f_char, f_preanim); + else + preanim_duration = ao2_duration; + sfx_player->setLooping(looping_sfx); + sfx_delay_timer->start(sfx_delay); + QString anim_to_find = + ao_app->get_image_suffix(ao_app->get_character_path(f_char, f_preanim)); + if (!file_exists(anim_to_find) || preanim_duration < 0) { + if (noninterrupting) + anim_state = 4; + else + anim_state = 1; + preanim_done(); + qDebug() << "could not find " + anim_to_find; + return; + } + + ui_vp_player_char->play_pre(f_char, f_preanim, preanim_duration); + if (noninterrupting) + anim_state = 4; + else + anim_state = 1; + + if (text_delay >= 0) + text_delay_timer->start(text_delay); + + if (noninterrupting) + handle_chatmessage_3(); +} + +void Courtroom::preanim_done() +{ + anim_state = 1; + handle_chatmessage_3(); +} + +void Courtroom::doRealization() +{ realization_timer->stop(); - if(!ao_app->is_shakeandflash_enabled()) - return; + if (!ao_app->is_shakeandflash_enabled()) + return; ui_vp_realization->play("realizationflash", "", "", 90); -} - -void Courtroom::start_chat_ticking() -{ - //we need to ensure that the text isn't already ticking because this function can be called by two logic paths - if (text_state != 0) - return; - - if (m_chatmessage[REALIZATION] == "1") - { - this->doRealization(); - misc_sfx_player->play(ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); - } - if (m_chatmessage[SCREENSHAKE] == "1") - { - this->doScreenShake(); - } - ui_vp_message->clear(); - set_text_color(); - rainbow_counter = 0; - - if (chatmessage_is_empty) - { - //since the message is empty, it's technically done ticking - text_state = 2; - return; - } - - // At this point, we'd do well to clear the inline colour stack. - // This stops it from flowing into next messages. - while (!inline_colour_stack.empty()) - { - inline_colour_stack.pop(); - } - - ui_vp_chatbox->show(); - - tick_pos = 0; - blip_pos = 0; - - // Just in case we somehow got inline blue text left over from a previous message, - // let's set it to false. - inline_blue_depth = 0; - - // At the start of every new message, we set the text speed to the default. - current_display_speed = 3; - chat_tick_timer->start(message_display_speed[current_display_speed]); - +} + +void Courtroom::start_chat_ticking() +{ + // we need to ensure that the text isn't already ticking because this function + // can be called by two logic paths + if (text_state != 0) + return; + + if (m_chatmessage[REALIZATION] == "1") { + this->doRealization(); + misc_sfx_player->play( + ao_app->get_custom_realization(m_chatmessage[CHAR_NAME])); + } + if (m_chatmessage[SCREENSHAKE] == "1") { + this->doScreenShake(); + } + if (m_chatmessage[SCREENSHAKE] == "1") { + this->doScreenShake(); + } + ui_vp_message->clear(); + set_text_color(); + rainbow_counter = 0; + + if (chatmessage_is_empty) { + // since the message is empty, it's technically done ticking + text_state = 2; + return; + } + + // At this point, we'd do well to clear the inline colour stack. + // This stops it from flowing into next messages. + while (!inline_colour_stack.empty()) { + inline_colour_stack.pop(); + } + + ui_vp_chatbox->show(); + + tick_pos = 0; + blip_pos = 0; + + // Just in case we somehow got inline blue text left over from a previous + // message, let's set it to false. + inline_blue_depth = 0; + + // At the start of every new message, we set the text speed to the default. + current_display_speed = 3; + chat_tick_timer->start(message_display_speed[current_display_speed]); + QString f_char = m_chatmessage[CHAR_NAME]; QString f_gender = ao_app->get_gender(f_char); - - blip_player->set_blips(ao_app->get_sfx_suffix("sfx-blip" + f_gender)); - - //means text is currently ticking - text_state = 1; -} - -void Courtroom::chat_tick() -{ - //note: this is called fairly often(every 60 ms when char is talking) - //do not perform heavy operations here + + blip_player->set_blips(ao_app->get_sfx_suffix("sfx-blip" + f_gender)); + + // means text is currently ticking + text_state = 1; +} + +void Courtroom::chat_tick() +{ + // note: this is called fairly often(every 60 ms when char is talking) + // do not perform heavy operations here QString timem = QString::number(realization_timer->remainingTime()); qDebug() << "TIME: " << timem; - QString f_message = m_chatmessage[MESSAGE]; - + QString f_message = m_chatmessage[MESSAGE]; + // f_message.remove(0, tick_pos); SAFECHECK - // Due to our new text speed system, we always need to stop the timer now. - chat_tick_timer->stop(); + // Due to our new text speed system, we always need to stop the timer now. + chat_tick_timer->stop(); int msg_delay = message_display_speed[current_display_speed]; - // Stops blips from playing when we have a formatting option. - bool formatting_char = false; - - // If previously, we have detected that the message is centered, now - // is the time to remove those two tildes at the start. - if (message_is_centered) - { - f_message.remove(0,2); - } + // Stops blips from playing when we have a formatting option. + bool formatting_char = false; + + // If previously, we have detected that the message is centered, now + // is the time to remove those two tildes at the start. + if (message_is_centered) { + f_message.remove(0, 2); + } QString f_char = m_chatmessage[CHAR_NAME]; if (log_goes_downwards && mirror_iclog) ui_ic_chatlog->moveCursor(QTextCursor::End); else if (!log_goes_downwards && mirror_iclog) // ui_ic_chatlog->setTextCursor(); ui_ic_chatlog->moveCursor(QTextCursor::EndOfLine); - + if (tick_pos >= f_message.size()) { - text_state = 2; + text_state = 2; if (mirror_iclog) { // After we are finished printing the text we log it in the ic log. append_ic_text(m_chatmessage[MESSAGE], m_chatmessage[CHAR_NAME], false); @@ -2790,22 +2819,22 @@ void Courtroom::chat_tick() ui_ic_chatlog->moveCursor(QTextCursor::Start); } if (anim_state != 4) { - anim_state = 3; + anim_state = 3; ui_vp_player_char->play_idle(f_char, m_chatmessage[EMOTE]); - } - } - - else { - QString f_character = f_message.at(tick_pos); + } + } - f_character = f_character.toHtmlEscaped(); + else { + QString f_character = f_message.at(tick_pos); + + f_character = f_character.toHtmlEscaped(); if (punctuation_chars.contains(f_character)) { msg_delay *= punctuation_modifier; // ui_vp_message->insertPlainText(f_character); } - + if (f_character == " ") { - ui_vp_message->insertPlainText(" "); + ui_vp_message->insertPlainText(" "); if (mirror_iclog) ui_ic_chatlog->insertPlainText(" "); } @@ -2813,13 +2842,13 @@ void Courtroom::chat_tick() this->doScreenShake(); formatting_char = true; } - + else if (f_character == "^" and !next_character_is_not_special) { this->doRealization(); formatting_char = true; } - // Escape character. + // Escape character. else if (f_character == "\\") { if (f_message[tick_pos + 1] == 'n') { ui_vp_message->insertHtml("
"); @@ -2830,56 +2859,56 @@ void Courtroom::chat_tick() formatting_char = true; } else - next_character_is_not_special = true; - formatting_char = true; + next_character_is_not_special = true; + formatting_char = true; msg_delay++; - } - - // Text speed modifier. + } + + // Text speed modifier. else if (f_character == "{" and !next_character_is_not_special) { - // ++, because it INCREASES delay! - current_display_speed++; + // ++, because it INCREASES delay! + current_display_speed++; msg_delay++; - formatting_char = true; - } + formatting_char = true; + } else if (f_character == "}" and !next_character_is_not_special) { - current_display_speed--; + current_display_speed--; msg_delay++; - formatting_char = true; - } - + formatting_char = true; + } + else if (f_character == "@" and !next_character_is_not_special) { - this->doScreenShake(); - formatting_char = true; - } - + this->doScreenShake(); + formatting_char = true; + } + else if (f_character == "$" and !next_character_is_not_special) { - this->doRealization(); - formatting_char = true; - } - - // Orange inline colourisation. + this->doRealization(); + formatting_char = true; + } + + // Orange inline colourisation. else if (f_character == "|" and !next_character_is_not_special) { if (!inline_colour_stack.empty()) { if (inline_colour_stack.top() == INLINE_ORANGE) { - inline_colour_stack.pop(); - } + inline_colour_stack.pop(); + } else { - inline_colour_stack.push(INLINE_ORANGE); - } - } + inline_colour_stack.push(INLINE_ORANGE); + } + } else { - inline_colour_stack.push(INLINE_ORANGE); - } - formatting_char = true; + inline_colour_stack.push(INLINE_ORANGE); + } + formatting_char = true; msg_delay++; - } - - // Blue inline colourisation. + } + + // Blue inline colourisation. else if (f_character == "(" and !next_character_is_not_special) // EXAMPLE HERE - { - inline_colour_stack.push(INLINE_BLUE); + { + inline_colour_stack.push(INLINE_BLUE); ui_vp_message->insertHtml("" + f_character + ""); @@ -2887,21 +2916,21 @@ void Courtroom::chat_tick() ui_ic_chatlog->insertHtml("" + f_character + ""); - // Increase how deep we are in inline blues. - inline_blue_depth++; - - // Here, we check if the entire message is blue. - // If it isn't, we stop talking. + // Increase how deep we are in inline blues. + inline_blue_depth++; + + // Here, we check if the entire message is blue. + // If it isn't, we stop talking. if (!entire_message_is_blue and anim_state != 4) { f_char = m_chatmessage[CHAR_NAME]; - QString f_emote = m_chatmessage[EMOTE]; - ui_vp_player_char->play_idle(f_char, f_emote); - } - } + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_idle(f_char, f_emote); + } + } else if (f_character == ")" and !next_character_is_not_special and !inline_colour_stack.empty()) { if (inline_colour_stack.top() == INLINE_BLUE) { - inline_colour_stack.pop(); + inline_colour_stack.pop(); ui_vp_message->insertHtml("" + f_character + ""); @@ -2909,11 +2938,11 @@ void Courtroom::chat_tick() ui_ic_chatlog->insertHtml( "" + f_character + ""); - // Decrease how deep we are in inline blues. - // Just in case, we do a check if we're above zero, but we should be. + // Decrease how deep we are in inline blues. + // Just in case, we do a check if we're above zero, but we should be. if (inline_blue_depth > 0) { - inline_blue_depth--; - // Here, we check if the entire message is blue. + inline_blue_depth--; + // Here, we check if the entire message is blue. // If it isn't, we start talking if we have completely climbed out of // inline blues. if (!entire_message_is_blue) { @@ -2923,21 +2952,21 @@ void Courtroom::chat_tick() !(tick_pos + 1 >= f_message.size())) { QString f_char = char_name; f_char = m_chatmessage[CHAR_NAME]; - QString f_emote = m_chatmessage[EMOTE]; - ui_vp_player_char->play_talking(f_char, f_emote); - } - } - } - } + QString f_emote = m_chatmessage[EMOTE]; + ui_vp_player_char->play_talking(f_char, f_emote); + } + } + } + } else { - next_character_is_not_special = true; - tick_pos--; - } - } - - // Grey inline colourisation. + next_character_is_not_special = true; + tick_pos--; + } + } + + // Grey inline colourisation. else if (f_character == "[" and !next_character_is_not_special) { - inline_colour_stack.push(INLINE_GREY); + inline_colour_stack.push(INLINE_GREY); ui_vp_message->insertHtml("" + f_character + ""); @@ -2949,7 +2978,7 @@ void Courtroom::chat_tick() else if (f_character == "]" and !next_character_is_not_special and !inline_colour_stack.empty()) { if (inline_colour_stack.top() == INLINE_GREY) { - inline_colour_stack.pop(); + inline_colour_stack.pop(); ui_vp_message->insertHtml("" + f_character + ""); @@ -2959,33 +2988,33 @@ void Courtroom::chat_tick() "\">" + f_character + ""); } else { - next_character_is_not_special = true; - tick_pos--; - } - } - - // Green inline colourisation. + next_character_is_not_special = true; + tick_pos--; + } + } + + // Green inline colourisation. else if (f_character == "`" and !next_character_is_not_special) { if (!inline_colour_stack.empty()) { if (inline_colour_stack.top() == INLINE_GREEN) { - inline_colour_stack.pop(); - } + inline_colour_stack.pop(); + } else { - inline_colour_stack.push(INLINE_GREEN); - } - } + inline_colour_stack.push(INLINE_GREEN); + } + } else { - inline_colour_stack.push(INLINE_GREEN); - } + inline_colour_stack.push(INLINE_GREEN); + } msg_delay++; formatting_char = true; - } + } else { - next_character_is_not_special = false; + next_character_is_not_special = false; if (!inline_colour_stack.empty()) { - switch (inline_colour_stack.top()) { - case INLINE_ORANGE: + switch (inline_colour_stack.top()) { + case INLINE_ORANGE: ui_vp_message->insertHtml( "" + @@ -2995,8 +3024,8 @@ void Courtroom::chat_tick() "" + f_character + ""); - break; - case INLINE_BLUE: + break; + case INLINE_BLUE: ui_vp_message->insertHtml( "" + f_character + ""); @@ -3005,8 +3034,8 @@ void Courtroom::chat_tick() "" + f_character + ""); - break; - case INLINE_GREEN: + break; + case INLINE_GREEN: ui_vp_message->insertHtml( "" + f_character + ""); @@ -3015,8 +3044,8 @@ void Courtroom::chat_tick() "" + f_character + ""); - break; - case INLINE_GREY: + break; + case INLINE_GREY: ui_vp_message->insertHtml("" + f_character + ""); @@ -3024,33 +3053,33 @@ void Courtroom::chat_tick() ui_ic_chatlog->insertHtml("" + f_character + ""); - break; - } - } + break; + } + } else { if (m_chatmessage[TEXT_COLOR].toInt() == RAINBOW) { - QString html_color; - + QString html_color; + switch (rainbow_counter) { - case 0: - html_color = get_text_color(QString::number(RED)).name(); - break; - case 1: - html_color = get_text_color(QString::number(ORANGE)).name(); - break; - case 2: - html_color = get_text_color(QString::number(YELLOW)).name(); - break; - case 3: - html_color = get_text_color(QString::number(GREEN)).name(); - break; - default: - html_color = get_text_color(QString::number(BLUE)).name(); - rainbow_counter = -1; - } - - ++rainbow_counter; - + case 0: + html_color = get_text_color(QString::number(RED)).name(); + break; + case 1: + html_color = get_text_color(QString::number(ORANGE)).name(); + break; + case 2: + html_color = get_text_color(QString::number(YELLOW)).name(); + break; + case 3: + html_color = get_text_color(QString::number(GREEN)).name(); + break; + default: + html_color = get_text_color(QString::number(BLUE)).name(); + rainbow_counter = -1; + } + + ++rainbow_counter; + ui_vp_message->insertHtml("" + f_character + ""); if (mirror_iclog && colorf_iclog && !colorf_limit) @@ -3074,269 +3103,252 @@ void Courtroom::chat_tick() if (mirror_iclog && colorf_iclog) ui_ic_chatlog->insertHtml("" + f_character + ""); - } - } - + } + } + if (mirror_iclog && !colorf_iclog) { ui_ic_chatlog->textCursor().insertHtml(f_character); } if (message_is_centered) { - ui_vp_message->setAlignment(Qt::AlignCenter); - } + ui_vp_message->setAlignment(Qt::AlignCenter); + } else { - ui_vp_message->setAlignment(Qt::AlignLeft); - } - } - - QScrollBar *scroll = ui_vp_message->verticalScrollBar(); - scroll->setValue(scroll->maximum()); - - if(blank_blip) - qDebug() << "blank_blip found true"; - + ui_vp_message->setAlignment(Qt::AlignLeft); + } + } + + QScrollBar *scroll = ui_vp_message->verticalScrollBar(); + scroll->setValue(scroll->maximum()); + + if (blank_blip) + qDebug() << "blank_blip found true"; + if (f_message.at(tick_pos) != ' ' || blank_blip) { - + if (blip_pos % blip_rate == 0 && !formatting_char) { - blip_pos = 0; - blip_player->blip_tick(); - } - - ++blip_pos; - } - - ++tick_pos; - + blip_pos = 0; + blip_player->blip_tick(); + } + + ++blip_pos; + } + + ++tick_pos; + // Restart the timer, but according to the newly set speeds, if there were // any. Keep the speed at bay. if (current_display_speed < 0) { - current_display_speed = 0; - } - + current_display_speed = 0; + } + if (current_display_speed > 6) { - current_display_speed = 6; - } + current_display_speed = 6; + } if (formatting_char) { - chat_tick_timer->start(1); - } + chat_tick_timer->start(1); + } else { chat_tick_timer->start(msg_delay); -} - -void Courtroom::play_sfx() -{ - QString sfx_name = m_chatmessage[SFX_NAME]; - - if (sfx_name == "1") - return; - - sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); -} - -void Courtroom::set_scene() -{ - - //witness is default if pos is invalid - QString f_background = "witnessempty"; - QString f_desk_image = "stand"; - QString f_desk_mod = m_chatmessage[DESK_MOD]; - QString f_side = m_chatmessage[SIDE]; - - if (f_side == "def") - { - f_background = "defenseempty"; - if (is_ao2_bg) - f_desk_image = "defensedesk"; - else - f_desk_image = "bancodefensa"; - } - else if (f_side == "pro") - { - f_background = "prosecutorempty"; - if (is_ao2_bg) - f_desk_image = "prosecutiondesk"; - else - f_desk_image = "bancoacusacion"; - } - else if (f_side == "jud") - { - f_background = "judgestand"; - f_desk_image = "judgedesk"; - } - else if (f_side == "hld") - { - f_background = "helperstand"; - f_desk_image = "helperdesk"; - } - else if (f_side == "hlp") - { - f_background = "prohelperstand"; - f_desk_image = "prohelperdesk"; - } + } + } +} + +void Courtroom::play_sfx() +{ + QString sfx_name = m_chatmessage[SFX_NAME]; + + if (sfx_name == "1") + return; + + sfx_player->play(ao_app->get_sfx_suffix(sfx_name)); +} + +void Courtroom::set_scene() +{ + + // witness is default if pos is invalid + QString f_background = "witnessempty"; + QString f_desk_image = "stand"; + QString f_desk_mod = m_chatmessage[DESK_MOD]; + QString f_side = m_chatmessage[SIDE]; + + if (f_side == "def") { + f_background = "defenseempty"; + if (is_ao2_bg) + f_desk_image = "defensedesk"; + else + f_desk_image = "bancodefensa"; + } + else if (f_side == "pro") { + f_background = "prosecutorempty"; + if (is_ao2_bg) + f_desk_image = "prosecutiondesk"; + else + f_desk_image = "bancoacusacion"; + } + else if (f_side == "jud") { + f_background = "judgestand"; + f_desk_image = "judgedesk"; + } + else if (f_side == "hld") { + f_background = "helperstand"; + f_desk_image = "helperdesk"; + } + else if (f_side == "hlp") { + f_background = "prohelperstand"; + f_desk_image = "prohelperdesk"; + } else if (f_side == "jur" && (file_exists(ao_app->get_image_suffix( ao_app->get_background_path("jurystand"))))) { - f_background = "jurystand"; - f_desk_image = "jurydesk"; - } + f_background = "jurystand"; + f_desk_image = "jurydesk"; + } else if (f_side == "sea" && (file_exists(ao_app->get_image_suffix( ao_app->get_background_path("seancestand"))))) { - f_background = "seancestand"; - f_desk_image = "seancedesk"; - } - else - { - if (is_ao2_bg) - f_desk_image = "stand"; - else - f_desk_image = "estrado"; - } - - ui_vp_background->set_image(f_background); - ui_vp_desk->set_image(f_desk_image); - ui_vp_legacy_desk->set_legacy_desk(f_desk_image); - - if (f_desk_mod == "0" || (f_desk_mod != "1" && - (f_side == "jud" || - f_side == "hld" || - f_side == "hlp"))) - { - ui_vp_desk->hide(); - ui_vp_legacy_desk->hide(); - } - else if (is_ao2_bg || (f_side == "jud" || - f_side == "hld" || - f_side == "hlp")) - { - ui_vp_legacy_desk->hide(); - ui_vp_desk->show(); - } - else - { - if (f_side == "wit") - { - ui_vp_desk->show(); - ui_vp_legacy_desk->hide(); - } - else - { - ui_vp_desk->hide(); - ui_vp_legacy_desk->show(); - } - } -} - -void Courtroom::set_text_color() -{ + f_background = "seancestand"; + f_desk_image = "seancedesk"; + } + else { + if (is_ao2_bg) + f_desk_image = "stand"; + else + f_desk_image = "estrado"; + } + + ui_vp_background->set_image(f_background); + ui_vp_desk->set_image(f_desk_image); + ui_vp_legacy_desk->set_legacy_desk(f_desk_image); + + if (f_desk_mod == "0" || + (f_desk_mod != "1" && + (f_side == "jud" || f_side == "hld" || f_side == "hlp"))) { + ui_vp_desk->hide(); + ui_vp_legacy_desk->hide(); + } + else if (is_ao2_bg || + (f_side == "jud" || f_side == "hld" || f_side == "hlp")) { + ui_vp_legacy_desk->hide(); + ui_vp_desk->show(); + } + else { + if (f_side == "wit") { + ui_vp_desk->show(); + ui_vp_legacy_desk->hide(); + } + else { + ui_vp_desk->hide(); + ui_vp_legacy_desk->show(); + } + } +} + +void Courtroom::set_text_color() +{ QString f_char = m_chatmessage[CHAR_NAME]; QColor textcolor = ao_app->get_chat_color(m_chatmessage[TEXT_COLOR], ao_app->get_chat(f_char)); - - ui_vp_message->setTextBackgroundColor(QColor(0,0,0,0)); - ui_vp_message->setTextColor(textcolor); - - QString style = "background-color: rgba(0, 0, 0, 0);"; - style.append("color: rgb("); - style.append(QString::number(textcolor.red())); - style.append(", "); - style.append(QString::number(textcolor.green())); - style.append(", "); - style.append(QString::number(textcolor.blue())); - style.append(")"); - - ui_vp_message->setStyleSheet(style); -} - -QColor Courtroom::get_text_color(QString color) -{ + + ui_vp_message->setTextBackgroundColor(QColor(0, 0, 0, 0)); + ui_vp_message->setTextColor(textcolor); + + QString style = "background-color: rgba(0, 0, 0, 0);"; + style.append("color: rgb("); + style.append(QString::number(textcolor.red())); + style.append(", "); + style.append(QString::number(textcolor.green())); + style.append(", "); + style.append(QString::number(textcolor.blue())); + style.append(")"); + + ui_vp_message->setStyleSheet(style); +} + +QColor Courtroom::get_text_color(QString color) +{ QString f_char = m_chatmessage[CHAR_NAME]; return ao_app->get_chat_color(color, ao_app->get_chat(f_char)); -} - -void Courtroom::set_ip_list(QString p_list) -{ - QString f_list = p_list.replace("|", ":").replace("*", "\n"); - - ui_server_chatlog->append(f_list); -} - -void Courtroom::set_mute(bool p_muted, int p_cid) -{ - if (p_cid != m_cid && p_cid != -1) - return; - - if (p_muted) - ui_muted->show(); - else - { - ui_muted->hide(); - ui_ic_chat_message->setFocus(); - } - - ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); - ui_muted->set_image("muted.png"); - - is_muted = p_muted; - ui_ic_chat_message->setEnabled(!p_muted); -} - -void Courtroom::set_ban(int p_cid) -{ - if (p_cid != m_cid && p_cid != -1) - return; - - call_notice(tr("You have been banned.")); - - ao_app->construct_lobby(); - ao_app->destruct_courtroom(); -} - -void Courtroom::handle_song(QStringList *p_contents) -{ - QStringList f_contents = *p_contents; - - if (f_contents.size() < 2) - return; - - QString f_song = f_contents.at(0); - QString f_song_clear = f_song; - int n_char = f_contents.at(1).toInt(); - - qDebug() << "playing song "+ao_app->get_music_path(f_song); - +} + +void Courtroom::set_ip_list(QString p_list) +{ + QString f_list = p_list.replace("|", ":").replace("*", "\n"); + + ui_server_chatlog->append(f_list); +} + +void Courtroom::set_mute(bool p_muted, int p_cid) +{ + if (p_cid != m_cid && p_cid != -1) + return; + + if (p_muted) + ui_muted->show(); + else { + ui_muted->hide(); + ui_ic_chat_message->setFocus(); + } + + ui_muted->resize(ui_ic_chat_message->width(), ui_ic_chat_message->height()); + ui_muted->set_image("muted.png"); + + is_muted = p_muted; + ui_ic_chat_message->setEnabled(!p_muted); +} + +void Courtroom::set_ban(int p_cid) +{ + if (p_cid != m_cid && p_cid != -1) + return; + + call_notice(tr("You have been banned.")); + + ao_app->construct_lobby(); + ao_app->destruct_courtroom(); +} + +void Courtroom::handle_song(QStringList *p_contents) +{ + QStringList f_contents = *p_contents; + + if (f_contents.size() < 2) + return; + + QString f_song = f_contents.at(0); + QString f_song_clear = f_song; + int n_char = f_contents.at(1).toInt(); + + qDebug() << "playing song " + ao_app->get_music_path(f_song); + if (n_char < 0 || n_char >= char_list.size()) { music_player->play(ao_app->get_music_prefix(f_song)); - } + } else { - QString str_char = char_list.at(n_char).name; - QString str_show = char_list.at(n_char).name; - - if (p_contents->length() > 2) - { - if(p_contents->at(2) != "") - { - str_show = p_contents->at(2); - } - } - if (p_contents->length() > 3) - { - if(p_contents->at(3) != "-1") - { - music_player->enable_looping = false; - } - else - { - music_player->enable_looping = true; - } - } + QString str_char = char_list.at(n_char).name; + QString str_show = char_list.at(n_char).name; + + if (p_contents->length() > 2) { + if (p_contents->at(2) != "") { + str_show = p_contents->at(2); + } + } + if (p_contents->length() > 3) { + if (p_contents->at(3) != "-1") { + music_player->enable_looping = false; + } + else { + music_player->enable_looping = true; + } + } if (!mute_map.value(n_char)) { chatlogpiece *temp = new chatlogpiece(str_char, str_show, f_song, true, m_chatmessage[TEXT_COLOR].toInt()); - ic_chatlog_history.append(*temp); - + ic_chatlog_history.append(*temp); + while (ic_chatlog_history.size() > log_maximum_blocks && log_maximum_blocks > 0) { - ic_chatlog_history.removeFirst(); - } + ic_chatlog_history.removeFirst(); + } if (mirror_iclog) // If mirror is enabled, we display the song in the ooc // chat rather than ic log for a more realistic // expierence. @@ -3349,380 +3361,406 @@ void Courtroom::handle_song(QStringList *p_contents) } append_ic_text(f_song_clear, str_show, true); music_player->play(ao_app->get_music_prefix(f_song)); - } - } -} -void Courtroom::handle_failed_login() -{ - modcall_player->play("./music/failed_login"); // aov memes -} -void Courtroom::handle_wtce(QString p_wtce, int variant) -{ - QString sfx_file = "courtroom_sounds.ini"; - - //witness testimony + } + } +} +void Courtroom::handle_failed_login() +{ + modcall_player->play("./music/failed_login"); // aov memes +} +void Courtroom::handle_wtce(QString p_wtce, int variant) +{ + QString sfx_file = "courtroom_sounds.ini"; + + // witness testimony if (p_wtce == "testimony1") { - misc_sfx_player->play(ao_app->get_sfx("witness_testimony")); + misc_sfx_player->play(ao_app->get_sfx("witness_testimony")); ui_vp_wtce->play("witnesstestimony", "", "", wtce_stay_time); ui_vp_testimony->play("testimony"); - } - //cross examination + } + // cross examination else if (p_wtce == "testimony2") { - misc_sfx_player->play(ao_app->get_sfx("cross_examination")); + misc_sfx_player->play(ao_app->get_sfx("cross_examination")); ui_vp_wtce->play("crossexamination", "", "", wtce_stay_time); ui_vp_testimony->stop(); - } + } else if (p_wtce == "judgeruling") { if (variant == 0) { - misc_sfx_player->play(ao_app->get_sfx("not_guilty")); + misc_sfx_player->play(ao_app->get_sfx("not_guilty")); ui_vp_wtce->play("notguilty", "", "", verdict_stay_time); ui_vp_testimony->stop(); - } - else if (variant == 1) { - misc_sfx_player->play(ao_app->get_sfx("guilty")); + } + else if (variant == 1) { + misc_sfx_player->play(ao_app->get_sfx("guilty")); ui_vp_wtce->play("guilty", "", "", verdict_stay_time); ui_vp_testimony->stop(); - } - } -} - -void Courtroom::set_hp_bar(int p_bar, int p_state) -{ - if (p_state < 0 || p_state > 10) - return; - - if (p_bar == 1) - { - ui_defense_bar->set_image("defensebar" + QString::number(p_state) + ".png"); - defense_bar_state = p_state; - } - else if (p_bar == 2) - { - ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) + ".png"); - prosecution_bar_state = p_state; - } -} - -void Courtroom::toggle_judge_buttons(bool is_on) -{ - if (is_on) - { - ui_witness_testimony->show(); - ui_cross_examination->show(); - ui_guilty->show(); - ui_not_guilty->show(); - ui_defense_minus->show(); - ui_defense_plus->show(); - ui_prosecution_minus->show(); - ui_prosecution_plus->show(); - } - else - { - ui_witness_testimony->hide(); - ui_cross_examination->hide(); - ui_guilty->hide(); - ui_not_guilty->hide(); - ui_defense_minus->hide(); - ui_defense_plus->hide(); - ui_prosecution_minus->hide(); - ui_prosecution_plus->hide(); - } -} - -void Courtroom::mod_called(QString p_ip) -{ - ui_server_chatlog->append(p_ip); - if (!ui_guard->isChecked()) - { - modcall_player->play(ao_app->get_sfx("mod_call")); - ao_app->alert(this); - } -} - -void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, bool steno, bool witness) -{ - if (ui_casing->isChecked()) - { - ui_server_chatlog->append(msg); - if ((ao_app->get_casing_defence_enabled() && def) || - (ao_app->get_casing_prosecution_enabled() && pro) || - (ao_app->get_casing_judge_enabled() && jud) || - (ao_app->get_casing_juror_enabled() && jur) || - (ao_app->get_casing_steno_enabled() && steno) || - (ao_app->get_casing_wit_enabled() && witness)) - { - modcall_player->play(ao_app->get_sfx("case_call")); - ao_app->alert(this); - } - } -} - -void Courtroom::on_ooc_return_pressed() -{ - QString ooc_message = ui_ooc_chat_message->text(); - - if (ooc_message == "" || ui_ooc_chat_name->text() == "") - return; - - if (ooc_message.startsWith("/pos")) - { - if (ooc_message == "/pos jud") - { - toggle_judge_buttons(true); - } - else - { - toggle_judge_buttons(false); - } - } - else if (ooc_message.startsWith("/login")) - { - ui_guard->show(); - append_server_chatmessage("CLIENT", tr("You were granted the Disable Modcalls button."), "1"); - } - else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && !rainbow_appended) - { - //ui_text_color->addItem("Rainbow"); - ui_ooc_chat_message->clear(); - //rainbow_appended = true; - append_server_chatmessage("CLIENT", tr("This does nothing, but there you go."), "1"); - return; - } - else if (ooc_message.startsWith("/settings")) - { - ui_ooc_chat_message->clear(); - ao_app->call_settings_menu(); - append_server_chatmessage("CLIENT", tr("You opened the settings menu."), "1"); - return; - } - else if (ooc_message.startsWith("/pair")) - { - ui_ooc_chat_message->clear(); - ooc_message.remove(0,6); - - bool ok; - int whom = ooc_message.toInt(&ok); - if (ok) - { - if (whom > -1) - { - other_charid = whom; - QString msg = tr("You will now pair up with "); - msg.append(char_list.at(whom).name); - msg.append(tr(" if they also choose your character in return.")); - append_server_chatmessage("CLIENT", msg, "1"); - } - else - { - other_charid = -1; - append_server_chatmessage("CLIENT", tr("You are no longer paired with anyone."), "1"); - } - } - else - { - append_server_chatmessage("CLIENT", tr("Are you sure you typed that well? The char ID could not be recognised."), "1"); - } - return; - } - else if (ooc_message.startsWith("/offset")) - { - ui_ooc_chat_message->clear(); - ooc_message.remove(0,8); - - bool ok; - int off = ooc_message.toInt(&ok); - if (ok) - { - if (off >= -100 && off <= 100) - { - offset_with_pair = off; - QString msg = tr("You have set your offset to "); - msg.append(QString::number(off)); - msg.append("%."); - append_server_chatmessage("CLIENT", msg, "1"); - } - else - { - append_server_chatmessage("CLIENT", tr("Your offset must be between -100% and 100%!"), "1"); - } - } - else - { - append_server_chatmessage("CLIENT", tr("That offset does not look like one."), "1"); - } - return; - } - else if (ooc_message.startsWith("/switch_am")) - { - append_server_chatmessage("CLIENT", tr("You switched your music and area list."), "1"); - on_switch_area_music_clicked(); - ui_ooc_chat_message->clear(); - return; - } - else if (ooc_message.startsWith("/enable_blocks")) - { - append_server_chatmessage("CLIENT", tr("You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this."), "1"); - ao_app->cccc_ic_support_enabled = true; - ao_app->arup_enabled = true; - ao_app->modcall_reason_enabled = true; - on_reload_theme_clicked(); - ui_ooc_chat_message->clear(); - return; - } - else if (ooc_message.startsWith("/non_int_pre")) - { - if (ui_pre_non_interrupt->isChecked()) - append_server_chatmessage("CLIENT", tr("Your pre-animations interrupt again."), "1"); - else - append_server_chatmessage("CLIENT", tr("Your pre-animations will not interrupt text."), "1"); - ui_pre_non_interrupt->setChecked(!ui_pre_non_interrupt->isChecked()); - ui_ooc_chat_message->clear(); - return; - } - else if (ooc_message.startsWith("/save_chatlog")) - { - QFile file("chatlog.txt"); - - if (!file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) - { - append_server_chatmessage("CLIENT", tr("Couldn't open chatlog.txt to write into."), "1"); - ui_ooc_chat_message->clear(); - return; - } - - QTextStream out(&file); - - foreach (chatlogpiece item, ic_chatlog_history) { - out << item.get_full() << '\n'; - } - - file.close(); - - append_server_chatmessage("CLIENT", tr("The IC chatlog has been saved."), "1"); - ui_ooc_chat_message->clear(); - return; - } - else if (ooc_message.startsWith("/load_case")) - { - QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); - - QDir casefolder("base/cases"); - if (!casefolder.exists()) - { - QDir::current().mkdir("base/" + casefolder.dirName()); - append_server_chatmessage("CLIENT", tr("You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there."), "1"); - ui_ooc_chat_message->clear(); - return; - } - QStringList caseslist = casefolder.entryList(); - caseslist.removeOne("."); - caseslist.removeOne(".."); - caseslist.replaceInStrings(".ini",""); - - if (command.size() < 2) - { - append_server_chatmessage("CLIENT", tr("You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini.\nCases you can load: %1").arg(caseslist.join(", ")), "1"); - ui_ooc_chat_message->clear(); - return; - } - - - if (command.size() > 2) - { - append_server_chatmessage("CLIENT", tr("Too many arguments to load a case! You only need one filename, without extension."), "1"); - ui_ooc_chat_message->clear(); - return; - } - - QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); - - QString caseauth = casefile.value("author", "").value(); - QString casedoc = casefile.value("doc", "").value(); - QString cmdoc = casefile.value("cmdoc", "").value(); - QString casestatus = casefile.value("status", "").value(); - - if (!caseauth.isEmpty()) - append_server_chatmessage("CLIENT", tr("Case made by %1.").arg(caseauth), "1"); - if (!casedoc.isEmpty()) - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/doc " + casedoc + "#%")); - if (!casestatus.isEmpty()) - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/status " + casestatus + "#%")); - if (!cmdoc.isEmpty()) - append_server_chatmessage("CLIENT", tr("Navigate to %1 for the CM doc.").arg(cmdoc), "1"); - - for (int i = local_evidence_list.size() - 1; i >= 0; i--) { - ao_app->send_server_packet(new AOPacket("DE#" + QString::number(i) + "#%")); - } - - foreach (QString evi, casefile.childGroups()) { - if (evi == "General") - continue; - - QStringList f_contents; - - f_contents.append(casefile.value(evi + "/name", "UNKNOWN").value()); - f_contents.append(casefile.value(evi + "/description", "UNKNOWN").value()); - f_contents.append(casefile.value(evi + "/image", "UNKNOWN.png").value()); - - ao_app->send_server_packet(new AOPacket("PE", f_contents)); - } - - append_server_chatmessage("CLIENT", tr("Your case \"%1\" was loaded!").arg(command[1]), "1"); - ui_ooc_chat_message->clear(); - return; - } - else if(ooc_message.startsWith("/save_case")) - { - QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); - - QDir casefolder("base/cases"); - if (!casefolder.exists()) - { - QDir::current().mkdir("base/" + casefolder.dirName()); - append_server_chatmessage("CLIENT", tr("You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it."), "1"); - ui_ooc_chat_message->clear(); - return; - } - QStringList caseslist = casefolder.entryList(); - caseslist.removeOne("."); - caseslist.removeOne(".."); - caseslist.replaceInStrings(".ini",""); - - if (command.size() < 3) - { - append_server_chatmessage("CLIENT", tr("You need to give a filename to save (extension not needed) and the courtroom status!"), "1"); - ui_ooc_chat_message->clear(); - return; - } - - - if (command.size() > 3) - { - append_server_chatmessage("CLIENT", tr("Too many arguments to save a case! You only need a filename without extension and the courtroom status!"), "1"); - ui_ooc_chat_message->clear(); - return; - } - QSettings casefile("base/cases/" + command[1] + ".ini", QSettings::IniFormat); - casefile.setValue("author",ui_ooc_chat_name->text()); - casefile.setValue("cmdoc",""); - casefile.setValue("doc", ""); - casefile.setValue("status",command[2]); - casefile.sync(); - for(int i = local_evidence_list.size() - 1; i >= 0; i--) - { - QString clean_evidence_dsc = local_evidence_list[i].description.replace(QRegularExpression("..."), ""); - clean_evidence_dsc = clean_evidence_dsc.replace(clean_evidence_dsc.lastIndexOf(">"), 1, ""); - casefile.beginGroup(QString::number(i)); - casefile.sync(); - casefile.setValue("name",local_evidence_list[i].name); - casefile.setValue("description",local_evidence_list[i].description); - casefile.setValue("image",local_evidence_list[i].image); - casefile.endGroup(); - } - casefile.sync(); + } + } +} + +void Courtroom::set_hp_bar(int p_bar, int p_state) +{ + if (p_state < 0 || p_state > 10) + return; + + if (p_bar == 1) { + ui_defense_bar->set_image("defensebar" + QString::number(p_state) + ".png"); + defense_bar_state = p_state; + } + else if (p_bar == 2) { + ui_prosecution_bar->set_image("prosecutionbar" + QString::number(p_state) + + ".png"); + prosecution_bar_state = p_state; + } +} + +void Courtroom::toggle_judge_buttons(bool is_on) +{ + if (is_on) { + ui_witness_testimony->show(); + ui_cross_examination->show(); + ui_guilty->show(); + ui_not_guilty->show(); + ui_defense_minus->show(); + ui_defense_plus->show(); + ui_prosecution_minus->show(); + ui_prosecution_plus->show(); + } + else { + ui_witness_testimony->hide(); + ui_cross_examination->hide(); + ui_guilty->hide(); + ui_not_guilty->hide(); + ui_defense_minus->hide(); + ui_defense_plus->hide(); + ui_prosecution_minus->hide(); + ui_prosecution_plus->hide(); + } +} + +void Courtroom::mod_called(QString p_ip) +{ + ui_server_chatlog->append(p_ip); + if (!ui_guard->isChecked()) { + modcall_player->play(ao_app->get_sfx("mod_call")); + ao_app->alert(this); + } +} + +void Courtroom::case_called(QString msg, bool def, bool pro, bool jud, bool jur, + bool steno, bool witness) +{ + if (ui_casing->isChecked()) { + ui_server_chatlog->append(msg); + if ((ao_app->get_casing_defence_enabled() && def) || + (ao_app->get_casing_prosecution_enabled() && pro) || + (ao_app->get_casing_judge_enabled() && jud) || + (ao_app->get_casing_juror_enabled() && jur) || + (ao_app->get_casing_steno_enabled() && steno) || + (ao_app->get_casing_wit_enabled() && witness)) { + modcall_player->play(ao_app->get_sfx("case_call")); + ao_app->alert(this); + } + } +} + +void Courtroom::on_ooc_return_pressed() +{ + QString ooc_message = ui_ooc_chat_message->text(); + + if (ooc_message == "" || ui_ooc_chat_name->text() == "") + return; + + if (ooc_message.startsWith("/pos")) { + if (ooc_message == "/pos jud") { + toggle_judge_buttons(true); + } + else { + toggle_judge_buttons(false); + } + } + else if (ooc_message.startsWith("/login")) { + ui_guard->show(); + + append_server_chatmessage( + "CLIENT", tr("You were granted the Disable Modcalls button."), "1"); + } + else if (ooc_message.startsWith("/rainbow") && ao_app->yellow_text_enabled && + !rainbow_appended) { + // ui_text_color->addItem("Rainbow"); + ui_ooc_chat_message->clear(); + // rainbow_appended = true; + append_server_chatmessage("CLIENT", + tr("This does nothing, but there you go."), "1"); + return; + } + else if (ooc_message.startsWith("/settings")) { + ui_ooc_chat_message->clear(); + ao_app->call_settings_menu(); + append_server_chatmessage("CLIENT", tr("You opened the settings menu."), + "1"); + return; + } + else if (ooc_message.startsWith("/pair")) { + ui_ooc_chat_message->clear(); + ooc_message.remove(0, 6); + + bool ok; + int whom = ooc_message.toInt(&ok); + if (ok) { + if (whom > -1) { + other_charid = whom; + QString msg = tr("You will now pair up with "); + msg.append(char_list.at(whom).name); + msg.append(tr(" if they also choose your character in return.")); + append_server_chatmessage("CLIENT", msg, "1"); + } + else { + other_charid = -1; + append_server_chatmessage( + "CLIENT", tr("You are no longer paired with anyone."), "1"); + } + } + else { + append_server_chatmessage("CLIENT", + tr("Are you sure you typed that well? The char " + "ID could not be recognised."), + "1"); + } + return; + } + else if (ooc_message.startsWith("/offset")) { + ui_ooc_chat_message->clear(); + ooc_message.remove(0, 8); + + bool ok; + int off = ooc_message.toInt(&ok); + if (ok) { + if (off >= -100 && off <= 100) { + offset_with_pair = off; + QString msg = tr("You have set your offset to "); + msg.append(QString::number(off)); + msg.append("%."); + append_server_chatmessage("CLIENT", msg, "1"); + } + else { + append_server_chatmessage( + "CLIENT", tr("Your offset must be between -100% and 100%!"), "1"); + } + } + else { + append_server_chatmessage("CLIENT", + tr("That offset does not look like one."), "1"); + } + return; + } + else if (ooc_message.startsWith("/switch_am")) { + append_server_chatmessage( + "CLIENT", tr("You switched your music and area list."), "1"); + on_switch_area_music_clicked(); + ui_ooc_chat_message->clear(); + return; + } + else if (ooc_message.startsWith("/enable_blocks")) { + append_server_chatmessage("CLIENT", + tr("You have forcefully enabled features that " + "the server may not support. You may not be " + "able to talk IC, or worse, because of this."), + "1"); + ao_app->cccc_ic_support_enabled = true; + ao_app->arup_enabled = true; + ao_app->modcall_reason_enabled = true; + on_reload_theme_clicked(); + ui_ooc_chat_message->clear(); + return; + } + else if (ooc_message.startsWith("/non_int_pre")) { + if (ui_pre_non_interrupt->isChecked()) + append_server_chatmessage( + "CLIENT", tr("Your pre-animations interrupt again."), "1"); + else + append_server_chatmessage( + "CLIENT", tr("Your pre-animations will not interrupt text."), "1"); + ui_pre_non_interrupt->setChecked(!ui_pre_non_interrupt->isChecked()); + ui_ooc_chat_message->clear(); + return; + } + else if (ooc_message.startsWith("/save_chatlog")) { + QFile file("chatlog.txt"); + + if (!file.open(QIODevice::WriteOnly | QIODevice::Text | + QIODevice::Truncate)) { + append_server_chatmessage( + "CLIENT", tr("Couldn't open chatlog.txt to write into."), "1"); + ui_ooc_chat_message->clear(); + return; + } + + QTextStream out(&file); + + foreach (chatlogpiece item, ic_chatlog_history) { + out << item.get_full() << '\n'; + } + + file.close(); + + append_server_chatmessage("CLIENT", tr("The IC chatlog has been saved."), + "1"); + ui_ooc_chat_message->clear(); + return; + } + else if (ooc_message.startsWith("/load_case")) { + QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); + + QDir casefolder("base/cases"); + if (!casefolder.exists()) { + QDir::current().mkdir("base/" + casefolder.dirName()); + append_server_chatmessage( + "CLIENT", + tr("You don't have a `base/cases/` folder! It was just made for you, " + "but seeing as it WAS just made for you, it's likely the case " + "file you're looking for can't be found in there."), + "1"); + ui_ooc_chat_message->clear(); + return; + } + QStringList caseslist = casefolder.entryList(); + caseslist.removeOne("."); + caseslist.removeOne(".."); + caseslist.replaceInStrings(".ini", ""); + + if (command.size() < 2) { + append_server_chatmessage( + "CLIENT", + tr("You need to give a filename to load (extension not needed)! Make " + "sure that it is in the `base/cases/` folder, and that it is a " + "correctly formatted ini.\nCases you can load: %1") + .arg(caseslist.join(", ")), + "1"); + ui_ooc_chat_message->clear(); + return; + } + + if (command.size() > 2) { + append_server_chatmessage( + "CLIENT", + tr("Too many arguments to load a case! You only need one filename, " + "without extension."), + "1"); + ui_ooc_chat_message->clear(); + return; + } + + QSettings casefile("base/cases/" + command[1] + ".ini", + QSettings::IniFormat); + + QString caseauth = casefile.value("author", "").value(); + QString casedoc = casefile.value("doc", "").value(); + QString cmdoc = casefile.value("cmdoc", "").value(); + QString casestatus = casefile.value("status", "").value(); + + if (!caseauth.isEmpty()) + append_server_chatmessage("CLIENT", tr("Case made by %1.").arg(caseauth), + "1"); + if (!casedoc.isEmpty()) + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + + "#/doc " + casedoc + "#%")); + if (!casestatus.isEmpty()) + ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + + "#/status " + casestatus + "#%")); + if (!cmdoc.isEmpty()) + append_server_chatmessage( + "CLIENT", tr("Navigate to %1 for the CM doc.").arg(cmdoc), "1"); + + for (int i = local_evidence_list.size() - 1; i >= 0; i--) { + ao_app->send_server_packet( + new AOPacket("DE#" + QString::number(i) + "#%")); + } + + foreach (QString evi, casefile.childGroups()) { + if (evi == "General") + continue; + + QStringList f_contents; + + f_contents.append( + casefile.value(evi + "/name", "UNKNOWN").value()); + f_contents.append( + casefile.value(evi + "/description", "UNKNOWN").value()); + f_contents.append( + casefile.value(evi + "/image", "UNKNOWN.png").value()); + + ao_app->send_server_packet(new AOPacket("PE", f_contents)); + } + append_server_chatmessage( + "CLIENT", tr("Your case \"%1\" was loaded!").arg(command[1]), "1"); + ui_ooc_chat_message->clear(); + return; + } + else if (ooc_message.startsWith("/save_case")) { + QStringList command = ooc_message.split(" ", QString::SkipEmptyParts); + + QDir casefolder("base/cases"); + if (!casefolder.exists()) { + QDir::current().mkdir("base/" + casefolder.dirName()); + append_server_chatmessage( + "CLIENT", + tr("You don't have a `base/cases/` folder! It was just made for you, " + "but seeing as it WAS just made for you, it's likely that you " + "somehow deleted it."), + "1"); + ui_ooc_chat_message->clear(); + return; + } + QStringList caseslist = casefolder.entryList(); + caseslist.removeOne("."); + caseslist.removeOne(".."); + caseslist.replaceInStrings(".ini", ""); + + if (command.size() < 3) { + append_server_chatmessage( + "CLIENT", + tr("You need to give a filename to save (extension not needed) and " + "the courtroom status!"), + "1"); + ui_ooc_chat_message->clear(); + return; + } + + if (command.size() > 3) { + append_server_chatmessage( + "CLIENT", + tr("Too many arguments to save a case! You only need a filename " + "without extension and the courtroom status!"), + "1"); + ui_ooc_chat_message->clear(); + return; + } + QSettings casefile("base/cases/" + command[1] + ".ini", + QSettings::IniFormat); + casefile.setValue("author", ui_ooc_chat_name->text()); + casefile.setValue("cmdoc", ""); + casefile.setValue("doc", ""); + casefile.setValue("status", command[2]); + casefile.sync(); + for (int i = local_evidence_list.size() - 1; i >= 0; i--) { + QString clean_evidence_dsc = local_evidence_list[i].description.replace( + QRegularExpression("..."), ""); + clean_evidence_dsc = clean_evidence_dsc.replace( + clean_evidence_dsc.lastIndexOf(">"), 1, ""); + casefile.beginGroup(QString::number(i)); + casefile.sync(); + casefile.setValue("name", local_evidence_list[i].name); + casefile.setValue("description", local_evidence_list[i].description); + casefile.setValue("image", local_evidence_list[i].image); + casefile.endGroup(); + } + casefile.sync(); append_server_chatmessage( "CLIENT", tr("Succesfully saved, edit doc and cmdoc link on the ini!"), "1"); + ui_ooc_chat_message->clear(); + return; } else if (ooc_message.startsWith("/clearooc")) { ui_server_chatlog->clear(); @@ -3731,54 +3769,50 @@ void Courtroom::on_ooc_return_pressed() } else if (ooc_message.startsWith("/version")) { append_server_chatmessage("CLIENT", ao_app->get_version_string(), "1"); - ui_ooc_chat_message->clear(); - return; - } - - QStringList packet_contents; - packet_contents.append(ui_ooc_chat_name->text()); - packet_contents.append(ooc_message); - - AOPacket *f_packet = new AOPacket("CT", packet_contents); - - if (server_ooc) - ao_app->send_server_packet(f_packet); - else - ao_app->send_ms_packet(f_packet); - - ui_ooc_chat_message->clear(); - - ui_ooc_chat_message->setFocus(); -} - -void Courtroom::on_ooc_toggle_clicked() -{ - if (server_ooc) - { - ui_ms_chatlog->show(); - ui_server_chatlog->hide(); - ui_ooc_toggle->setText(tr("")); - ui_ooc_toggle->set_image("ooc_toggle_ms.png"); - if (ooc_toggle_fallback) - { - ui_ooc_toggle->setText(tr("Master")); - } - server_ooc = false; - } - else - { - ui_ms_chatlog->hide(); - ui_server_chatlog->show(); - ui_ooc_toggle->setText(tr("")); - ui_ooc_toggle->set_image("ooc_toggle_server.png"); - if (ooc_toggle_fallback) - { - ui_ooc_toggle->setText(tr("Server")); - } - server_ooc = true; - } -} - + ui_ooc_chat_message->clear(); + return; + } + + QStringList packet_contents; + packet_contents.append(ui_ooc_chat_name->text()); + packet_contents.append(ooc_message); + + AOPacket *f_packet = new AOPacket("CT", packet_contents); + + if (server_ooc) + ao_app->send_server_packet(f_packet); + else + ao_app->send_ms_packet(f_packet); + + ui_ooc_chat_message->clear(); + + ui_ooc_chat_message->setFocus(); +} + +void Courtroom::on_ooc_toggle_clicked() +{ + if (server_ooc) { + ui_ms_chatlog->show(); + ui_server_chatlog->hide(); + ui_ooc_toggle->setText(tr("")); + ui_ooc_toggle->set_image("ooc_toggle_ms.png"); + if (ooc_toggle_fallback) { + ui_ooc_toggle->setText(tr("Master")); + } + server_ooc = false; + } + else { + ui_ms_chatlog->hide(); + ui_server_chatlog->show(); + ui_ooc_toggle->setText(tr("")); + ui_ooc_toggle->set_image("ooc_toggle_server.png"); + if (ooc_toggle_fallback) { + ui_ooc_toggle->setText(tr("Server")); + } + server_ooc = true; + } +} + void Courtroom::on_music_search_keypr() { if (ui_music_search->text() == "") { @@ -3786,155 +3820,143 @@ void Courtroom::on_music_search_keypr() } } -void Courtroom::on_music_search_edited(QString p_text) -{ - //preventing compiler warnings - p_text += "a"; - list_music(); - list_areas(); -} - -void Courtroom::on_pos_dropdown_changed(int p_index) -{ - ui_ic_chat_message->setFocus(); - - if (p_index < 0 || p_index > 7) - return; - - toggle_judge_buttons(false); - - QString f_pos; - - switch (p_index) - { - case 0: - f_pos = "wit"; - break; - case 1: - f_pos = "def"; - break; - case 2: - f_pos = "pro"; - break; - case 3: - f_pos = "jud"; - toggle_judge_buttons(true); - break; - case 4: - f_pos = "hld"; - break; - case 5: - f_pos = "hlp"; - break; - case 6: - f_pos = "jur"; - break; - case 7: - f_pos = "sea"; - break; - default: - f_pos = ""; - } - - if (f_pos == "" || ui_ooc_chat_name->text() == "") - return; - - ao_app->send_server_packet(new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%")); -} - -void Courtroom::on_mute_list_clicked(QModelIndex p_index) -{ - QListWidgetItem *f_item = ui_mute_list->item(p_index.row()); - QString f_char = f_item->text(); - QString real_char; - - if (f_char.endsWith(" [x]")) - real_char = f_char.left(f_char.size() - 4); - else - real_char = f_char; - - int f_cid = -1; - - for (int n_char = 0 ; n_char < char_list.size() ; n_char++) - { - if (char_list.at(n_char).name == real_char) - f_cid = n_char; - } - - if (f_cid < 0 || f_cid >= char_list.size()) - { - qDebug() << "W: " << real_char << " not present in char_list"; - return; - } - - if (mute_map.value(f_cid)) - { - mute_map.insert(f_cid, false); - f_item->setText(real_char); - } - else - { - mute_map.insert(f_cid, true); - f_item->setText(real_char + " [x]"); - } -} - -void Courtroom::on_pair_list_clicked(QModelIndex p_index) -{ - QListWidgetItem *f_item = ui_pair_list->item(p_index.row()); - QString f_char = f_item->text(); - QString real_char; - int f_cid = -1; - - if (f_char.endsWith(" [x]")) - { - real_char = f_char.left(f_char.size() - 4); - f_item->setText(real_char); - } - else - { - real_char = f_char; - for (int n_char = 0 ; n_char < char_list.size() ; n_char++) - { - if (char_list.at(n_char).name == real_char) - f_cid = n_char; - } - } - - - - - if (f_cid < -2 || f_cid >= char_list.size()) - { - qDebug() << "W: " << real_char << " not present in char_list"; - return; - } - - other_charid = f_cid; - - // Redo the character list. - QStringList sorted_pair_list; - - for (char_type i_char : char_list) - sorted_pair_list.append(i_char.name); - - sorted_pair_list.sort(); - - for (int i = 0; i < ui_pair_list->count(); i++) { - ui_pair_list->item(i)->setText(sorted_pair_list.at(i)); - } - if(other_charid != -1) - { - f_item->setText(real_char + " [x]"); - } -} - +void Courtroom::on_music_search_edited(QString p_text) +{ + // preventing compiler warnings + p_text += "a"; + list_music(); + list_areas(); +} + +void Courtroom::on_pos_dropdown_changed(int p_index) +{ + ui_ic_chat_message->setFocus(); + + if (p_index < 0 || p_index > 7) + return; + + toggle_judge_buttons(false); + + QString f_pos; + + switch (p_index) { + case 0: + f_pos = "wit"; + break; + case 1: + f_pos = "def"; + break; + case 2: + f_pos = "pro"; + break; + case 3: + f_pos = "jud"; + toggle_judge_buttons(true); + break; + case 4: + f_pos = "hld"; + break; + case 5: + f_pos = "hlp"; + break; + case 6: + f_pos = "jur"; + break; + case 7: + f_pos = "sea"; + break; + default: + f_pos = ""; + } + + if (f_pos == "" || ui_ooc_chat_name->text() == "") + return; + + ao_app->send_server_packet( + new AOPacket("CT#" + ui_ooc_chat_name->text() + "#/pos " + f_pos + "#%")); +} + +void Courtroom::on_mute_list_clicked(QModelIndex p_index) +{ + QListWidgetItem *f_item = ui_mute_list->item(p_index.row()); + QString f_char = f_item->text(); + QString real_char; + + if (f_char.endsWith(" [x]")) + real_char = f_char.left(f_char.size() - 4); + else + real_char = f_char; + + int f_cid = -1; + + for (int n_char = 0; n_char < char_list.size(); n_char++) { + if (char_list.at(n_char).name == real_char) + f_cid = n_char; + } + + if (f_cid < 0 || f_cid >= char_list.size()) { + qDebug() << "W: " << real_char << " not present in char_list"; + return; + } + + if (mute_map.value(f_cid)) { + mute_map.insert(f_cid, false); + f_item->setText(real_char); + } + else { + mute_map.insert(f_cid, true); + f_item->setText(real_char + " [x]"); + } +} + +void Courtroom::on_pair_list_clicked(QModelIndex p_index) +{ + QListWidgetItem *f_item = ui_pair_list->item(p_index.row()); + QString f_char = f_item->text(); + QString real_char; + int f_cid = -1; + + if (f_char.endsWith(" [x]")) { + real_char = f_char.left(f_char.size() - 4); + f_item->setText(real_char); + } + else { + real_char = f_char; + for (int n_char = 0; n_char < char_list.size(); n_char++) { + if (char_list.at(n_char).name == real_char) + f_cid = n_char; + } + } + + if (f_cid < -2 || f_cid >= char_list.size()) { + qDebug() << "W: " << real_char << " not present in char_list"; + return; + } + + other_charid = f_cid; + + // Redo the character list. + QStringList sorted_pair_list; + + for (char_type i_char : char_list) + sorted_pair_list.append(i_char.name); + + sorted_pair_list.sort(); + + for (int i = 0; i < ui_pair_list->count(); i++) { + ui_pair_list->item(i)->setText(sorted_pair_list.at(i)); + } + if (other_charid != -1) { + f_item->setText(real_char + " [x]"); + } +} + void Courtroom::on_music_list_double_clicked(QTreeWidgetItem *p_item, int column) -{ - if (is_muted) - return; - +{ + if (is_muted) + return; + column = 1; // Column 1 is always the metadata (which we want) QString p_song = p_item->text(column); if (!ui_ic_chat_name->text().isEmpty() && ao_app->cccc_ic_support_enabled) { @@ -3942,103 +3964,99 @@ void Courtroom::on_music_list_double_clicked(QTreeWidgetItem *p_item, QString::number(m_cid) + "#" + ui_ic_chat_name->text() + "#%"), false); - } + } else { ao_app->send_server_packet( new AOPacket("MC#" + p_song + "#" + QString::number(m_cid) + "#%"), false); - } -} - -void Courtroom::on_area_list_double_clicked(QModelIndex p_model) -{ - QString p_area = area_list.at(area_row_to_number.at(p_model.row())); - ao_app->send_server_packet(new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"), false); -} - -void Courtroom::on_hold_it_clicked() -{ - if (objection_state == 1) - { - ui_hold_it->set_image("holdit.png"); - objection_state = 0; - } - else - { - ui_objection->set_image("objection.png"); - ui_take_that->set_image("takethat.png"); - ui_custom_objection->set_image("custom.png"); - - ui_hold_it->set_image("holdit_selected.png"); - objection_state = 1; - } - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_objection_clicked() -{ - if (objection_state == 2) - { - ui_objection->set_image("objection.png"); - objection_state = 0; - } - else - { - ui_hold_it->set_image("holdit.png"); - ui_take_that->set_image("takethat.png"); - ui_custom_objection->set_image("custom.png"); - - ui_objection->set_image("objection_selected.png"); - objection_state = 2; - } - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_take_that_clicked() -{ - if (objection_state == 3) - { - ui_take_that->set_image("takethat.png"); - objection_state = 0; - } - else - { - ui_objection->set_image("objection.png"); - ui_hold_it->set_image("holdit.png"); - ui_custom_objection->set_image("custom.png"); - - ui_take_that->set_image("takethat_selected.png"); - objection_state = 3; - } - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_custom_objection_clicked() -{ - if (objection_state == 4) - { - ui_custom_objection->set_image("custom.png"); - objection_state = 0; + } +} + +void Courtroom::on_area_list_double_clicked(QModelIndex p_model) + +{ + + QString p_area = area_list.at(area_row_to_number.at(p_model.row())); + + ao_app->send_server_packet( + new AOPacket("MC#" + p_area + "#" + QString::number(m_cid) + "#%"), + false); +} + +void Courtroom::on_hold_it_clicked() +{ + if (objection_state == 1) { + ui_hold_it->set_image("holdit.png"); + objection_state = 0; + } + else { + ui_objection->set_image("objection.png"); + ui_take_that->set_image("takethat.png"); + ui_custom_objection->set_image("custom.png"); + + ui_hold_it->set_image("holdit_selected.png"); + objection_state = 1; + } + + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_objection_clicked() +{ + if (objection_state == 2) { + ui_objection->set_image("objection.png"); + objection_state = 0; + } + else { + ui_hold_it->set_image("holdit.png"); + ui_take_that->set_image("takethat.png"); + ui_custom_objection->set_image("custom.png"); + + ui_objection->set_image("objection_selected.png"); + objection_state = 2; + } + + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_take_that_clicked() +{ + if (objection_state == 3) { + ui_take_that->set_image("takethat.png"); + objection_state = 0; + } + else { + ui_objection->set_image("objection.png"); + ui_hold_it->set_image("holdit.png"); + ui_custom_objection->set_image("custom.png"); + + ui_take_that->set_image("takethat_selected.png"); + objection_state = 3; + } + + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_custom_objection_clicked() +{ + if (objection_state == 4) { + ui_custom_objection->set_image("custom.png"); + objection_state = 0; objection_custom = ""; - } - else - { - ui_objection->set_image("objection.png"); - ui_take_that->set_image("takethat.png"); - ui_hold_it->set_image("holdit.png"); - - ui_custom_objection->set_image("custom_selected.png"); - objection_state = 4; - } - - ui_ic_chat_message->setFocus(); -} - + } + else { + ui_objection->set_image("objection.png"); + ui_take_that->set_image("takethat.png"); + ui_hold_it->set_image("holdit.png"); + ui_custom_objection->set_image("custom_selected.png"); + objection_state = 4; + } + + ui_ic_chat_message->setFocus(); +} + void Courtroom::ShowContextMenu(const QPoint &pos) -{ +{ QPoint globalPos = ui_custom_objection->mapToGlobal(pos); QAction *selecteditem = custom_obj_menu->exec(globalPos); if (selecteditem) { @@ -4052,390 +4070,367 @@ void Courtroom::ShowContextMenu(const QPoint &pos) } void Courtroom::on_realization_clicked() - { +{ if (realization_state == 0) { - realization_state = 1; - ui_realization->set_image("realization_pressed.png"); - } - else - { - realization_state = 0; - ui_realization->set_image("realization.png"); - } - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_screenshake_clicked() -{ - if (screenshake_state == 0) - { - screenshake_state = 1; - ui_screenshake->set_image("screenshake_pressed.png"); - } - else - { - screenshake_state = 0; - ui_screenshake->set_image("screenshake.png"); - } - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_mute_clicked() -{ - if (ui_mute_list->isHidden()) - { - ui_mute_list->show(); - ui_pair_list->hide(); - ui_pair_offset_spinbox->hide(); - ui_pair_button->set_image("pair_button.png"); - ui_mute->set_image("mute_pressed.png"); - } - else - { - ui_mute_list->hide(); - ui_mute->set_image("mute.png"); - } -} - -void Courtroom::on_pair_clicked() -{ - if (ui_pair_list->isHidden()) - { - ui_pair_list->show(); - ui_pair_offset_spinbox->show(); - ui_mute_list->hide(); - ui_mute->set_image("mute.png"); - ui_pair_button->set_image("pair_button_pressed.png"); - } - else - { - ui_pair_list->hide(); - ui_pair_offset_spinbox->hide(); - ui_pair_button->set_image("pair_button.png"); - } -} - -void Courtroom::on_defense_minus_clicked() -{ - int f_state = defense_bar_state - 1; - - if (f_state >= 0) - ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%")); -} - -void Courtroom::on_defense_plus_clicked() -{ - int f_state = defense_bar_state + 1; - - if (f_state <= 10) - ao_app->send_server_packet(new AOPacket("HP#1#" + QString::number(f_state) + "#%")); -} - -void Courtroom::on_prosecution_minus_clicked() -{ - int f_state = prosecution_bar_state - 1; - - if (f_state >= 0) - ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); -} - -void Courtroom::on_prosecution_plus_clicked() -{ - int f_state = prosecution_bar_state + 1; - - if (f_state <= 10) - ao_app->send_server_packet(new AOPacket("HP#2#" + QString::number(f_state) + "#%")); -} - -void Courtroom::on_text_color_changed(int p_color) -{ - text_color = p_color; - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_music_slider_moved(int p_value) -{ - music_player->set_volume(p_value); - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_sfx_slider_moved(int p_value) -{ - sfx_player->set_volume(p_value); - objection_player->set_volume(p_value); - misc_sfx_player->set_volume(p_value); - frame_emote_sfx_player->set_volume(p_value); - pair_frame_emote_sfx_player->set_volume(p_value); - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_blip_slider_moved(int p_value) -{ - blip_player->set_volume(p_value); - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_log_limit_changed(int value) -{ - log_maximum_blocks = value; -} - -void Courtroom::on_pair_offset_changed(int value) -{ - offset_with_pair = value; -} - -void Courtroom::on_witness_testimony_clicked() -{ - if (is_muted) - return; - - ao_app->send_server_packet(new AOPacket("RT#testimony1#%")); - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_cross_examination_clicked() -{ - if (is_muted) - return; - - ao_app->send_server_packet(new AOPacket("RT#testimony2#%")); - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_not_guilty_clicked() -{ - if (is_muted) - return; - - ao_app->send_server_packet(new AOPacket("RT#judgeruling#0#%")); - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_guilty_clicked() -{ - if (is_muted) - return; - - ao_app->send_server_packet(new AOPacket("RT#judgeruling#1#%")); - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_change_character_clicked() -{ - music_player->set_volume(0); - sfx_player->set_volume(0); - sfx_player->set_volume(0); - blip_player->set_volume(0); - - set_char_select(); - - ui_char_select_background->show(); - ui_spectator->hide(); -} - -void Courtroom::on_reload_theme_clicked() -{ - ao_app->reload_theme(); + realization_state = 1; + ui_realization->set_image("realization_pressed.png"); + } + else { + realization_state = 0; + ui_realization->set_image("realization.png"); + } + + ui_ic_chat_message->setFocus(); +} +void Courtroom::on_screenshake_clicked() +{ + if (screenshake_state == 0) { + screenshake_state = 1; + ui_screenshake->set_image("screenshake_pressed.png"); + } + else { + screenshake_state = 0; + ui_screenshake->set_image("screenshake.png"); + } + + ui_ic_chat_message->setFocus(); +} +void Courtroom::on_mute_clicked() +{ + if (ui_mute_list->isHidden()) { + ui_mute_list->show(); + ui_pair_list->hide(); + ui_pair_offset_spinbox->hide(); + ui_pair_button->set_image("pair_button.png"); + ui_mute->set_image("mute_pressed.png"); + } + else { + ui_mute_list->hide(); + ui_mute->set_image("mute.png"); + } +} + +void Courtroom::on_pair_clicked() +{ + if (ui_pair_list->isHidden()) { + ui_pair_list->show(); + ui_pair_offset_spinbox->show(); + ui_mute_list->hide(); + ui_mute->set_image("mute.png"); + ui_pair_button->set_image("pair_button_pressed.png"); + } + else { + ui_pair_list->hide(); + ui_pair_offset_spinbox->hide(); + ui_pair_button->set_image("pair_button.png"); + } +} + +void Courtroom::on_defense_minus_clicked() +{ + int f_state = defense_bar_state - 1; + + if (f_state >= 0) + ao_app->send_server_packet( + new AOPacket("HP#1#" + QString::number(f_state) + "#%")); +} + +void Courtroom::on_defense_plus_clicked() +{ + int f_state = defense_bar_state + 1; + + if (f_state <= 10) + ao_app->send_server_packet( + new AOPacket("HP#1#" + QString::number(f_state) + "#%")); +} + +void Courtroom::on_prosecution_minus_clicked() +{ + int f_state = prosecution_bar_state - 1; + + if (f_state >= 0) + ao_app->send_server_packet( + new AOPacket("HP#2#" + QString::number(f_state) + "#%")); +} + +void Courtroom::on_prosecution_plus_clicked() +{ + int f_state = prosecution_bar_state + 1; + + if (f_state <= 10) + ao_app->send_server_packet( + new AOPacket("HP#2#" + QString::number(f_state) + "#%")); +} + +void Courtroom::on_text_color_changed(int p_color) +{ + text_color = p_color; + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_music_slider_moved(int p_value) +{ + music_player->set_volume(p_value); + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_sfx_slider_moved(int p_value) +{ + sfx_player->set_volume(p_value); + objection_player->set_volume(p_value); + misc_sfx_player->set_volume(p_value); + frame_emote_sfx_player->set_volume(p_value); + pair_frame_emote_sfx_player->set_volume(p_value); + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_blip_slider_moved(int p_value) +{ + blip_player->set_volume(p_value); + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_log_limit_changed(int value) { log_maximum_blocks = value; } + +void Courtroom::on_pair_offset_changed(int value) { offset_with_pair = value; } + +void Courtroom::on_witness_testimony_clicked() +{ + if (is_muted) + return; + + ao_app->send_server_packet(new AOPacket("RT#testimony1#%")); + + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_cross_examination_clicked() +{ + if (is_muted) + return; + + ao_app->send_server_packet(new AOPacket("RT#testimony2#%")); + + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_not_guilty_clicked() +{ + if (is_muted) + return; + + ao_app->send_server_packet(new AOPacket("RT#judgeruling#0#%")); + + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_guilty_clicked() +{ + if (is_muted) + return; + + ao_app->send_server_packet(new AOPacket("RT#judgeruling#1#%")); + + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_change_character_clicked() +{ + music_player->set_volume(0); + sfx_player->set_volume(0); + sfx_player->set_volume(0); + blip_player->set_volume(0); + + set_char_select(); + + ui_char_select_background->show(); + ui_spectator->hide(); +} + +void Courtroom::on_reload_theme_clicked() +{ + ao_app->reload_theme(); punctuation_modifier = ao_app->get_pundelay(); colorf_iclog = ao_app->get_colored_iclog_enabled(); mirror_iclog = ao_app->get_iclmir_enabled(); colorf_limit = ao_app->colorlog_restricted_enabled(); keep_evidence_display = ao_app->is_keepevi_enabled(); - //to update status on the background - set_background(current_background); - //to update fallback text bools - detect_fallback_text(); - enter_courtroom(m_cid); - - anim_state = 4; - text_state = 3; -} - -void Courtroom::on_back_to_lobby_clicked() -{ - ao_app->construct_lobby(); - ao_app->destruct_courtroom(); -} - -void Courtroom::on_char_select_left_clicked() -{ - --current_char_page; - set_char_select_page(); -} - -void Courtroom::on_char_select_right_clicked() -{ - ++current_char_page; - set_char_select_page(); -} - -void Courtroom::on_spectator_clicked() -{ - this->set_character(-1); - - ui_emotes->hide(); - - ui_char_select_background->hide(); -} - -void Courtroom::on_call_mod_clicked() -{ - if (ao_app->modcall_reason_enabled) { - QMessageBox errorBox; - QInputDialog input; - - input.setWindowFlags(Qt::WindowSystemMenuHint); - input.setLabelText(tr("Reason:")); - input.setWindowTitle(tr("Call Moderator")); - auto code = input.exec(); - - if (code != QDialog::Accepted) - return; - - QString text = input.textValue(); - if (text.isEmpty()) { - errorBox.critical(nullptr, tr("Error"), tr("You must provide a reason.")); - return; - } else if (text.length() > 256) { - errorBox.critical(nullptr, tr("Error"), tr("The message is too long.")); - return; - } - - QStringList mod_reason; - mod_reason.append(text); - - ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); - } else { - ao_app->send_server_packet(new AOPacket("ZZ#%")); - } - - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_settings_clicked() -{ - ao_app->call_settings_menu(); -} - -void Courtroom::on_announce_casing_clicked() -{ - ao_app->call_announce_menu(this); -} - -void Courtroom::on_pre_clicked() -{ - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_flip_clicked() -{ - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_guard_clicked() -{ - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_showname_enable_clicked() -{ - + // to update status on the background + set_background(current_background); + // to update fallback text bools + detect_fallback_text(); + enter_courtroom(m_cid); + + anim_state = 4; + text_state = 3; +} + +void Courtroom::on_back_to_lobby_clicked() +{ + ao_app->construct_lobby(); + ao_app->destruct_courtroom(); +} + +void Courtroom::on_char_select_left_clicked() +{ + --current_char_page; + set_char_select_page(); +} + +void Courtroom::on_char_select_right_clicked() +{ + ++current_char_page; + set_char_select_page(); +} + +void Courtroom::on_spectator_clicked() +{ + this->set_character(-1); + + ui_emotes->hide(); + + ui_char_select_background->hide(); +} + +void Courtroom::on_call_mod_clicked() +{ + if (ao_app->modcall_reason_enabled) { + QMessageBox errorBox; + QInputDialog input; + + input.setWindowFlags(Qt::WindowSystemMenuHint); + input.setLabelText(tr("Reason:")); + input.setWindowTitle(tr("Call Moderator")); + auto code = input.exec(); + + if (code != QDialog::Accepted) + return; + + QString text = input.textValue(); + if (text.isEmpty()) { + errorBox.critical(nullptr, tr("Error"), tr("You must provide a reason.")); + return; + } + else if (text.length() > 256) { + errorBox.critical(nullptr, tr("Error"), tr("The message is too long.")); + return; + } + + QStringList mod_reason; + mod_reason.append(text); + + ao_app->send_server_packet(new AOPacket("ZZ", mod_reason)); + } + else { + ao_app->send_server_packet(new AOPacket("ZZ#%")); + } + + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_settings_clicked() { ao_app->call_settings_menu(); } + +void Courtroom::on_announce_casing_clicked() +{ + ao_app->call_announce_menu(this); +} + +void Courtroom::on_pre_clicked() { ui_ic_chat_message->setFocus(); } + +void Courtroom::on_flip_clicked() { ui_ic_chat_message->setFocus(); } + +void Courtroom::on_guard_clicked() { ui_ic_chat_message->setFocus(); } + +void Courtroom::on_showname_enable_clicked() +{ + refresh_iclog(false); - ui_ic_chat_message->setFocus(); -} - -void Courtroom::on_evidence_button_clicked() -{ - if (ui_evidence->isHidden()) - { - ui_evidence->show(); - ui_evidence_overlay->hide(); - } - else - { - ui_evidence->hide(); - } -} - -void Courtroom::on_switch_area_music_clicked() -{ + ui_ic_chat_message->setFocus(); +} + +void Courtroom::on_evidence_button_clicked() +{ + if (ui_evidence->isHidden()) { + ui_evidence->show(); + ui_evidence_overlay->hide(); + } + else { + ui_evidence->hide(); + } +} + +void Courtroom::on_switch_area_music_clicked() +{ if (ui_area_list->isHidden()) { music_search_par = ui_music_search->text(); ui_music_search->setText(area_search_par); - ui_area_list->show(); - ui_music_list->hide(); - } + ui_area_list->show(); + ui_music_list->hide(); + } else { area_search_par = ui_music_search->text(); ui_music_search->setText(music_search_par); - ui_area_list->hide(); - ui_music_list->show(); - } -} - -void Courtroom::ping_server() -{ - ao_app->send_server_packet(new AOPacket("CH#" + QString::number(m_cid) + "#%")); -} - -void Courtroom::on_casing_clicked() -{ - if (ao_app->casing_alerts_enabled) - { - if (ui_casing->isChecked()) - { - QStringList f_packet; - - f_packet.append(ao_app->get_casing_can_host_cases()); - f_packet.append(QString::number(ao_app->get_casing_cm_enabled())); - f_packet.append(QString::number(ao_app->get_casing_defence_enabled())); - f_packet.append(QString::number(ao_app->get_casing_prosecution_enabled())); - f_packet.append(QString::number(ao_app->get_casing_judge_enabled())); - f_packet.append(QString::number(ao_app->get_casing_juror_enabled())); - f_packet.append(QString::number(ao_app->get_casing_steno_enabled())); - f_packet.append(QString::number(ao_app->get_casing_wit_enabled())); - - ao_app->send_server_packet(new AOPacket("SETCASE", f_packet)); - } - else - ao_app->send_server_packet(new AOPacket("SETCASE#\"\"#0#0#0#0#0#0#0#%")); - } -} - -void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, bool jur, bool steno, bool wit) -{ - if (ao_app->casing_alerts_enabled) - { - QStringList f_packet; - - f_packet.append(title); - f_packet.append(QString::number(def)); - f_packet.append(QString::number(pro)); - f_packet.append(QString::number(jud)); - f_packet.append(QString::number(jur)); - f_packet.append(QString::number(steno)); - f_packet.append(QString::number(wit)); - - ao_app->send_server_packet(new AOPacket("CASEA", f_packet)); - } -} - -Courtroom::~Courtroom() -{ - delete music_player; - delete sfx_player; - delete objection_player; - delete blip_player; -} - + ui_area_list->hide(); + ui_music_list->show(); + } +} + +void Courtroom::ping_server() +{ + ao_app->send_server_packet( + new AOPacket("CH#" + QString::number(m_cid) + "#%")); +} + +void Courtroom::on_casing_clicked() +{ + if (ao_app->casing_alerts_enabled) { + if (ui_casing->isChecked()) { + QStringList f_packet; + + f_packet.append(ao_app->get_casing_can_host_cases()); + f_packet.append(QString::number(ao_app->get_casing_cm_enabled())); + f_packet.append(QString::number(ao_app->get_casing_defence_enabled())); + f_packet.append( + QString::number(ao_app->get_casing_prosecution_enabled())); + f_packet.append(QString::number(ao_app->get_casing_judge_enabled())); + f_packet.append(QString::number(ao_app->get_casing_juror_enabled())); + f_packet.append(QString::number(ao_app->get_casing_steno_enabled())); + f_packet.append(QString::number(ao_app->get_casing_wit_enabled())); + + ao_app->send_server_packet(new AOPacket("SETCASE", f_packet)); + } + else + ao_app->send_server_packet(new AOPacket("SETCASE#\"\"#0#0#0#0#0#0#0#%")); + } +} + +void Courtroom::announce_case(QString title, bool def, bool pro, bool jud, + bool jur, bool steno, bool wit) +{ + if (ao_app->casing_alerts_enabled) { + QStringList f_packet; + + f_packet.append(title); + f_packet.append(QString::number(def)); + f_packet.append(QString::number(pro)); + f_packet.append(QString::number(jud)); + f_packet.append(QString::number(jur)); + f_packet.append(QString::number(steno)); + f_packet.append(QString::number(wit)); + + ao_app->send_server_packet(new AOPacket("CASEA", f_packet)); + } +} + +Courtroom::~Courtroom() +{ + delete music_player; + delete sfx_player; + delete objection_player; + delete blip_player; +} + void Courtroom::refresh_iclog(bool skiplast) { ui_ic_chatlog->clear(); @@ -4452,7 +4447,7 @@ void Courtroom::refresh_iclog(bool skiplast) else append_ic_text(item.get_message(), item.get_showname(), false, true, true, item.get_chat_color()); -} + } else { if (item.get_is_song()) append_ic_text(item.get_message(), item.get_name(), true, false, true); @@ -4463,22 +4458,23 @@ void Courtroom::refresh_iclog(bool skiplast) } } -#elif (defined (LINUX) || defined (__linux__)) -void Courtroom::load_bass_opus_plugin() -{ - BASS_PluginLoad("libbassopus.so", 0); -} -#elif defined __APPLE__ -void Courtroom::load_bass_opus_plugin() -{ - QString libpath = ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; - QByteArray ba = libpath.toLocal8Bit(); - BASS_PluginLoad(ba.data(), 0); -} -#else -#error This operating system is unsupported for bass plugins. -#endif -#endif #ifdef BASSAUDIO #if (defined(_WIN32) || defined(_WIN64)) void Courtroom::load_bass_opus_plugin() { BASS_PluginLoad("bassopus.dll", 0); } +#elif (defined(LINUX) || defined(__linux__)) +void Courtroom::load_bass_opus_plugin() +{ + BASS_PluginLoad("libbassopus.so", 0); +} +#elif defined __APPLE__ +void Courtroom::load_bass_opus_plugin() +{ + QString libpath = + ao_app->get_base_path() + "../../Frameworks/libbassopus.dylib"; + QByteArray ba = libpath.toLocal8Bit(); + BASS_PluginLoad(ba.data(), 0); +} +#else +#error This operating system is unsupported for bass plugins. +#endif +#endif diff --git a/src/debug_functions.cpp b/src/debug_functions.cpp index a790610..6186b9d 100644 --- a/src/debug_functions.cpp +++ b/src/debug_functions.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include "debug_functions.h" @@ -7,11 +7,12 @@ 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->setWindowModality(Qt::NonModal); msgBox->exec(); } @@ -20,9 +21,10 @@ 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->setWindowModality(Qt::NonModal); msgBox->exec(); } diff --git a/src/discord_rich_presence.cpp b/src/discord_rich_presence.cpp index 95a824a..aea07e5 100644 --- a/src/discord_rich_presence.cpp +++ b/src/discord_rich_presence.cpp @@ -8,23 +8,18 @@ Discord::Discord() DiscordEventHandlers handlers; std::memset(&handlers, 0, sizeof(handlers)); handlers = {}; - handlers.ready = [] { - qInfo() << "Discord RPC ready"; - }; - handlers.disconnected = [](int errorCode, const char* message) { + handlers.ready = [] { qInfo() << "Discord RPC ready"; }; + handlers.disconnected = [](int errorCode, const char *message) { qInfo() << "Discord RPC disconnected! " << message << errorCode; }; - handlers.errored = [](int errorCode, const char* message) { + handlers.errored = [](int errorCode, const char *message) { qWarning() << "Discord RPC errored out! " << message << errorCode; }; qInfo() << "Initializing Discord RPC"; Discord_Initialize(APPLICATION_ID, &handlers, 1, nullptr); } -Discord::~Discord() -{ - Discord_Shutdown(); -} +Discord::~Discord() { Discord_Shutdown(); } void Discord::state_lobby() { @@ -64,10 +59,12 @@ void Discord::state_server(std::string name, std::string server_id) void Discord::state_character(std::string name) { - auto name_internal = QString(name.c_str()).toLower().replace(' ', '_').toStdString(); + auto name_internal = + QString(name.c_str()).toLower().replace(' ', '_').toStdString(); auto name_friendly = QString(name.c_str()).replace('_', ' ').toStdString(); const std::string playing_as = "Playing as " + name_friendly; - qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str() << ")"; + qDebug() << "Discord RPC: Setting character state (" << playing_as.c_str() + << ")"; DiscordRichPresence presence; std::memset(&presence, 0, sizeof(presence)); @@ -101,20 +98,11 @@ void Discord::state_spectate() Discord_UpdatePresence(&presence); } #else -Discord::Discord() -{ +Discord::Discord() {} -} +Discord::~Discord() {} -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 diff --git a/src/emotes.cpp b/src/emotes.cpp index b6a217e..bbe2f5c 100644 --- a/src/emotes.cpp +++ b/src/emotes.cpp @@ -8,7 +8,8 @@ void Courtroom::construct_emotes() set_size_and_pos(ui_emotes, "emotes"); - QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", "courtroom_design.ini"); + QPoint f_spacing = ao_app->get_button_spacing("emote_button_spacing", + "courtroom_design.ini"); const int button_width = 40; int x_spacing = f_spacing.x(); @@ -18,13 +19,14 @@ void Courtroom::construct_emotes() int y_spacing = f_spacing.y(); int y_mod_count = 0; - emote_columns = ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1; - emote_rows = ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1; + emote_columns = + ((ui_emotes->width() - button_width) / (x_spacing + button_width)) + 1; + emote_rows = + ((ui_emotes->height() - button_height) / (y_spacing + button_height)) + 1; max_emotes_on_page = emote_columns * emote_rows; - for (int n = 0 ; n < max_emotes_on_page ; ++n) - { + for (int n = 0; n < max_emotes_on_page; ++n) { int x_pos = (button_width + x_spacing) * x_mod_count; int y_pos = (button_height + y_spacing) * y_mod_count; @@ -34,12 +36,12 @@ void Courtroom::construct_emotes() f_emote->set_id(n); - connect(f_emote, SIGNAL(emote_clicked(int)), this, SLOT(on_emote_clicked(int))); + connect(f_emote, SIGNAL(emote_clicked(int)), this, + SLOT(on_emote_clicked(int))); ++x_mod_count; - if (x_mod_count == emote_columns) - { + if (x_mod_count == emote_columns) { ++y_mod_count; x_mod_count = 0; } @@ -56,23 +58,20 @@ void Courtroom::set_emote_page() ui_emote_left->hide(); ui_emote_right->hide(); - for (AOEmoteButton *i_button : ui_emote_list) - { + for (AOEmoteButton *i_button : ui_emote_list) { i_button->hide(); } int total_pages = total_emotes / max_emotes_on_page; int emotes_on_page = 0; - if (total_emotes % max_emotes_on_page != 0) - { + if (total_emotes % max_emotes_on_page != 0) { ++total_pages; - //i. e. not on the last page + // i. e. not on the last page if (total_pages > current_emote_page + 1) emotes_on_page = max_emotes_on_page; else emotes_on_page = total_emotes % max_emotes_on_page; - } else emotes_on_page = max_emotes_on_page; @@ -83,8 +82,7 @@ void Courtroom::set_emote_page() if (current_emote_page > 0) ui_emote_left->show(); - for (int n_emote = 0 ; n_emote < emotes_on_page ; ++n_emote) - { + for (int n_emote = 0; n_emote < emotes_on_page; ++n_emote) { int n_real_emote = n_emote + current_emote_page * max_emotes_on_page; AOEmoteButton *f_emote = ui_emote_list.at(n_emote); @@ -95,7 +93,6 @@ void Courtroom::set_emote_page() f_emote->show(); } - } void Courtroom::set_emote_dropdown() @@ -105,8 +102,7 @@ void Courtroom::set_emote_dropdown() int total_emotes = ao_app->get_emote_number(current_char); QStringList emote_list; - for (int n = 0 ; n < total_emotes ; ++n) - { + for (int n = 0; n < total_emotes; ++n) { emote_list.append(ao_app->get_emote_comment(current_char, n)); } @@ -119,19 +115,20 @@ void Courtroom::select_emote(int p_id) int max = (max_emotes_on_page - 1) + current_emote_page * max_emotes_on_page; if (current_emote >= min && current_emote <= max) - ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_off.png"); + ui_emote_list.at(current_emote % max_emotes_on_page) + ->set_image(current_char, current_emote, "_off.png"); int old_emote = current_emote; current_emote = p_id; if (current_emote >= min && current_emote <= max) - ui_emote_list.at(current_emote % max_emotes_on_page)->set_image(current_char, current_emote, "_on.png"); + ui_emote_list.at(current_emote % max_emotes_on_page) + ->set_image(current_char, current_emote, "_on.png"); int emote_mod = ao_app->get_emote_mod(current_char, current_emote); - if (old_emote == current_emote) - { + if (old_emote == current_emote) { ui_pre->setChecked(!ui_pre->isChecked()); } else if (emote_mod == 1) diff --git a/src/encryption_functions.cpp b/src/encryption_functions.cpp index ffbe0cd..6669fe1 100644 --- a/src/encryption_functions.cpp +++ b/src/encryption_functions.cpp @@ -4,8 +4,8 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key) { - //using standard stdlib types is actually easier here because of implicit char<->int conversion - //which in turn makes encryption arithmetic easier + // using standard stdlib types is actually easier here because of implicit + // char<->int conversion which in turn makes encryption arithmetic easier unsigned int key = p_key; unsigned int C1 = 53761; @@ -14,8 +14,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key) QVector temp_result; std::string input = temp_input.toUtf8().constData(); - for (unsigned int pos = 0 ; pos < input.size() ; ++pos) - { + for (unsigned int pos = 0; pos < input.size(); ++pos) { uint_fast8_t output = input.at(pos) ^ (key >> 8) % 256; temp_result.append(output); key = (temp_result.at(pos) + key) * C1 + C2; @@ -23,8 +22,7 @@ QString fanta_encrypt(QString temp_input, unsigned int p_key) std::string result = ""; - for (uint_fast8_t i_int : temp_result) - { + for (uint_fast8_t i_int : temp_result) { result += omni::int_to_hex(i_int); } @@ -39,9 +37,8 @@ QString fanta_decrypt(QString temp_input, unsigned int key) QVector unhexed_vector; - for(unsigned int i=0; i< input.length(); i+=2) - { - std::string byte = input.substr(i,2); + for (unsigned int i = 0; i < input.length(); i += 2) { + std::string byte = input.substr(i, 2); unsigned int hex_int = strtoul(byte.c_str(), nullptr, 16); unhexed_vector.append(hex_int); } @@ -51,13 +48,11 @@ QString fanta_decrypt(QString temp_input, unsigned int key) std::string result = ""; - for (int pos = 0 ; pos < unhexed_vector.size() ; ++pos) - { + for (int pos = 0; pos < unhexed_vector.size(); ++pos) { unsigned char output = unhexed_vector.at(pos) ^ (key >> 8) % 256; result += output; key = (unhexed_vector.at(pos) + key) * C1 + C2; } return QString::fromStdString(result); - } diff --git a/src/evidence.cpp b/src/evidence.cpp index 341bed0..502fae7 100644 --- a/src/evidence.cpp +++ b/src/evidence.cpp @@ -4,7 +4,7 @@ void Courtroom::construct_evidence() { ui_evidence = new AOImage(this, ao_app); - //ui_evidence_name = new QLabel(ui_evidence); + // ui_evidence_name = new QLabel(ui_evidence); ui_evidence_name = new AOLineEdit(ui_evidence); ui_evidence_name->setAlignment(Qt::AlignCenter); ui_evidence_name->setFont(QFont("Arial", 14, QFont::Bold)); @@ -32,7 +32,8 @@ void Courtroom::construct_evidence() set_size_and_pos(ui_evidence, "evidence_background"); set_size_and_pos(ui_evidence_buttons, "evidence_buttons"); - QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", "courtroom_design.ini"); + QPoint f_spacing = ao_app->get_button_spacing("evidence_button_spacing", + "courtroom_design.ini"); const int button_width = 70; int x_spacing = f_spacing.x(); @@ -42,43 +43,57 @@ void Courtroom::construct_evidence() int y_spacing = f_spacing.y(); int y_mod_count = 0; - evidence_columns = ((ui_evidence_buttons->width() - button_width) / (x_spacing + button_width)) + 1; - evidence_rows = ((ui_evidence_buttons->height() - button_height) / (y_spacing + button_height)) + 1; + evidence_columns = ((ui_evidence_buttons->width() - button_width) / + (x_spacing + button_width)) + + 1; + evidence_rows = ((ui_evidence_buttons->height() - button_height) / + (y_spacing + button_height)) + + 1; max_evidence_on_page = evidence_columns * evidence_rows; - for (int n = 0 ; n < max_evidence_on_page ; ++n) - { + for (int n = 0; n < max_evidence_on_page; ++n) { int x_pos = (button_width + x_spacing) * x_mod_count; int y_pos = (button_height + y_spacing) * y_mod_count; - AOEvidenceButton *f_evidence = new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos); + AOEvidenceButton *f_evidence = + new AOEvidenceButton(ui_evidence_buttons, ao_app, x_pos, y_pos); ui_evidence_list.append(f_evidence); f_evidence->set_id(n); - connect(f_evidence, SIGNAL(evidence_clicked(int)), this, SLOT(on_evidence_clicked(int))); - connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this, SLOT(on_evidence_double_clicked(int))); - connect(f_evidence, SIGNAL(on_hover(int, bool)), this, SLOT(on_evidence_hover(int, bool))); + connect(f_evidence, SIGNAL(evidence_clicked(int)), this, + SLOT(on_evidence_clicked(int))); + connect(f_evidence, SIGNAL(evidence_double_clicked(int)), this, + SLOT(on_evidence_double_clicked(int))); + connect(f_evidence, SIGNAL(on_hover(int, bool)), this, + SLOT(on_evidence_hover(int, bool))); ++x_mod_count; - if (x_mod_count == evidence_columns) - { + if (x_mod_count == evidence_columns) { ++y_mod_count; x_mod_count = 0; } } - connect(ui_evidence_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_name_edited())); - connect(ui_evidence_left, SIGNAL(clicked()), this, SLOT(on_evidence_left_clicked())); - connect(ui_evidence_right, SIGNAL(clicked()), this, SLOT(on_evidence_right_clicked())); - connect(ui_evidence_present, SIGNAL(clicked()), this, SLOT(on_evidence_present_clicked())); - connect(ui_evidence_delete, SIGNAL(clicked()), this, SLOT(on_evidence_delete_clicked())); - connect(ui_evidence_image_name, SIGNAL(returnPressed()), this, SLOT(on_evidence_image_name_edited())); - connect(ui_evidence_image_button, SIGNAL(clicked()), this, SLOT(on_evidence_image_button_clicked())); - connect(ui_evidence_x, SIGNAL(clicked()), this, SLOT(on_evidence_x_clicked())); + connect(ui_evidence_name, SIGNAL(returnPressed()), this, + SLOT(on_evidence_name_edited())); + connect(ui_evidence_left, SIGNAL(clicked()), this, + SLOT(on_evidence_left_clicked())); + connect(ui_evidence_right, SIGNAL(clicked()), this, + SLOT(on_evidence_right_clicked())); + connect(ui_evidence_present, SIGNAL(clicked()), this, + SLOT(on_evidence_present_clicked())); + connect(ui_evidence_delete, SIGNAL(clicked()), this, + SLOT(on_evidence_delete_clicked())); + connect(ui_evidence_image_name, SIGNAL(returnPressed()), this, + SLOT(on_evidence_image_name_edited())); + connect(ui_evidence_image_button, SIGNAL(clicked()), this, + SLOT(on_evidence_image_button_clicked())); + connect(ui_evidence_x, SIGNAL(clicked()), this, + SLOT(on_evidence_x_clicked())); ui_evidence->hide(); } @@ -98,26 +113,23 @@ void Courtroom::set_evidence_page() ui_evidence_left->hide(); ui_evidence_right->hide(); - for (AOEvidenceButton *i_button : ui_evidence_list) - { + for (AOEvidenceButton *i_button : ui_evidence_list) { i_button->reset(); } - //to account for the "add evidence" button + // to account for the "add evidence" button ++total_evidence; int total_pages = total_evidence / max_evidence_on_page; int evidence_on_page = 0; - if ((total_evidence % max_evidence_on_page) != 0) - { + if ((total_evidence % max_evidence_on_page) != 0) { ++total_pages; - //i. e. not on the last page + // i. e. not on the last page if (total_pages > current_evidence_page + 1) evidence_on_page = max_evidence_on_page; else evidence_on_page = total_evidence % max_evidence_on_page; - } else evidence_on_page = max_evidence_on_page; @@ -128,17 +140,19 @@ void Courtroom::set_evidence_page() if (current_evidence_page > 0) ui_evidence_left->show(); - for (int n_evidence_button = 0 ; n_evidence_button < evidence_on_page ; ++n_evidence_button) - { - int n_real_evidence = n_evidence_button + current_evidence_page * max_evidence_on_page; - AOEvidenceButton *f_evidence_button = ui_evidence_list.at(n_evidence_button); + for (int n_evidence_button = 0; n_evidence_button < evidence_on_page; + ++n_evidence_button) { + int n_real_evidence = + n_evidence_button + current_evidence_page * max_evidence_on_page; + AOEvidenceButton *f_evidence_button = + ui_evidence_list.at(n_evidence_button); - //ie. the add evidence button + // ie. the add evidence button if (n_real_evidence == (total_evidence - 1)) f_evidence_button->set_theme_image("addevidence.png"); - else if (n_real_evidence < (total_evidence - 1)) - { - f_evidence_button->set_image(local_evidence_list.at(n_real_evidence).image); + else if (n_real_evidence < (total_evidence - 1)) { + f_evidence_button->set_image( + local_evidence_list.at(n_real_evidence).image); if (n_real_evidence == current_evidence) f_evidence_button->set_selected(true); @@ -198,7 +212,7 @@ void Courtroom::on_evidence_image_button_clicked() QStringList filenames; if (dialog.exec()) - filenames = dialog.selectedFiles(); + filenames = dialog.selectedFiles(); if (filenames.size() != 1) return; @@ -215,9 +229,9 @@ void Courtroom::on_evidence_clicked(int p_id) int f_real_id = p_id + max_evidence_on_page * current_evidence_page; - if (f_real_id == local_evidence_list.size()) - { - ao_app->send_server_packet(new AOPacket("PE###empty.png#%")); + if (f_real_id == local_evidence_list.size()) { + ao_app->send_server_packet( + new AOPacket("PE###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(); } - diff --git a/src/file_functions.cpp b/src/file_functions.cpp index f93ee15..e64a46b 100644 --- a/src/file_functions.cpp +++ b/src/file_functions.cpp @@ -14,7 +14,8 @@ bool dir_exists(QString dir_path) return check_dir.exists(); } -bool exists(QString p_path) { +bool exists(QString p_path) +{ QFile file(p_path); return file.exists(); diff --git a/src/hardware_functions.cpp b/src/hardware_functions.cpp index bd6a6c3..96c72eb 100644 --- a/src/hardware_functions.cpp +++ b/src/hardware_functions.cpp @@ -2,7 +2,7 @@ #include -#if (defined (_WIN32) || defined (_WIN64)) +#if (defined(_WIN32) || defined(_WIN64)) #include static DWORD dwVolSerial; @@ -10,17 +10,18 @@ static BOOL bIsRetrieved; QString get_hdid() { - bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial, nullptr, nullptr, nullptr, 0); + bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), nullptr, 0, &dwVolSerial, + nullptr, nullptr, nullptr, 0); if (bIsRetrieved) return QString::number(dwVolSerial, 16); else - //a totally random string - //what could possibly go wrong + // a totally random string + // what could possibly go wrong return "gxsps32sa9fnwic92mfbs0"; } -#elif (defined (LINUX) || defined (__linux__)) +#elif (defined(LINUX) || defined(__linux__)) #include #include @@ -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) @@ -55,26 +54,25 @@ QString get_hdid() 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); - if (serialNumberAsCFString) { - serial = (CFStringRef)serialNumberAsCFString; - } - if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) { - hdid = buffer; - } + 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); + if (serialNumberAsCFString) { + serial = (CFStringRef)serialNumberAsCFString; + } + if (CFStringGetCString(serial, buffer, 64, kCFStringEncodingUTF8)) { + hdid = buffer; + } - IOObjectRelease(platformExpert); - } - return hdid; + IOObjectRelease(platformExpert); + } + return hdid; } #else diff --git a/src/hex_functions.cpp b/src/hex_functions.cpp index 4a58d2b..1e35718 100644 --- a/src/hex_functions.cpp +++ b/src/hex_functions.cpp @@ -1,18 +1,17 @@ #include "hex_functions.h" -namespace omni +namespace omni { +std::string int_to_hex(unsigned int input) { - std::string int_to_hex(unsigned int input) - { - if (input > 255) - return "FF"; + if (input > 255) + return "FF"; - std::stringstream stream; - stream << std::setfill('0') << std::setw(sizeof(char)*2) - << std::hex << input; - std::string result(stream.str()); - std::transform(result.begin(), result.end(), result.begin(), ::toupper); + std::stringstream stream; + stream << std::setfill('0') << std::setw(sizeof(char) * 2) << std::hex + << input; + std::string result(stream.str()); + std::transform(result.begin(), result.end(), result.begin(), ::toupper); - return result; - } + return result; } +} // namespace omni diff --git a/src/lobby.cpp b/src/lobby.cpp index c590ad5..853b6ae 100644 --- a/src/lobby.cpp +++ b/src/lobby.cpp @@ -1,410 +1,403 @@ -#include "lobby.h" - -#include "debug_functions.h" -#include "aoapplication.h" -#include "networkmanager.h" -#include "aosfxplayer.h" - -Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() -{ - ao_app = p_ao_app; - - this->setWindowTitle(tr("Attorney Online 2")); - this->setWindowIcon(QIcon(":/logo.png")); - - ui_background = new AOImage(this, ao_app); - ui_public_servers = new AOButton(this, ao_app); - ui_favorites = new AOButton(this, ao_app); - ui_refresh = new AOButton(this, ao_app); - ui_add_to_fav = new AOButton(this, ao_app); - ui_connect = new AOButton(this, ao_app); - ui_version = new QLabel(this); - ui_about = new AOButton(this, ao_app); - ui_server_list = new QListWidget(this); - ui_player_count = new QLabel(this); - ui_description = new AOTextArea(this); - ui_chatbox = new AOTextArea(this); - ui_chatbox->setOpenExternalLinks(true); - ui_chatname = new QLineEdit(this); - ui_chatname->setPlaceholderText(tr("Name")); - ui_chatname->setText(ao_app->get_ooc_name()); - ui_chatmessage = new QLineEdit(this); - ui_loading_background = new AOImage(this, ao_app); - ui_loading_text = new QTextEdit(ui_loading_background); - ui_progress_bar = new QProgressBar(ui_loading_background); - ui_progress_bar->setMinimum(0); - ui_progress_bar->setMaximum(100); - 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_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_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_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled())); - - ui_connect->setEnabled(false); - - list_servers(); - - set_widgets(); -} - -//sets images, position and size -void Lobby::set_widgets() -{ - ao_app->reload_theme(); - - QString filename = "lobby_design.ini"; - - 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); - - // 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" - "Did you download all resources correctly from tiny.cc/getao, " - "including the large 'base' folder?")); - - this->resize(517, 666); - } - else - { - this->resize(f_lobby.width, f_lobby.height); - } - - set_size_and_pos(ui_background, "lobby"); - ui_background->set_image("lobbybackground.png"); - - set_size_and_pos(ui_public_servers, "public_servers"); - ui_public_servers->set_image("publicservers_selected.png"); - - set_size_and_pos(ui_favorites, "favorites"); - ui_favorites->set_image("favorites.png"); - - set_size_and_pos(ui_refresh, "refresh"); - ui_refresh->set_image("refresh.png"); - - set_size_and_pos(ui_add_to_fav, "add_to_fav"); - ui_add_to_fav->set_image("addtofav.png"); - - set_size_and_pos(ui_connect, "connect"); - ui_connect->set_image("connect.png"); - - set_size_and_pos(ui_version, "version"); - ui_version->setText(tr("Version: %1").arg(ao_app->get_version_string())); - - set_size_and_pos(ui_about, "about"); - ui_about->set_image("about.png"); - - set_size_and_pos(ui_server_list, "server_list"); - ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "font: bold;"); - - set_size_and_pos(ui_player_count, "player_count"); - ui_player_count->setText(tr("Offline")); - ui_player_count->setStyleSheet("font: bold;" - "color: white;" - "qproperty-alignment: AlignCenter;"); - - set_size_and_pos(ui_description, "description"); - ui_description->setReadOnly(true); - ui_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: white;"); - - set_size_and_pos(ui_chatbox, "chatbox"); - ui_chatbox->setReadOnly(true); - ui_chatbox->setStyleSheet("QTextBrowser{background-color: rgba(0, 0, 0, 0);}"); - - set_size_and_pos(ui_chatname, "chatname"); - ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "selection-background-color: rgba(0, 0, 0, 0);"); - - set_size_and_pos(ui_chatmessage, "chatmessage"); - ui_chatmessage->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "selection-background-color: rgba(0, 0, 0, 0);"); - - ui_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); - ui_loading_text->setAlignment(Qt::AlignCenter); - ui_loading_text->setFrameStyle(QFrame::NoFrame); - ui_loading_text->setStyleSheet("background-color: rgba(0, 0, 0, 0);" - "color: rgba(255, 128, 0, 255);"); - ui_loading_text->append(tr("Loading")); - - set_size_and_pos(ui_progress_bar, "progress_bar"); - set_size_and_pos(ui_cancel, "cancel"); - ui_cancel->setText(tr("Cancel")); - - ui_loading_background->hide(); - -} - -void Lobby::set_size_and_pos(QWidget *p_widget, QString p_identifier) -{ - QString filename = "lobby_design.ini"; - - pos_size_type design_ini_result = ao_app->get_element_dimensions(p_identifier, filename); - - if (design_ini_result.width < 0 || design_ini_result.height < 0) - { - qDebug() << "W: could not find " << p_identifier << " in " << filename; - p_widget->hide(); - } - 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(); - ui_loading_text->setAlignment(Qt::AlignCenter); - ui_loading_text->append(p_text); -} - -QString Lobby::get_chatlog() -{ - QString return_value = ui_chatbox->toPlainText(); - - return return_value; -} - -int Lobby::get_selected_server() -{ - return ui_server_list->currentRow(); -} - -void Lobby::set_loading_value(int p_value) -{ - ui_progress_bar->setValue(p_value); -} - -void Lobby::on_public_servers_clicked() -{ - ui_public_servers->set_image("publicservers_selected.png"); - ui_favorites->set_image("favorites.png"); - - list_servers(); - - public_servers_selected = true; -} - -void Lobby::on_favorites_clicked() -{ - ui_favorites->set_image("favorites_selected.png"); - ui_public_servers->set_image("publicservers.png"); - - ao_app->set_favorite_list(); - //ao_app->favorite_list = read_serverlist_txt(); - - list_favorites(); - - public_servers_selected = false; -} - -void Lobby::on_refresh_pressed() -{ - ui_refresh->set_image("refresh_pressed.png"); -} - -void Lobby::on_refresh_released() -{ - ui_refresh->set_image("refresh.png"); - - AOPacket *f_packet = new AOPacket("ALL#%"); - - ao_app->send_ms_packet(f_packet); -} - -void Lobby::on_add_to_fav_pressed() -{ - ui_add_to_fav->set_image("addtofav_pressed.png"); -} - -void Lobby::on_add_to_fav_released() -{ - ui_add_to_fav->set_image("addtofav.png"); - - //you cant add favorites from favorites m8 - if (!public_servers_selected) - return; - - ao_app->add_favorite_server(ui_server_list->currentRow()); -} - -void Lobby::on_connect_pressed() -{ - ui_connect->set_image("connect_pressed.png"); -} - -void Lobby::on_connect_released() -{ - ui_connect->set_image("connect.png"); - - AOPacket *f_packet; - - f_packet = new AOPacket("askchaa#%"); - - ao_app->send_server_packet(f_packet); -} - -void Lobby::on_about_clicked() -{ +#include "lobby.h" + +#include "aoapplication.h" +#include "aosfxplayer.h" +#include "debug_functions.h" +#include "networkmanager.h" + +Lobby::Lobby(AOApplication *p_ao_app) : QMainWindow() +{ + ao_app = p_ao_app; + + this->setWindowTitle(tr("Attorney Online 2")); + this->setWindowIcon(QIcon(":/logo.png")); + + ui_background = new AOImage(this, ao_app); + ui_public_servers = new AOButton(this, ao_app); + ui_favorites = new AOButton(this, ao_app); + ui_refresh = new AOButton(this, ao_app); + ui_add_to_fav = new AOButton(this, ao_app); + ui_connect = new AOButton(this, ao_app); + ui_version = new QLabel(this); + ui_about = new AOButton(this, ao_app); + ui_server_list = new QListWidget(this); + ui_player_count = new QLabel(this); + ui_description = new AOTextArea(this); + ui_chatbox = new AOTextArea(this); + ui_chatbox->setOpenExternalLinks(true); + ui_chatname = new QLineEdit(this); + ui_chatname->setPlaceholderText(tr("Name")); + ui_chatname->setText(ao_app->get_ooc_name()); + ui_chatmessage = new QLineEdit(this); + ui_loading_background = new AOImage(this, ao_app); + ui_loading_text = new QTextEdit(ui_loading_background); + ui_progress_bar = new QProgressBar(ui_loading_background); + ui_progress_bar->setMinimum(0); + ui_progress_bar->setMaximum(100); + 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_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_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_cancel, SIGNAL(clicked()), ao_app, SLOT(loading_cancelled())); + + ui_connect->setEnabled(false); + + list_servers(); + + set_widgets(); +} + +// sets images, position and size +void Lobby::set_widgets() +{ + ao_app->reload_theme(); + + QString filename = "lobby_design.ini"; + + 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); + + // 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" + "Did you download all resources correctly from tiny.cc/getao, " + "including the large 'base' folder?")); + + this->resize(517, 666); + } + else { + this->resize(f_lobby.width, f_lobby.height); + } + + set_size_and_pos(ui_background, "lobby"); + ui_background->set_image("lobbybackground.png"); + + set_size_and_pos(ui_public_servers, "public_servers"); + ui_public_servers->set_image("publicservers_selected.png"); + + set_size_and_pos(ui_favorites, "favorites"); + ui_favorites->set_image("favorites.png"); + + set_size_and_pos(ui_refresh, "refresh"); + ui_refresh->set_image("refresh.png"); + + set_size_and_pos(ui_add_to_fav, "add_to_fav"); + ui_add_to_fav->set_image("addtofav.png"); + + set_size_and_pos(ui_connect, "connect"); + ui_connect->set_image("connect.png"); + + set_size_and_pos(ui_version, "version"); + ui_version->setText(tr("Version: %1").arg(ao_app->get_version_string())); + + set_size_and_pos(ui_about, "about"); + ui_about->set_image("about.png"); + + set_size_and_pos(ui_server_list, "server_list"); + ui_server_list->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "font: bold;"); + + set_size_and_pos(ui_player_count, "player_count"); + ui_player_count->setText(tr("Offline")); + ui_player_count->setStyleSheet("font: bold;" + "color: white;" + "qproperty-alignment: AlignCenter;"); + + set_size_and_pos(ui_description, "description"); + ui_description->setReadOnly(true); + ui_description->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "color: white;"); + + set_size_and_pos(ui_chatbox, "chatbox"); + ui_chatbox->setReadOnly(true); + ui_chatbox->setStyleSheet( + "QTextBrowser{background-color: rgba(0, 0, 0, 0);}"); + + set_size_and_pos(ui_chatname, "chatname"); + ui_chatname->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "selection-background-color: rgba(0, 0, 0, 0);"); + + set_size_and_pos(ui_chatmessage, "chatmessage"); + ui_chatmessage->setStyleSheet( + "background-color: rgba(0, 0, 0, 0);" + "selection-background-color: rgba(0, 0, 0, 0);"); + + ui_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); + ui_loading_text->setAlignment(Qt::AlignCenter); + ui_loading_text->setFrameStyle(QFrame::NoFrame); + ui_loading_text->setStyleSheet("background-color: rgba(0, 0, 0, 0);" + "color: rgba(255, 128, 0, 255);"); + ui_loading_text->append(tr("Loading")); + + set_size_and_pos(ui_progress_bar, "progress_bar"); + set_size_and_pos(ui_cancel, "cancel"); + 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); + + if (design_ini_result.width < 0 || design_ini_result.height < 0) { + qDebug() << "W: could not find " << p_identifier << " in " << filename; + p_widget->hide(); + } + 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::set_loading_text(QString p_text) +{ + ui_loading_text->clear(); + ui_loading_text->setAlignment(Qt::AlignCenter); + ui_loading_text->append(p_text); +} + +QString Lobby::get_chatlog() +{ + QString return_value = ui_chatbox->toPlainText(); + + return return_value; +} + +int Lobby::get_selected_server() { return ui_server_list->currentRow(); } + +void Lobby::set_loading_value(int p_value) +{ + ui_progress_bar->setValue(p_value); +} + +void Lobby::on_public_servers_clicked() +{ + ui_public_servers->set_image("publicservers_selected.png"); + ui_favorites->set_image("favorites.png"); + + list_servers(); + + public_servers_selected = true; +} + +void Lobby::on_favorites_clicked() +{ + ui_favorites->set_image("favorites_selected.png"); + ui_public_servers->set_image("publicservers.png"); + + ao_app->set_favorite_list(); + // ao_app->favorite_list = read_serverlist_txt(); + + list_favorites(); + + public_servers_selected = false; +} + +void Lobby::on_refresh_pressed() +{ + ui_refresh->set_image("refresh_pressed.png"); +} + +void Lobby::on_refresh_released() +{ + ui_refresh->set_image("refresh.png"); + + AOPacket *f_packet = new AOPacket("ALL#%"); + + ao_app->send_ms_packet(f_packet); +} + +void Lobby::on_add_to_fav_pressed() +{ + ui_add_to_fav->set_image("addtofav_pressed.png"); +} + +void Lobby::on_add_to_fav_released() +{ + ui_add_to_fav->set_image("addtofav.png"); + + // you cant add favorites from favorites m8 + if (!public_servers_selected) + return; + + ao_app->add_favorite_server(ui_server_list->currentRow()); +} + +void Lobby::on_connect_pressed() +{ + ui_connect->set_image("connect_pressed.png"); +} + +void Lobby::on_connect_released() +{ + ui_connect->set_image("connect.png"); + + AOPacket *f_packet; + + f_packet = new AOPacket("askchaa#%"); + + ao_app->send_server_packet(f_packet); +} + +void Lobby::on_about_clicked() +{ QString msg = tr("

Attorney Online %1

" - "The courtroom drama simulator" - "

Source code: " - "" - "https://github.com/AttorneyOnline/AO2-Client" - "

Major development:
" + "The courtroom drama simulator" + "

Source code: " + "" + "https://github.com/AttorneyOnline/AO2-Client" + "

Major development:
" "OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, " "Cents02" - "

Special thanks:
" - "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " - "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " + "

Special thanks:
" + "Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), " + "Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, " "Noevain, Cronnicossy, Raidensnake") - .arg(ao_app->get_version_string()); - QMessageBox::about(this, "About", msg); -} - -//clicked on an item in the serverlist -void Lobby::on_server_list_clicked(QModelIndex p_model) -{ - if (p_model != last_model) - { - server_type f_server; - last_model = p_model; - int n_server = p_model.row(); - - if (n_server < 0) - return; - - if (public_servers_selected) - { - QVector f_server_list = ao_app->get_server_list(); - - if (n_server >= f_server_list.size()) - return; - - f_server = f_server_list.at(p_model.row()); - } - else - { - if (n_server >= ao_app->get_favorite_list().size()) - return; - - f_server = ao_app->get_favorite_list().at(p_model.row()); - } - - ui_description->clear(); - ui_description->append(f_server.desc); - - ui_description->moveCursor(QTextCursor::Start); - ui_description->ensureCursorVisible(); - - ui_player_count->setText(tr("Offline")); - - ui_connect->setEnabled(false); - - ao_app->net_manager->connect_to_server(f_server); - } -} - -//doubleclicked on an item in the serverlist so we'll connect right away -void Lobby::on_server_list_doubleclicked(QModelIndex p_model) -{ - on_server_list_clicked(p_model); - on_connect_released(); -} - -void Lobby::on_chatfield_return_pressed() -{ - //no you can't send empty messages - if (ui_chatname->text() == "" || ui_chatmessage->text() == "") - return; - - - QString f_header = "CT"; - QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()}; - - AOPacket *f_packet = new AOPacket(f_header, f_contents); - - ao_app->send_ms_packet(f_packet); - - ui_chatmessage->clear(); -} - -void Lobby::list_servers() -{ - public_servers_selected = true; - ui_favorites->set_image("favorites.png"); - ui_public_servers->set_image("publicservers_selected.png"); - - ui_server_list->clear(); - - for (server_type i_server : ao_app->get_server_list()) - { - ui_server_list->addItem(i_server.name); - } -} - -void Lobby::list_favorites() -{ - ui_server_list->clear(); - - for (server_type i_server : ao_app->get_favorite_list()) - { - ui_server_list->addItem(i_server.name); - } -} - -void Lobby::append_chatmessage(QString f_name, QString f_message) -{ + .arg(ao_app->get_version_string()); + QMessageBox::about(this, "About", msg); +} + +// clicked on an item in the serverlist +void Lobby::on_server_list_clicked(QModelIndex p_model) +{ + if (p_model != last_model) { + server_type f_server; + last_model = p_model; + int n_server = p_model.row(); + + if (n_server < 0) + return; + + if (public_servers_selected) { + QVector f_server_list = ao_app->get_server_list(); + + if (n_server >= f_server_list.size()) + return; + + f_server = f_server_list.at(p_model.row()); + } + else { + if (n_server >= ao_app->get_favorite_list().size()) + return; + + f_server = ao_app->get_favorite_list().at(p_model.row()); + } + + ui_description->clear(); + ui_description->append(f_server.desc); + + ui_description->moveCursor(QTextCursor::Start); + ui_description->ensureCursorVisible(); + + ui_player_count->setText(tr("Offline")); + + ui_connect->setEnabled(false); + + ao_app->net_manager->connect_to_server(f_server); + } +} + +// doubleclicked on an item in the serverlist so we'll connect right away +void Lobby::on_server_list_doubleclicked(QModelIndex p_model) +{ + on_server_list_clicked(p_model); + on_connect_released(); +} + +void Lobby::on_chatfield_return_pressed() +{ + // no you can't send empty messages + if (ui_chatname->text() == "" || ui_chatmessage->text() == "") + return; + + QString f_header = "CT"; + QStringList f_contents{ui_chatname->text(), ui_chatmessage->text()}; + + AOPacket *f_packet = new AOPacket(f_header, f_contents); + + ao_app->send_ms_packet(f_packet); + + ui_chatmessage->clear(); +} + +void Lobby::list_servers() +{ + public_servers_selected = true; + ui_favorites->set_image("favorites.png"); + ui_public_servers->set_image("publicservers_selected.png"); + + ui_server_list->clear(); + + for (server_type i_server : ao_app->get_server_list()) { + ui_server_list->addItem(i_server.name); + } +} + +void Lobby::list_favorites() +{ + ui_server_list->clear(); + + for (server_type i_server : ao_app->get_favorite_list()) { + ui_server_list->addItem(i_server.name); + } +} + +void Lobby::append_chatmessage(QString f_name, QString f_message) +{ ui_chatbox->append_chatmessage( f_name, f_message, ao_app->get_color("ooc_default_color", "courtroom_design.ini").name(), false); -} - -void Lobby::append_error(QString f_message) -{ - ui_chatbox->append_error(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)); - ui_player_count->setText(f_string); -} - -void Lobby::enable_connect_button() -{ - ui_connect->setEnabled(true); -} - -Lobby::~Lobby() -{ - -} +} + +void Lobby::append_error(QString f_message) +{ + ui_chatbox->append_error(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)); + ui_player_count->setText(f_string); +} + +void Lobby::enable_connect_button() { ui_connect->setEnabled(true); } + +Lobby::~Lobby() {} diff --git a/src/main.cpp b/src/main.cpp index 778323f..1b105c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,43 +1,44 @@ #include "aoapplication.h" -#include "datatypes.h" -#include "networkmanager.h" -#include "lobby.h" #include "courtroom.h" -#include +#include "datatypes.h" +#include "lobby.h" +#include "networkmanager.h" #include -#include #include +#include +#include int main(int argc, char *argv[]) { #if QT_VERSION > QT_VERSION_CHECK(5, 6, 0) - // High-DPI support is for Qt version >=5.6. - // However, many Linux distros still haven't brought their stable/LTS - // packages up to Qt 5.6, so this is conditional. - AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + // High-DPI support is for Qt version >=5.6. + // However, many Linux distros still haven't brought their stable/LTS + // packages up to Qt 5.6, so this is conditional. + AOApplication::setAttribute(Qt::AA_EnableHighDpiScaling); #endif - AOApplication main_app(argc, argv); + AOApplication main_app(argc, argv); - QSettings *configini = main_app.configini; + QSettings *configini = main_app.configini; - QString p_language = configini->value("language", QLocale::system().name()).toString(); - if (p_language == " " || p_language == "") - p_language = QLocale::system().name(); + QString p_language = + configini->value("language", QLocale::system().name()).toString(); + if (p_language == " " || p_language == "") + p_language = QLocale::system().name(); - QTranslator qtTranslator; - qtTranslator.load("qt_" + p_language, - QLibraryInfo::location(QLibraryInfo::TranslationsPath)); - main_app.installTranslator(&qtTranslator); + QTranslator qtTranslator; + qtTranslator.load("qt_" + p_language, + QLibraryInfo::location(QLibraryInfo::TranslationsPath)); + main_app.installTranslator(&qtTranslator); - QTranslator appTranslator; - qDebug() << ":/resource/translations/ao_" + p_language; - appTranslator.load("ao_" + p_language, ":/resource/translations/"); - main_app.installTranslator(&appTranslator); + QTranslator appTranslator; + qDebug() << ":/resource/translations/ao_" + p_language; + appTranslator.load("ao_" + p_language, ":/resource/translations/"); + main_app.installTranslator(&appTranslator); - main_app.construct_lobby(); - main_app.w_lobby->show(); - main_app.net_manager->connect_to_master(); - return main_app.exec(); + main_app.construct_lobby(); + main_app.w_lobby->show(); + main_app.net_manager->connect_to_master(); + return main_app.exec(); } diff --git a/src/misc_functions.cpp b/src/misc_functions.cpp index 2352055..cc14415 100644 --- a/src/misc_functions.cpp +++ b/src/misc_functions.cpp @@ -4,6 +4,6 @@ void delay(int p_milliseconds) { QTime dieTime = QTime::currentTime().addMSecs(p_milliseconds); - while(QTime::currentTime() < dieTime) + while (QTime::currentTime() < dieTime) QCoreApplication::processEvents(QEventLoop::AllEvents, 100); } diff --git a/src/networkmanager.cpp b/src/networkmanager.cpp index b029eab..cf89d0a 100644 --- a/src/networkmanager.cpp +++ b/src/networkmanager.cpp @@ -13,21 +13,23 @@ NetworkManager::NetworkManager(AOApplication *parent) : QObject(parent) ms_reconnect_timer = new QTimer(this); ms_reconnect_timer->setSingleShot(true); - QObject::connect(ms_reconnect_timer, SIGNAL(timeout()), this, SLOT(retry_ms_connect())); + QObject::connect(ms_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 master_config = + ao_app->configini->value("master", "").value(); if (master_config != "") ms_nosrv_hostname = master_config; } -NetworkManager::~NetworkManager() -{ - -} +NetworkManager::~NetworkManager() {} void NetworkManager::connect_to_master() { @@ -43,11 +45,11 @@ void NetworkManager::connect_to_master() void NetworkManager::connect_to_master_nosrv() { - QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); + QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, + SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); - QObject::connect(ms_socket, SIGNAL(connected()), - this, SLOT(on_ms_nosrv_connect_success())); + QObject::connect(ms_socket, SIGNAL(connected()), this, + SLOT(on_ms_nosrv_connect_success())); ms_socket->connectToHost(ms_nosrv_hostname, ms_port); } @@ -61,12 +63,10 @@ void NetworkManager::connect_to_server(server_type p_server) void NetworkManager::ship_ms_packet(QString p_packet) { - if (!ms_socket->isOpen()) - { + if (!ms_socket->isOpen()) { retry_ms_connect(); } - else - { + else { ms_socket->write(p_packet.toUtf8()); } } @@ -81,93 +81,86 @@ void NetworkManager::handle_ms_packet() QByteArray buffer = ms_socket->readAll(); QString in_data = QString::fromUtf8(buffer, buffer.size()); - if (!in_data.endsWith("%")) - { + if (!in_data.endsWith("%")) { ms_partial_packet = true; ms_temp_packet += in_data; return; } - else - { - if (ms_partial_packet) - { + else { + if (ms_partial_packet) { in_data = ms_temp_packet + in_data; ms_temp_packet = ""; ms_partial_packet = false; } } - QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); + QStringList packet_list = + in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); - for (QString packet : packet_list) - { + for (QString packet : packet_list) { AOPacket *f_packet = new AOPacket(packet); ao_app->ms_packet_received(f_packet); } } - void NetworkManager::perform_srv_lookup() { - #ifdef MS_FAILOVER_SUPPORTED +#ifdef MS_FAILOVER_SUPPORTED ms_dns = new QDnsLookup(QDnsLookup::SRV, ms_srv_hostname, this); connect(ms_dns, SIGNAL(finished()), this, SLOT(on_srv_lookup())); ms_dns->lookup(); - #endif +#endif } void NetworkManager::on_srv_lookup() { - #ifdef MS_FAILOVER_SUPPORTED +#ifdef MS_FAILOVER_SUPPORTED bool connected = false; - if (ms_dns->error() != QDnsLookup::NoError) - { + if (ms_dns->error() != QDnsLookup::NoError) { qWarning("SRV lookup of the master server DNS failed."); ms_dns->deleteLater(); } - else - { + else { const auto srv_records = ms_dns->serviceRecords(); - for (const QDnsServiceRecord &record : srv_records) - { - #ifdef DEBUG_NETWORK + for (const QDnsServiceRecord &record : srv_records) { +#ifdef DEBUG_NETWORK qDebug() << "Connecting to " << record.target() << ":" << record.port(); - #endif +#endif ms_socket->connectToHost(record.target(), record.port()); QTime timer; timer.start(); - do - { + do { ao_app->processEvents(); - if (ms_socket->state() == QAbstractSocket::ConnectedState) - { + if (ms_socket->state() == QAbstractSocket::ConnectedState) { connected = true; break; } - else if (ms_socket->state() != QAbstractSocket::ConnectingState - && ms_socket->state() != QAbstractSocket::HostLookupState - && ms_socket->error() != -1) - { + else if (ms_socket->state() != QAbstractSocket::ConnectingState && + ms_socket->state() != QAbstractSocket::HostLookupState && + ms_socket->error() != -1) { qDebug() << ms_socket->error(); - qWarning() << "Error connecting to master server:" << ms_socket->errorString(); + qWarning() << "Error connecting to master server:" + << ms_socket->errorString(); ms_socket->abort(); ms_socket->close(); break; } - } while (timer.elapsed() < timeout_milliseconds); // Very expensive spin-wait loop - it will bring CPU to 100%! - if (connected) - { - // Connect a one-shot signal in case the master server disconnects randomly - QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); + } while (timer.elapsed() < + timeout_milliseconds); // Very expensive spin-wait loop - it will + // bring CPU to 100%! + if (connected) { + // Connect a one-shot signal in case the master server disconnects + // randomly + QObject::connect( + ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, + SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); break; } - else - { + else { ms_socket->abort(); ms_socket->close(); } @@ -179,29 +172,30 @@ void NetworkManager::on_srv_lookup() connect_to_master_nosrv(); else emit ms_connect_finished(connected, false); - #endif +#endif } void NetworkManager::on_ms_nosrv_connect_success() { emit ms_connect_finished(true, false); - QObject::disconnect(ms_socket, SIGNAL(connected()), - this, SLOT(on_ms_nosrv_connect_success())); + QObject::disconnect(ms_socket, SIGNAL(connected()), this, + SLOT(on_ms_nosrv_connect_success())); - QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); + QObject::connect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, + SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); } void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error) { - qWarning() << "Master server socket error:" << ms_socket->errorString() - << "(" << error << ")"; + qWarning() << "Master server socket error:" << ms_socket->errorString() << "(" + << error << ")"; // Disconnect the one-shot signal - this way, failover connect attempts // don't trigger a full retry QObject::disconnect(ms_socket, SIGNAL(error(QAbstractSocket::SocketError)), - this, SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); + this, + SLOT(on_ms_socket_error(QAbstractSocket::SocketError))); emit ms_connect_finished(false, true); @@ -210,7 +204,8 @@ void NetworkManager::on_ms_socket_error(QAbstractSocket::SocketError error) void NetworkManager::retry_ms_connect() { - if (!ms_reconnect_timer->isActive() && ms_socket->state() != QAbstractSocket::ConnectingState) + if (!ms_reconnect_timer->isActive() && + ms_socket->state() != QAbstractSocket::ConnectingState) connect_to_master(); } @@ -219,27 +214,24 @@ void NetworkManager::handle_server_packet() QByteArray buffer = server_socket->readAll(); QString in_data = QString::fromUtf8(buffer, buffer.size()); - if (!in_data.endsWith("%")) - { + if (!in_data.endsWith("%")) { partial_packet = true; temp_packet += in_data; return; } - else - { - if (partial_packet) - { + else { + if (partial_packet) { in_data = temp_packet + in_data; temp_packet = ""; partial_packet = false; } } - QStringList packet_list = in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); + QStringList packet_list = + in_data.split("%", QString::SplitBehavior(QString::SkipEmptyParts)); - for (QString packet : packet_list) - { + for (QString packet : packet_list) { AOPacket *f_packet = new AOPacket(packet); ao_app->server_packet_received(f_packet); diff --git a/src/packet_distribution.cpp b/src/packet_distribution.cpp index d6518a3..a110ec4 100644 --- a/src/packet_distribution.cpp +++ b/src/packet_distribution.cpp @@ -1,493 +1,484 @@ -#include "aoapplication.h" - -#include "lobby.h" -#include "courtroom.h" -#include "networkmanager.h" -#include "encryption_functions.h" -#include "hardware_functions.h" -#include "debug_functions.h" - +#include "aoapplication.h" + +#include "courtroom.h" +#include "debug_functions.h" +#include "encryption_functions.h" +#include "hardware_functions.h" +#include "lobby.h" +#include "networkmanager.h" + void AOPacketLoadMusic(AOApplication *my_app, QString file_name, bool is_music) - { +{ if (is_music) { my_app->w_courtroom->append_music(file_name); - } + } else { my_app->w_courtroom->append_area(file_name); my_app->area_count++; - } + } for (int area_n = 0; area_n < my_app->area_count; area_n++) { my_app->w_courtroom->arup_append(0, "Unknown", "Unknown", "Unknown"); - } - } - -void AOApplication::ms_packet_received(AOPacket *p_packet) -{ - p_packet->net_decode(); - - QString header = p_packet->get_header(); - QStringList f_contents = p_packet->get_contents(); - -#ifdef DEBUG_NETWORK - if (header != "CHECK") - qDebug() << "R(ms):" << p_packet->to_string(); -#endif - - if (header == "ALL") - { - server_list.clear(); - - for (QString i_string : p_packet->get_contents()) - { - server_type f_server; - QStringList sub_contents = i_string.split("&"); - - if (sub_contents.size() < 4) - { - qDebug() << "W: malformed packet"; - continue; - } - - f_server.name = sub_contents.at(0); - f_server.desc = sub_contents.at(1); - f_server.ip = sub_contents.at(2); - f_server.port = sub_contents.at(3).toInt(); - - server_list.append(f_server); - } - - if (lobby_constructed) - { - w_lobby->list_servers(); - } - } - else if (header == "CT") - { - QString f_name, f_message; - - if (f_contents.size() == 1) - { - f_name = ""; - f_message = f_contents.at(0); - } - else if (f_contents.size() >= 2) - { - f_name = f_contents.at(0); - f_message = f_contents.at(1); - } - else - goto end; - - if (lobby_constructed) - { - w_lobby->append_chatmessage(f_name, f_message); - } - if (courtroom_constructed && courtroom_loaded) - { - w_courtroom->append_ms_chatmessage(f_name, f_message); - } - } - else if (header == "AO2CHECK") - { - send_ms_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%")); - send_ms_packet(new AOPacket("HI#" + get_hdid() + "#%")); - - if (f_contents.size() < 1) - goto end; - - QStringList version_contents = f_contents.at(0).split("."); - - if (version_contents.size() < 3) - goto end; - - int f_release = version_contents.at(0).toInt(); - int f_major = version_contents.at(1).toInt(); - int f_minor = version_contents.at(2).toInt(); - - if (get_release() > f_release) - goto end; - else if (get_release() == f_release) - { - if (get_major_version() > f_major) - goto end; - else if (get_major_version() == f_major) - { - if (get_minor_version() >= f_minor) - goto end; - } - } - - call_notice(tr("Outdated version! Your version: %1\n" - "Please go to aceattorneyonline.com to update.") - .arg(get_version_string())); - destruct_courtroom(); - destruct_lobby(); - } - else if (header == "DOOM") - { - call_notice(tr("You have been exiled from AO.\n" - "Have a nice day.")); - destruct_courtroom(); - destruct_lobby(); - } - - end: - - delete 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")); -} - -void AOApplication::server_packet_received(AOPacket *p_packet) -{ - p_packet->net_decode(); - - QString header = p_packet->get_header(); - QStringList f_contents = p_packet->get_contents(); - QString f_packet = p_packet->to_string(); - -#ifdef DEBUG_NETWORK - if (header != "checkconnection") - qDebug() << "R:" << f_packet; -#endif - - if (header == "decryptor") - { - if (f_contents.size() == 0) - goto end; - - //you may ask where 322 comes from. that would be a good question. - s_decryptor = fanta_decrypt(f_contents.at(0), 322).toUInt(); - - //default(legacy) values - encryption_needed = true; - yellow_text_enabled = false; - prezoom_enabled = false; - flipping_enabled = false; - custom_objection_enabled = false; - improved_loading_enabled = false; - desk_mod_enabled = false; - evidence_enabled = false; - cccc_ic_support_enabled = false; - arup_enabled = false; - casing_alerts_enabled = false; - modcall_reason_enabled = false; - looping_sfx_support_enabled = false; - - //workaround for tsuserver4 - if (f_contents.at(0) == "NOENCRYPT") - encryption_needed = false; - - QString f_hdid; - f_hdid = get_hdid(); - - AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%"); - send_server_packet(hi_packet); - } - else if (header == "ID") - { - if (f_contents.size() < 2) - goto end; - - s_pv = f_contents.at(0).toInt(); - server_software = f_contents.at(1); - - w_lobby->enable_connect_button(); - - send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%")); - } - else if (header == "CT") - { - if (f_contents.size() < 2) - goto end; - - 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)); - else - w_courtroom->append_server_chatmessage(f_contents.at(0), f_contents.at(1), "0"); - } - } - else if (header == "FL") - { - if (f_packet.contains("yellowtext",Qt::CaseInsensitive)) - yellow_text_enabled = true; - if (f_packet.contains("flipping",Qt::CaseInsensitive)) - flipping_enabled = true; - if (f_packet.contains("customobjections",Qt::CaseInsensitive)) - custom_objection_enabled = true; - if (f_packet.contains("fastloading",Qt::CaseInsensitive)) - improved_loading_enabled = true; - if (f_packet.contains("noencryption",Qt::CaseInsensitive)) - encryption_needed = false; - if (f_packet.contains("deskmod",Qt::CaseInsensitive)) - desk_mod_enabled = true; - if (f_packet.contains("evidence",Qt::CaseInsensitive)) - evidence_enabled = true; - if (f_packet.contains("cccc_ic_support",Qt::CaseInsensitive)) - cccc_ic_support_enabled = true; - if (f_packet.contains("arup",Qt::CaseInsensitive)) - arup_enabled = true; - if (f_packet.contains("casing_alerts",Qt::CaseInsensitive)) - casing_alerts_enabled = true; - if (f_packet.contains("modcall_reason",Qt::CaseInsensitive)) - modcall_reason_enabled = true; - if (f_packet.contains("looping_sfx",Qt::CaseInsensitive)) - looping_sfx_support_enabled = true; - - w_lobby->enable_connect_button(); - } - 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()); - } - else if (header == "SI") - { - if (f_contents.size() != 3) - goto end; - - char_list_size = f_contents.at(0).toInt(); - evidence_list_size = f_contents.at(1).toInt(); - music_list_size = f_contents.at(2).toInt(); - - if (char_list_size < 1 || evidence_list_size < 0 || music_list_size < 0) - goto end; - - loaded_chars = 0; - loaded_evidence = 0; - loaded_music = 0; - generated_chars = 0; - - destruct_courtroom(); - construct_courtroom(); - - courtroom_loaded = false; - - QString window_title = tr("Attorney Online 2"); - int selected_server = w_lobby->get_selected_server(); - - QString server_address = "", server_name = ""; - 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; - server_address = QString("%1:%2").arg(info.ip, info.port); - window_title += ": " + server_name; - } - } - else - { - if (selected_server >= 0 && selected_server < favorite_list.size()) { - auto info = favorite_list.at(selected_server); - server_name = info.name; - server_address = info.ip + info.port; - window_title += ": " + server_name; - } - } - - w_courtroom->set_window_title(window_title); - - w_lobby->show_loading_overlay(); - w_lobby->set_loading_text(tr("Loading")); - w_lobby->set_loading_value(0); - - AOPacket *f_packet; - - if(improved_loading_enabled) - f_packet = new AOPacket("RC#%"); - else - f_packet = new AOPacket("askchar2#%"); - - send_server_packet(f_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()); - } - else if (header == "CI") - { - if (!courtroom_constructed) - goto end; - - 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 - if (n_element == f_contents.size() - 1) - break; - - QStringList sub_elements = f_contents.at(n_element + 1).split("&"); - if (sub_elements.size() < 2) - break; - - char_type f_char; - f_char.name = sub_elements.at(0); - f_char.description = sub_elements.at(1); - f_char.evidence_string = sub_elements.at(3); - //temporary. the CharsCheck packet sets this properly - f_char.taken = false; - - ++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_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(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); - send_server_packet(new AOPacket("AN#" + next_packet_number + "#%")); - } - - } - 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) - goto end; - - if (f_contents.size() < 2) - goto end; - - QStringList sub_elements = f_contents.at(1).split("&"); - if (sub_elements.size() < 4) - goto end; - - evi_type f_evi; - f_evi.name = sub_elements.at(0); - f_evi.description = sub_elements.at(1); - //no idea what the number at position 2 is. probably an identifier? - f_evi.image = sub_elements.at(3); - - ++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_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(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") - { - 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) - { - if (f_contents.at(n_element).toInt() != loaded_music) - break; - - if (n_element == f_contents.size() - 1) - break; - - QString f_music = f_contents.at(n_element + 1); - - ++loaded_music; - - 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++) - { - 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(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") - { - if (!courtroom_constructed) - goto end; - - 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 - w_courtroom->set_taken(n_char, false); - } - } - - else if (header == "SC") - { - if (!courtroom_constructed) - goto end; - - 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; - f_char.name = sub_elements.at(0); - if (sub_elements.size() >= 2) - f_char.description = sub_elements.at(1); - - //temporary. the CharsCheck packet sets this properly - f_char.taken = false; - - ++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_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(total_loading_size)) * 100); - w_lobby->set_loading_value(loading_value); - } - - send_server_packet(new AOPacket("RM#%")); - } + } +} + +void AOApplication::ms_packet_received(AOPacket *p_packet) +{ + p_packet->net_decode(); + + QString header = p_packet->get_header(); + QStringList f_contents = p_packet->get_contents(); + +#ifdef DEBUG_NETWORK + if (header != "CHECK") + qDebug() << "R(ms):" << p_packet->to_string(); +#endif + + if (header == "ALL") { + server_list.clear(); + + for (QString i_string : p_packet->get_contents()) { + server_type f_server; + QStringList sub_contents = i_string.split("&"); + + if (sub_contents.size() < 4) { + qDebug() << "W: malformed packet"; + continue; + } + + f_server.name = sub_contents.at(0); + f_server.desc = sub_contents.at(1); + f_server.ip = sub_contents.at(2); + f_server.port = sub_contents.at(3).toInt(); + + server_list.append(f_server); + } + + if (lobby_constructed) { + w_lobby->list_servers(); + } + } + else if (header == "CT") { + QString f_name, f_message; + + if (f_contents.size() == 1) { + f_name = ""; + f_message = f_contents.at(0); + } + else if (f_contents.size() >= 2) { + f_name = f_contents.at(0); + f_message = f_contents.at(1); + } + else + goto end; + + if (lobby_constructed) { + w_lobby->append_chatmessage(f_name, f_message); + } + if (courtroom_constructed && courtroom_loaded) { + w_courtroom->append_ms_chatmessage(f_name, f_message); + } + } + else if (header == "AO2CHECK") { + send_ms_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%")); + send_ms_packet(new AOPacket("HI#" + get_hdid() + "#%")); + + if (f_contents.size() < 1) + goto end; + + QStringList version_contents = f_contents.at(0).split("."); + + if (version_contents.size() < 3) + goto end; + + int f_release = version_contents.at(0).toInt(); + int f_major = version_contents.at(1).toInt(); + int f_minor = version_contents.at(2).toInt(); + + if (get_release() > f_release) + goto end; + else if (get_release() == f_release) { + if (get_major_version() > f_major) + goto end; + else if (get_major_version() == f_major) { + if (get_minor_version() >= f_minor) + goto end; + } + } + + call_notice(tr("Outdated version! Your version: %1\n" + "Please go to aceattorneyonline.com to update.") + .arg(get_version_string())); + destruct_courtroom(); + destruct_lobby(); + } + else if (header == "DOOM") { + call_notice(tr("You have been exiled from AO.\n" + "Have a nice day.")); + destruct_courtroom(); + destruct_lobby(); + } + +end: + + delete 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")); +} + +void AOApplication::server_packet_received(AOPacket *p_packet) +{ + p_packet->net_decode(); + + QString header = p_packet->get_header(); + QStringList f_contents = p_packet->get_contents(); + QString f_packet = p_packet->to_string(); + +#ifdef DEBUG_NETWORK + if (header != "checkconnection") + qDebug() << "R:" << f_packet; +#endif + + if (header == "decryptor") { + if (f_contents.size() == 0) + goto end; + + // you may ask where 322 comes from. that would be a good question. + s_decryptor = fanta_decrypt(f_contents.at(0), 322).toUInt(); + + // default(legacy) values + encryption_needed = true; + yellow_text_enabled = false; + prezoom_enabled = false; + flipping_enabled = false; + custom_objection_enabled = false; + improved_loading_enabled = false; + desk_mod_enabled = false; + evidence_enabled = false; + cccc_ic_support_enabled = false; + arup_enabled = false; + casing_alerts_enabled = false; + modcall_reason_enabled = false; + looping_sfx_support_enabled = false; + + // workaround for tsuserver4 + if (f_contents.at(0) == "NOENCRYPT") + encryption_needed = false; + + QString f_hdid; + f_hdid = get_hdid(); + + AOPacket *hi_packet = new AOPacket("HI#" + f_hdid + "#%"); + send_server_packet(hi_packet); + } + else if (header == "ID") { + if (f_contents.size() < 2) + goto end; + + s_pv = f_contents.at(0).toInt(); + server_software = f_contents.at(1); + + w_lobby->enable_connect_button(); + + send_server_packet(new AOPacket("ID#AO2#" + get_version_string() + "#%")); + } + else if (header == "CT") { + if (f_contents.size() < 2) + goto end; + + 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)); + else + w_courtroom->append_server_chatmessage(f_contents.at(0), + f_contents.at(1), "0"); + } + } + else if (header == "FL") { + if (f_packet.contains("yellowtext", Qt::CaseInsensitive)) + yellow_text_enabled = true; + if (f_packet.contains("flipping", Qt::CaseInsensitive)) + flipping_enabled = true; + if (f_packet.contains("customobjections", Qt::CaseInsensitive)) + custom_objection_enabled = true; + if (f_packet.contains("fastloading", Qt::CaseInsensitive)) + improved_loading_enabled = true; + if (f_packet.contains("noencryption", Qt::CaseInsensitive)) + encryption_needed = false; + if (f_packet.contains("deskmod", Qt::CaseInsensitive)) + desk_mod_enabled = true; + if (f_packet.contains("evidence", Qt::CaseInsensitive)) + evidence_enabled = true; + if (f_packet.contains("cccc_ic_support", Qt::CaseInsensitive)) + cccc_ic_support_enabled = true; + if (f_packet.contains("arup", Qt::CaseInsensitive)) + arup_enabled = true; + if (f_packet.contains("casing_alerts", Qt::CaseInsensitive)) + casing_alerts_enabled = true; + if (f_packet.contains("modcall_reason", Qt::CaseInsensitive)) + modcall_reason_enabled = true; + if (f_packet.contains("looping_sfx", Qt::CaseInsensitive)) + looping_sfx_support_enabled = true; + + w_lobby->enable_connect_button(); + } + 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()); + } + else if (header == "SI") { + if (f_contents.size() != 3) + goto end; + + char_list_size = f_contents.at(0).toInt(); + evidence_list_size = f_contents.at(1).toInt(); + music_list_size = f_contents.at(2).toInt(); + + if (char_list_size < 1 || evidence_list_size < 0 || music_list_size < 0) + goto end; + + loaded_chars = 0; + loaded_evidence = 0; + loaded_music = 0; + generated_chars = 0; + + destruct_courtroom(); + construct_courtroom(); + + courtroom_loaded = false; + + QString window_title = tr("Attorney Online 2"); + int selected_server = w_lobby->get_selected_server(); + + QString server_address = "", server_name = ""; + 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; + server_address = QString("%1:%2").arg(info.ip, info.port); + window_title += ": " + server_name; + } + } + else { + if (selected_server >= 0 && selected_server < favorite_list.size()) { + auto info = favorite_list.at(selected_server); + server_name = info.name; + server_address = info.ip + info.port; + window_title += ": " + server_name; + } + } + + w_courtroom->set_window_title(window_title); + + w_lobby->show_loading_overlay(); + w_lobby->set_loading_text(tr("Loading")); + w_lobby->set_loading_value(0); + + AOPacket *f_packet; + + if (improved_loading_enabled) + f_packet = new AOPacket("RC#%"); + else + f_packet = new AOPacket("askchar2#%"); + + send_server_packet(f_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()); + } + else if (header == "CI") { + if (!courtroom_constructed) + goto end; + + 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 + if (n_element == f_contents.size() - 1) + break; + + QStringList sub_elements = f_contents.at(n_element + 1).split("&"); + if (sub_elements.size() < 2) + break; + + char_type f_char; + f_char.name = sub_elements.at(0); + f_char.description = sub_elements.at(1); + f_char.evidence_string = sub_elements.at(3); + // temporary. the CharsCheck packet sets this properly + f_char.taken = false; + + ++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_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(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); + send_server_packet(new AOPacket("AN#" + next_packet_number + "#%")); + } + } + 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) + goto end; + + if (f_contents.size() < 2) + goto end; + + QStringList sub_elements = f_contents.at(1).split("&"); + if (sub_elements.size() < 4) + goto end; + + evi_type f_evi; + f_evi.name = sub_elements.at(0); + f_evi.description = sub_elements.at(1); + // no idea what the number at position 2 is. probably an identifier? + f_evi.image = sub_elements.at(3); + + ++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_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(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") { + 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) { + if (f_contents.at(n_element).toInt() != loaded_music) + break; + + if (n_element == f_contents.size() - 1) + break; + + QString f_music = f_contents.at(n_element + 1); + + ++loaded_music; + + 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++) { + 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(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") { + if (!courtroom_constructed) + goto end; + + 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 + w_courtroom->set_taken(n_char, false); + } + } + + else if (header == "SC") { + if (!courtroom_constructed) + goto end; + + 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; + f_char.name = sub_elements.at(0); + if (sub_elements.size() >= 2) + f_char.description = sub_elements.at(1); + + // temporary. the CharsCheck packet sets this properly + f_char.taken = false; + + ++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_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(total_loading_size)) * + 100); + w_lobby->set_loading_value(loading_value); + } + + send_server_packet(new AOPacket("RM#%")); + } else if (header == "SM") { - if (!courtroom_constructed) - goto end; - + if (!courtroom_constructed) + goto end; + bool musics_time = false; - area_count = 0; - + area_count = 0; + for (int n_element = 0; n_element < f_contents.size(); ++n_element) { int element2check = n_element + 1; if (element2check > f_contents.size()) { @@ -500,244 +491,220 @@ void AOApplication::server_packet_received(AOPacket *p_packet) f_contents.at(element2check).endsWith(".ogg") || f_contents.at(element2check).endsWith(".opus"))) { musics_time = true; - } + } // Not everything needs to have a thread. AOPacketLoadMusic(this, f_contents.at(n_element), musics_time); - ++loaded_music; + ++loaded_music; 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(total_loading_size)) * 100); - w_lobby->set_loading_value(loading_value); + w_lobby->set_loading_value(loading_value); w_lobby->set_loading_text(tr("Loading music:\n%1/%2") .arg(QString::number(loaded_music)) .arg(QString::number(music_list_size))); - } + } - send_server_packet(new AOPacket("RD#%")); - } - else if (header == "DONE") - { - if (!courtroom_constructed) - goto end; - - if (lobby_constructed) - w_courtroom->append_ms_chatmessage("", w_lobby->get_chatlog()); - - w_courtroom->character_loading_finished(); - w_courtroom->done_received(); - - courtroom_loaded = true; - - destruct_lobby(); - } - else if (header == "REFMUSIC") - { - if (courtroom_constructed) - w_courtroom->reset_music_list(); - 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") - { - if (f_contents.size() < 1) - goto end; - - if (courtroom_constructed) - w_courtroom->set_background(f_contents.at(0)); - } - //server accepting char request(CC) packet - else if (header == "PV") - { - 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") - { - w_courtroom->set_character(f_contents.at(2).toInt()); - } - else - { - w_courtroom->enter_courtroom(f_contents.at(2).toInt()); - } - } - } - } - else if (header == "MS") - { - if (courtroom_constructed && courtroom_loaded) - w_courtroom->handle_chatmessage(&p_packet->get_contents()); - } - else if (header == "MC") - { - if (courtroom_constructed && courtroom_loaded) - w_courtroom->handle_song(&p_packet->get_contents()); - } - else if (header == "RT") - { - if (f_contents.size() < 1) - goto end; - if (courtroom_constructed) - { - if (f_contents.size() == 1) - w_courtroom->handle_wtce(f_contents.at(0), 0); - else if (f_contents.size() == 2) { - w_courtroom->handle_wtce(f_contents.at(0), f_contents.at(1).toInt()); - } - } - } - else if (header == "HP") - { - if (courtroom_constructed && f_contents.size() > 1) - w_courtroom->set_hp_bar(f_contents.at(0).toInt(), f_contents.at(1).toInt()); - } - else if (header == "LE") - { - if (courtroom_constructed) - { - QVector f_evi_list; - - for (QString f_string : f_contents) - { - QStringList sub_contents = f_string.split("&"); - - if (sub_contents.size() < 3) - continue; - - evi_type f_evi; - f_evi.name = sub_contents.at(0); - f_evi.description = sub_contents.at(1); - f_evi.image = sub_contents.at(2); - - f_evi_list.append(f_evi); - } - - w_courtroom->set_evidence_list(f_evi_list); - } - } - else if (header == "ARUP") - { - if (courtroom_constructed) - { - int arup_type = f_contents.at(0).toInt(); - for (int n_element = 1 ; n_element < f_contents.size() ; n_element++) - { - w_courtroom->arup_modify(arup_type, n_element - 1, f_contents.at(n_element)); - } - } - } - else if (header == "FAILEDLOGIN") - { - if (courtroom_constructed) - w_courtroom->handle_failed_login(); - } - else if (header == "IL") - { - if (courtroom_constructed && f_contents.size() > 0) - w_courtroom->set_ip_list(f_contents.at(0)); - } - 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") - { - 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))); - 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))); - 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 == "ZZ") - { - if (courtroom_constructed && f_contents.size() > 0) - w_courtroom->mod_called(f_contents.at(0)); - } - 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"); - } - - end: - - delete p_packet; -} - -void AOApplication::send_ms_packet(AOPacket *p_packet) -{ - p_packet->net_encode(); - - QString f_packet = p_packet->to_string(); - - net_manager->ship_ms_packet(f_packet); - -#ifdef DEBUG_NETWORK - qDebug() << "S(ms):" << f_packet; -#endif - - delete p_packet; -} - -void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded) -{ - if (encoded) - p_packet->net_encode(); - - QString f_packet = p_packet->to_string(); - - if (encryption_needed) - { -#ifdef DEBUG_NETWORK - qDebug() << "S(e):" << f_packet; -#endif - - p_packet->encrypt_header(s_decryptor); - f_packet = p_packet->to_string(); - } - else - { + send_server_packet(new AOPacket("RD#%")); + } + else if (header == "DONE") { + + if (!courtroom_constructed) + goto end; + + if (lobby_constructed) + w_courtroom->append_ms_chatmessage("", w_lobby->get_chatlog()); + + w_courtroom->character_loading_finished(); + w_courtroom->done_received(); + + courtroom_loaded = true; + + destruct_lobby(); + } + else if (header == "REFMUSIC") { + if (courtroom_constructed) + w_courtroom->reset_music_list(); + 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") { + + if (f_contents.size() < 1) + goto end; + + if (courtroom_constructed) + w_courtroom->set_background(f_contents.at(0)); + } + // server accepting char request(CC) packet + else if (header == "PV") { + 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") { + w_courtroom->set_character(f_contents.at(2).toInt()); + } + else { + w_courtroom->enter_courtroom(f_contents.at(2).toInt()); + } + } + } + } + else if (header == "MS") { + if (courtroom_constructed && courtroom_loaded) + w_courtroom->handle_chatmessage(&p_packet->get_contents()); + } + else if (header == "MC") { + if (courtroom_constructed && courtroom_loaded) + w_courtroom->handle_song(&p_packet->get_contents()); + } + else if (header == "RT") { + if (f_contents.size() < 1) + goto end; + if (courtroom_constructed) { + if (f_contents.size() == 1) + w_courtroom->handle_wtce(f_contents.at(0), 0); + else if (f_contents.size() == 2) { + w_courtroom->handle_wtce(f_contents.at(0), f_contents.at(1).toInt()); + } + } + } + else if (header == "HP") { + if (courtroom_constructed && f_contents.size() > 1) + w_courtroom->set_hp_bar(f_contents.at(0).toInt(), + f_contents.at(1).toInt()); + } + else if (header == "LE") { + if (courtroom_constructed) { + QVector f_evi_list; + + for (QString f_string : f_contents) { + QStringList sub_contents = f_string.split("&"); + + if (sub_contents.size() < 3) + continue; + + evi_type f_evi; + f_evi.name = sub_contents.at(0); + f_evi.description = sub_contents.at(1); + f_evi.image = sub_contents.at(2); + + f_evi_list.append(f_evi); + } + + w_courtroom->set_evidence_list(f_evi_list); + } + } + else if (header == "ARUP") { + if (courtroom_constructed) { + int arup_type = f_contents.at(0).toInt(); + for (int n_element = 1; n_element < f_contents.size(); n_element++) { + w_courtroom->arup_modify(arup_type, n_element - 1, + f_contents.at(n_element)); + } + } + } + else if (header == "FAILEDLOGIN") { + if (courtroom_constructed) + w_courtroom->handle_failed_login(); + } + else if (header == "IL") { + if (courtroom_constructed && f_contents.size() > 0) + w_courtroom->set_ip_list(f_contents.at(0)); + } + 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") { + 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))); + 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))); + 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 == "ZZ") { + if (courtroom_constructed && f_contents.size() > 0) + w_courtroom->mod_called(f_contents.at(0)); + } + 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"); + } + +end: + + delete p_packet; +} + +void AOApplication::send_ms_packet(AOPacket *p_packet) +{ + p_packet->net_encode(); + + QString f_packet = p_packet->to_string(); + + net_manager->ship_ms_packet(f_packet); + +#ifdef DEBUG_NETWORK + qDebug() << "S(ms):" << f_packet; +#endif + + delete p_packet; +} + +void AOApplication::send_server_packet(AOPacket *p_packet, bool encoded) +{ + if (encoded) + p_packet->net_encode(); + + QString f_packet = p_packet->to_string(); + + if (encryption_needed) { +#ifdef DEBUG_NETWORK + qDebug() << "S(e):" << f_packet; +#endif + + p_packet->encrypt_header(s_decryptor); + f_packet = p_packet->to_string(); + } + else { qDebug() << "S:" << f_packet; -#ifdef DEBUG_NETWORK - qDebug() << "S:" << f_packet; -#endif - } - - net_manager->ship_server_packet(f_packet); - - delete p_packet; -} +#ifdef DEBUG_NETWORK + qDebug() << "S:" << f_packet; +#endif + } + + net_manager->ship_server_packet(f_packet); + + delete p_packet; +} diff --git a/src/path_functions.cpp b/src/path_functions.cpp index 3723192..678543e 100644 --- a/src/path_functions.cpp +++ b/src/path_functions.cpp @@ -1,191 +1,191 @@ -#include "aoapplication.h" -#include "courtroom.h" -#include "file_functions.h" - -#include -#include -#include - -#ifdef BASE_OVERRIDE -#include "base_override.h" -#endif - -//this is a quite broad generalization -//the most common OSes(mac and windows) are _usually_ case insensitive -//however, there do exist mac installations with case sensitive filesystems -//in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac -#if (defined (LINUX) || defined (__linux__)) -#define CASE_SENSITIVE_FILESYSTEM -#endif - -QString AOApplication::get_base_path() -{ - QString base_path = ""; -#ifdef ANDROID - QString sdcard_storage = getenv("SECONDARY_STORAGE"); - if (dir_exists(sdcard_storage + "/AO2/")){ - base_path = sdcard_storage + "/AO2/"; - } - else { - QString external_storage = getenv("EXTERNAL_STORAGE"); - base_path = external_storage + "/AO2/"; - } -#elif defined __APPLE__ - base_path = applicationDirPath() + "/../../../base/"; -#else - base_path = applicationDirPath() + "/base/"; -#endif - - return base_path; -} - -QString AOApplication::get_data_path() -{ - return get_base_path() + "data/"; -} - -QString AOApplication::get_default_theme_path(QString p_file) -{ - QString path = get_base_path() + "themes/default/" + p_file; -#ifndef CASE_SENSITIVE_FILESYSTEM - return path; -#else - return get_case_sensitive_path(path); -#endif -} - -QString AOApplication::get_custom_theme_path(QString p_theme, QString p_file) -{ - QString path = get_base_path() + "themes/" + p_theme + "/" + p_file; -#ifndef CASE_SENSITIVE_FILESYSTEM - return path; -#else - return get_case_sensitive_path(path); -#endif -} - -QString AOApplication::get_theme_path(QString p_file) -{ - QString path = get_base_path() + "themes/" + current_theme + "/" + p_file; -#ifndef CASE_SENSITIVE_FILESYSTEM - return path; -#else - return get_case_sensitive_path(path); -#endif -} - -QString AOApplication::get_character_path(QString p_char, QString p_file) -{ - QString path = get_base_path() + "characters/" + p_char + "/" + p_file; -#ifndef CASE_SENSITIVE_FILESYSTEM - return path; -#else - return get_case_sensitive_path(path); -#endif -} - -QString AOApplication::get_sounds_path(QString p_file) -{ - QString path = get_base_path() + "sounds/general/" + p_file; -#ifndef CASE_SENSITIVE_FILESYSTEM - return path; -#else - return get_case_sensitive_path(path); -#endif -} - -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)) - { - #ifndef CASE_SENSITIVE_FILESYSTEM - return opus_check; - #else - return get_case_sensitive_path(opus_check); - #endif - } - 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)) - { - #ifndef CASE_SENSITIVE_FILESYSTEM - return withending_check; - #else - return get_case_sensitive_path(withending_check); - #endif - } -#ifndef CASE_SENSITIVE_FILESYSTEM - return get_base_path() + "sounds/music/" + p_song + ".wav"; +#include "aoapplication.h" +#include "courtroom.h" +#include "file_functions.h" + +#include +#include +#include + +#ifdef BASE_OVERRIDE +#include "base_override.h" +#endif + +// this is a quite broad generalization +// the most common OSes(mac and windows) are _usually_ case insensitive +// however, there do exist mac installations with case sensitive filesystems +// in that case, define CASE_SENSITIVE_FILESYSTEM and compile on a mac +#if (defined(LINUX) || defined(__linux__)) +#define CASE_SENSITIVE_FILESYSTEM +#endif + +QString AOApplication::get_base_path() +{ + QString base_path = ""; +#ifdef ANDROID + QString sdcard_storage = getenv("SECONDARY_STORAGE"); + if (dir_exists(sdcard_storage + "/AO2/")) { + base_path = sdcard_storage + "/AO2/"; + } + else { + QString external_storage = getenv("EXTERNAL_STORAGE"); + base_path = external_storage + "/AO2/"; + } +#elif defined __APPLE__ + base_path = applicationDirPath() + "/../../../base/"; +#else + base_path = applicationDirPath() + "/base/"; +#endif + + return base_path; +} + +QString AOApplication::get_data_path() { return get_base_path() + "data/"; } + +QString AOApplication::get_default_theme_path(QString p_file) +{ + QString path = get_base_path() + "themes/default/" + p_file; +#ifndef CASE_SENSITIVE_FILESYSTEM + return path; +#else + return get_case_sensitive_path(path); +#endif +} + +QString AOApplication::get_custom_theme_path(QString p_theme, QString p_file) +{ + QString path = get_base_path() + "themes/" + p_theme + "/" + p_file; +#ifndef CASE_SENSITIVE_FILESYSTEM + return path; +#else + return get_case_sensitive_path(path); +#endif +} + +QString AOApplication::get_theme_path(QString p_file) +{ + QString path = get_base_path() + "themes/" + current_theme + "/" + p_file; +#ifndef CASE_SENSITIVE_FILESYSTEM + return path; +#else + return get_case_sensitive_path(path); +#endif +} + +QString AOApplication::get_character_path(QString p_char, QString p_file) +{ + QString path = get_base_path() + "characters/" + p_char + "/" + p_file; +#ifndef CASE_SENSITIVE_FILESYSTEM + return path; +#else + return get_case_sensitive_path(path); +#endif +} + +QString AOApplication::get_sounds_path(QString p_file) +{ + QString path = get_base_path() + "sounds/general/" + p_file; +#ifndef CASE_SENSITIVE_FILESYSTEM + return path; +#else + return get_case_sensitive_path(path); +#endif +} + +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)) { +#ifndef CASE_SENSITIVE_FILESYSTEM + return opus_check; +#else + return get_case_sensitive_path(opus_check); +#endif + } + 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)) { +#ifndef CASE_SENSITIVE_FILESYSTEM + return withending_check; +#else + return get_case_sensitive_path(withending_check); +#endif + } +#ifndef CASE_SENSITIVE_FILESYSTEM + return get_base_path() + "sounds/music/" + p_song + ".wav"; ; -#else - 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; - if (courtroom_constructed) { -#ifndef CASE_SENSITIVE_FILESYSTEM - return path; -#else - return get_case_sensitive_path(path); -#endif - } - return get_default_background_path(p_file); -} - -QString AOApplication::get_default_background_path(QString p_file) -{ - QString path = get_base_path() + "background/default/" + p_file; -#ifndef CASE_SENSITIVE_FILESYSTEM - return path; -#else - return get_case_sensitive_path(path); -#endif -} - -QString AOApplication::get_evidence_path(QString p_file) -{ - QString path = get_base_path() + "evidence/" + p_file; -#ifndef CASE_SENSITIVE_FILESYSTEM - return path; -#else - return get_case_sensitive_path(path); -#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; - - QFileInfo file(p_file); - - QString file_basename = file.fileName(); - QString file_parent_dir = get_case_sensitive_path(file.absolutePath()); - - //second, does it exist in the new parent dir? - if (exists(file_parent_dir + "/" + file_basename)) - return file_parent_dir + "/" + file_basename; - - //last resort, dirlist parent dir and find case insensitive match - QRegExp file_rx = QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString); - QStringList files = QDir(file_parent_dir).entryList(); - - int result = files.indexOf(file_rx); - - if (result != -1) - return file_parent_dir + "/" + files.at(result); - - //if nothing is found, let the caller handle the missing file - return file_parent_dir + "/" + file_basename; -} +#else + 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; + if (courtroom_constructed) { +#ifndef CASE_SENSITIVE_FILESYSTEM + return path; +#else + return get_case_sensitive_path(path); +#endif + } + return get_default_background_path(p_file); +} + +QString AOApplication::get_default_background_path(QString p_file) +{ + QString path = get_base_path() + "background/default/" + p_file; +#ifndef CASE_SENSITIVE_FILESYSTEM + return path; +#else + return get_case_sensitive_path(path); +#endif +} + +QString AOApplication::get_evidence_path(QString p_file) +{ + QString path = get_base_path() + "evidence/" + p_file; +#ifndef CASE_SENSITIVE_FILESYSTEM + return path; +#else + return get_case_sensitive_path(path); +#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; + + QFileInfo file(p_file); + + QString file_basename = file.fileName(); + QString file_parent_dir = get_case_sensitive_path(file.absolutePath()); + + // second, does it exist in the new parent dir? + if (exists(file_parent_dir + "/" + file_basename)) + return file_parent_dir + "/" + file_basename; + + // last resort, dirlist parent dir and find case insensitive match + QRegExp file_rx = + QRegExp(file_basename, Qt::CaseInsensitive, QRegExp::FixedString); + QStringList files = QDir(file_parent_dir).entryList(); + + int result = files.indexOf(file_rx); + + if (result != -1) + return file_parent_dir + "/" + files.at(result); + + // if nothing is found, let the caller handle the missing file + return file_parent_dir + "/" + file_basename; +} diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 1fbb0b5..29c5c42 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -1,51 +1,51 @@ -#include "text_file_functions.h" - -QString AOApplication::read_theme() -{ - QString result = configini->value("theme", "default").value(); - return result; -} - -int AOApplication::read_blip_rate() -{ - int result = configini->value("blip_rate", 2).toInt(); - - if (result < 1) - return 1; - - return result; -} - -QString AOApplication::get_ooc_name() -{ - QString result = configini->value("ooc_name").value(); - return result; -} - -int AOApplication::get_default_music() -{ - int result = configini->value("default_music", 50).toInt(); - return result; -} - -int AOApplication::get_default_sfx() -{ - int result = configini->value("default_sfx", 50).toInt(); - return result; -} - -int AOApplication::get_default_blip() -{ - int result = configini->value("default_blip", 50).toInt(); - return result; -} - -int AOApplication::get_max_log_size() -{ - int result = configini->value("log_maximum", 200).toInt(); - return result; -} - +#include "text_file_functions.h" + +QString AOApplication::read_theme() +{ + QString result = configini->value("theme", "default").value(); + return result; +} + +int AOApplication::read_blip_rate() +{ + int result = configini->value("blip_rate", 2).toInt(); + + if (result < 1) + return 1; + + return result; +} + +QString AOApplication::get_ooc_name() +{ + QString result = configini->value("ooc_name").value(); + return result; +} + +int AOApplication::get_default_music() +{ + int result = configini->value("default_music", 50).toInt(); + return result; +} + +int AOApplication::get_default_sfx() +{ + int result = configini->value("default_sfx", 50).toInt(); + return result; +} + +int AOApplication::get_default_blip() +{ + int result = configini->value("default_blip", 50).toInt(); + return result; +} + +int AOApplication::get_max_log_size() +{ + int result = configini->value("log_maximum", 200).toInt(); + return result; +} + int AOApplication::get_pundelay() { int result = configini->value("punctuation_delay", 2).toInt(); @@ -55,114 +55,114 @@ int AOApplication::get_pundelay() return result; } -bool AOApplication::get_log_goes_downwards() -{ - QString result = configini->value("log_goes_downwards", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_showname_enabled_by_default() -{ - QString result = configini->value("show_custom_shownames", "true").value(); - return result.startsWith("true"); -} - -QString AOApplication::get_default_username() -{ - QString result = configini->value("default_username", "").value(); - if (result.isEmpty()) - return get_ooc_name(); - else - return result; -} - -QString AOApplication::get_audio_output_device() -{ - QString result = configini->value("default_audio_device", "default").value(); - return result; -} - -QStringList AOApplication::get_call_words() -{ - QStringList return_value; - - QFile callwords_ini; - - callwords_ini.setFileName(get_base_path() + "callwords.ini"); - - if (!callwords_ini.open(QIODevice::ReadOnly)) - return return_value; - - QTextStream in(&callwords_ini); - - while (!in.atEnd()) - { - QString line = in.readLine(); - return_value.append(line); - } - - return return_value; -} - -void AOApplication::write_to_serverlist_txt(QString p_line) -{ - QFile serverlist_txt; - QString serverlist_txt_path = get_base_path() + "serverlist.txt"; - - serverlist_txt.setFileName(serverlist_txt_path); - - if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) - { - return; - } - - QTextStream out(&serverlist_txt); - - out << "\r\n" << p_line; - - serverlist_txt.close(); -} - -QVector AOApplication::read_serverlist_txt() -{ - QVector f_server_list; - - QFile serverlist_txt; - QString serverlist_txt_path = get_base_path() + "serverlist.txt"; - - serverlist_txt.setFileName(serverlist_txt_path); - - if (!serverlist_txt.open(QIODevice::ReadOnly)) - { - return f_server_list; - } - - QTextStream in(&serverlist_txt); - - while(!in.atEnd()) - { - QString line = in.readLine(); - server_type f_server; - QStringList line_contents = line.split(":"); - - if (line_contents.size() < 3) - continue; - - f_server.ip = line_contents.at(0); - f_server.port = line_contents.at(1).toInt(); - f_server.name = line_contents.at(2); - f_server.desc = ""; - - f_server_list.append(f_server); - } - - return f_server_list; -} - -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); +bool AOApplication::get_log_goes_downwards() +{ + QString result = + configini->value("log_goes_downwards", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_showname_enabled_by_default() +{ + QString result = + configini->value("show_custom_shownames", "true").value(); + return result.startsWith("true"); +} + +QString AOApplication::get_default_username() +{ + QString result = configini->value("default_username", "").value(); + if (result.isEmpty()) + return get_ooc_name(); + else + return result; +} + +QString AOApplication::get_audio_output_device() +{ + QString result = + configini->value("default_audio_device", "default").value(); + return result; +} + +QStringList AOApplication::get_call_words() +{ + QStringList return_value; + + QFile callwords_ini; + + callwords_ini.setFileName(get_base_path() + "callwords.ini"); + + if (!callwords_ini.open(QIODevice::ReadOnly)) + return return_value; + + QTextStream in(&callwords_ini); + + while (!in.atEnd()) { + QString line = in.readLine(); + return_value.append(line); + } + + return return_value; +} + +void AOApplication::write_to_serverlist_txt(QString p_line) +{ + QFile serverlist_txt; + QString serverlist_txt_path = get_base_path() + "serverlist.txt"; + + serverlist_txt.setFileName(serverlist_txt_path); + + if (!serverlist_txt.open(QIODevice::WriteOnly | QIODevice::Append)) { + return; + } + + QTextStream out(&serverlist_txt); + + out << "\r\n" << p_line; + + serverlist_txt.close(); +} + +QVector AOApplication::read_serverlist_txt() +{ + QVector f_server_list; + + QFile serverlist_txt; + QString serverlist_txt_path = get_base_path() + "serverlist.txt"; + + serverlist_txt.setFileName(serverlist_txt_path); + + if (!serverlist_txt.open(QIODevice::ReadOnly)) { + return f_server_list; + } + + QTextStream in(&serverlist_txt); + + while (!in.atEnd()) { + QString line = in.readLine(); + server_type f_server; + QStringList line_contents = line.split(":"); + + if (line_contents.size() < 3) + continue; + + f_server.ip = line_contents.at(0); + f_server.port = line_contents.at(1).toInt(); + f_server.name = line_contents.at(2); + f_server.desc = ""; + + f_server_list.append(f_server); + } + + return f_server_list; +} + +QString AOApplication::read_design_ini(QString p_identifier, + QString p_design_path) +{ + QSettings settings(p_design_path, QSettings::IniFormat); + QVariant value = settings.value(p_identifier); if (value.isNull()) // Since the value wasn't found, maybe it uses the proper // config system { @@ -183,220 +183,213 @@ QString AOApplication::read_design_ini(QString p_identifier, QString p_design_pa value = settings.value(p_identifier + "/size"); } } - if (value.type() == QVariant::StringList) { - return value.toStringList().join(","); - } else { - return value.toString(); - } -} - -QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file) -{ - QString design_ini_path = get_theme_path(p_file); - QString default_path = get_default_theme_path(p_file); - QString f_result = read_design_ini(p_identifier, design_ini_path); - - QPoint return_value; - - return_value.setX(0); - return_value.setY(0); - - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return return_value; - } - - QStringList sub_line_elements = f_result.split(","); - - if (sub_line_elements.size() < 2) - return return_value; - - return_value.setX(sub_line_elements.at(0).toInt()); - return_value.setY(sub_line_elements.at(1).toInt()); - - return return_value; -} - -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); - QString f_result = read_design_ini(p_identifier, design_ini_path); - - pos_size_type return_value; - - return_value.x = 0; - return_value.y = 0; - return_value.width = -1; - return_value.height = -1; - - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return return_value; - } - - QStringList sub_line_elements = f_result.split(","); - - if (sub_line_elements.size() < 4) - return return_value; - - return_value.x = sub_line_elements.at(0).toInt(); - return_value.y = sub_line_elements.at(1).toInt(); - return_value.width = sub_line_elements.at(2).toInt(); - return_value.height = sub_line_elements.at(3).toInt(); - - return return_value; -} -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 == "") - { - f_result = read_design_ini(p_identifier, default_path); - if (f_result == "") - return "Sans"; - } - return f_result; -} -int AOApplication::get_font_size(QString p_identifier, QString p_file) -{ - QString design_ini_path = get_theme_path(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 == "") - { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return 10; - } - - return f_result.toInt(); -} - -QColor AOApplication::get_color(QString p_identifier, QString p_file) -{ - QString design_ini_path = get_theme_path(p_file); - QString default_path = get_default_theme_path(p_file); - QString f_result = read_design_ini(p_identifier, design_ini_path); - - QColor return_color(0, 0, 0); - - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return return_color; - } - - QStringList color_list = f_result.split(","); - - if (color_list.size() < 3) - return return_color; - - return_color.setRed(color_list.at(0).toInt()); - return_color.setGreen(color_list.at(1).toInt()); - return_color.setBlue(color_list.at(2).toInt()); - - return return_color; -} - -QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) -{ - QColor return_color(255, 255, 255); - - if (p_identifier == "_inline_grey") - { - return_color = QColor(187, 187, 187); - } - else - { - switch (p_identifier.toInt()) { - case 1: - return_color = QColor(0, 255, 0); - break; - case 2: - return_color = QColor(255, 0, 0); - break; - case 3: - return_color = QColor(255, 165, 0); - break; - case 4: - return_color = QColor(45, 150, 255); - break; - case 5: - return_color = QColor(255, 255, 0); - break; - case 7: - return_color = QColor(255, 192, 203); - break; - case 8: - return_color = QColor(0, 255, 255); - break; - case 0: - case 6: // 6 is rainbow. - default: - return_color = QColor(255, 255, 255); - break; - } - } - - p_identifier = p_identifier.prepend("c"); - QString design_ini_path = get_base_path() + "misc/" + p_chat + "/config.ini"; - QString default_path = get_base_path() + "misc/default/config.ini"; - QString f_result = read_design_ini(p_identifier, design_ini_path); - - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return return_color; - } - - QStringList color_list = f_result.split(","); - - if (color_list.size() < 3) - return return_color; - - return_color.setRed(color_list.at(0).toInt()); - return_color.setGreen(color_list.at(1).toInt()); - return_color.setBlue(color_list.at(2).toInt()); - - return return_color; -} - -QString AOApplication::get_sfx(QString p_identifier) -{ - QString design_ini_path = get_theme_path("courtroom_sounds.ini"); - QString default_path = get_default_theme_path("courtroom_sounds.ini"); - QString f_result = read_design_ini(p_identifier, design_ini_path); - - QString return_sfx = ""; - - if (f_result == "") - { - f_result = read_design_ini(p_identifier, default_path); - - if (f_result == "") - return return_sfx; - } - - return_sfx = f_result; - - return return_sfx; -} - + if (value.type() == QVariant::StringList) { + return value.toStringList().join(","); + } + else { + return value.toString(); + } +} + +QPoint AOApplication::get_button_spacing(QString p_identifier, QString p_file) +{ + QString design_ini_path = get_theme_path(p_file); + QString default_path = get_default_theme_path(p_file); + QString f_result = read_design_ini(p_identifier, design_ini_path); + + QPoint return_value; + + return_value.setX(0); + return_value.setY(0); + + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); + + if (f_result == "") + return return_value; + } + + QStringList sub_line_elements = f_result.split(","); + + if (sub_line_elements.size() < 2) + return return_value; + + return_value.setX(sub_line_elements.at(0).toInt()); + return_value.setY(sub_line_elements.at(1).toInt()); + + return return_value; +} + +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); + QString f_result = read_design_ini(p_identifier, design_ini_path); + + pos_size_type return_value; + + return_value.x = 0; + return_value.y = 0; + return_value.width = -1; + return_value.height = -1; + + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); + + if (f_result == "") + return return_value; + } + + QStringList sub_line_elements = f_result.split(","); + + if (sub_line_elements.size() < 4) + return return_value; + + return_value.x = sub_line_elements.at(0).toInt(); + return_value.y = sub_line_elements.at(1).toInt(); + return_value.width = sub_line_elements.at(2).toInt(); + return_value.height = sub_line_elements.at(3).toInt(); + + return return_value; +} +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 == "") { + f_result = read_design_ini(p_identifier, default_path); + if (f_result == "") + return "Sans"; + } + return f_result; +} +int AOApplication::get_font_size(QString p_identifier, QString p_file) +{ + QString design_ini_path = get_theme_path(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 == "") { + f_result = read_design_ini(p_identifier, default_path); + + if (f_result == "") + return 10; + } + + return f_result.toInt(); +} + +QColor AOApplication::get_color(QString p_identifier, QString p_file) +{ + QString design_ini_path = get_theme_path(p_file); + QString default_path = get_default_theme_path(p_file); + QString f_result = read_design_ini(p_identifier, design_ini_path); + + QColor return_color(0, 0, 0); + + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); + + if (f_result == "") + return return_color; + } + + QStringList color_list = f_result.split(","); + + if (color_list.size() < 3) + return return_color; + + return_color.setRed(color_list.at(0).toInt()); + return_color.setGreen(color_list.at(1).toInt()); + return_color.setBlue(color_list.at(2).toInt()); + + return return_color; +} + +QColor AOApplication::get_chat_color(QString p_identifier, QString p_chat) +{ + QColor return_color(255, 255, 255); + + if (p_identifier == "_inline_grey") { + return_color = QColor(187, 187, 187); + } + else { + switch (p_identifier.toInt()) { + case 1: + return_color = QColor(0, 255, 0); + break; + case 2: + return_color = QColor(255, 0, 0); + break; + case 3: + return_color = QColor(255, 165, 0); + break; + case 4: + return_color = QColor(45, 150, 255); + break; + case 5: + return_color = QColor(255, 255, 0); + break; + case 7: + return_color = QColor(255, 192, 203); + break; + case 8: + return_color = QColor(0, 255, 255); + break; + case 0: + case 6: // 6 is rainbow. + default: + return_color = QColor(255, 255, 255); + break; + } + } + + p_identifier = p_identifier.prepend("c"); + QString design_ini_path = get_base_path() + "misc/" + p_chat + "/config.ini"; + QString default_path = get_base_path() + "misc/default/config.ini"; + QString f_result = read_design_ini(p_identifier, design_ini_path); + + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); + + if (f_result == "") + return return_color; + } + + QStringList color_list = f_result.split(","); + + if (color_list.size() < 3) + return return_color; + + return_color.setRed(color_list.at(0).toInt()); + return_color.setGreen(color_list.at(1).toInt()); + return_color.setBlue(color_list.at(2).toInt()); + + return return_color; +} + +QString AOApplication::get_sfx(QString p_identifier) +{ + QString design_ini_path = get_theme_path("courtroom_sounds.ini"); + QString default_path = get_default_theme_path("courtroom_sounds.ini"); + QString f_result = read_design_ini(p_identifier, design_ini_path); + + QString return_sfx = ""; + + if (f_result == "") { + f_result = read_design_ini(p_identifier, default_path); + + if (f_result == "") + return return_sfx; + } + + return_sfx = f_result; + + return return_sfx; +} + QString AOApplication::get_music_prefix(QString song_to_check) { if (!file_exists(get_music_path(song_to_check))) { @@ -415,359 +408,398 @@ QString AOApplication::get_music_prefix(QString song_to_check) } } -QString AOApplication::get_sfx_suffix(QString sound_to_check) -{ +QString AOApplication::get_sfx_suffix(QString sound_to_check) +{ if (!file_exists(get_sounds_path(sound_to_check))) { - QString mp3_check = get_sounds_path(sound_to_check + ".mp3"); - QString opus_check = get_sounds_path(sound_to_check + ".opus"); - if (file_exists(opus_check)) - { - return sound_to_check + ".opus"; - } - else if (file_exists(mp3_check)) - { - return sound_to_check + ".mp3"; - } - return sound_to_check + ".wav"; + QString mp3_check = get_sounds_path(sound_to_check + ".mp3"); + QString opus_check = get_sounds_path(sound_to_check + ".opus"); + if (file_exists(opus_check)) { + return sound_to_check + ".opus"; + } + else if (file_exists(mp3_check)) { + return sound_to_check + ".mp3"; + } + return sound_to_check + ".wav"; } else { return sound_to_check; } } - -QString AOApplication::get_image_suffix(QString path_to_check) -{ + +QString AOApplication::get_image_suffix(QString path_to_check) +{ if (file_exists(path_to_check + ".webp")) return path_to_check + ".webp"; if (file_exists(path_to_check + ".apng")) return path_to_check + ".apng"; if (file_exists(path_to_check + ".gif")) - return path_to_check + ".gif"; + return path_to_check + ".gif"; return path_to_check + ".png"; -} - - -//returns whatever is to the right of "search_line =" within target_tag and 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); - settings.beginGroup(target_tag); - QString value = settings.value(p_search_line).toString(); - settings.endGroup(); - return value; -} - -QString AOApplication::get_char_name(QString p_char) -{ - QString f_result = read_char_ini(p_char, "name", "Options"); - - if (f_result == "") - return p_char; - else return f_result; -} - -QString AOApplication::get_showname(QString p_char) -{ - QString f_result = read_char_ini(p_char, "showname", "Options"); - QString f_needed = read_char_ini(p_char, "needs_showname", "Options"); - - if (f_needed.startsWith("false")) - return ""; - if (f_result == "") - return p_char; - else return f_result; -} - -QString AOApplication::get_char_side(QString p_char) -{ - QString f_result = read_char_ini(p_char, "side", "Options"); - - if (f_result == "") - return "wit"; - else return f_result; -} - -QString AOApplication::get_gender(QString p_char) -{ - QString f_result = read_char_ini(p_char, "gender", "Options"); - - if (f_result == "") - return "male"; - 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 - return f_result; -} - -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; -} - -int AOApplication::get_preanim_duration(QString p_char, QString p_emote) -{ - QString f_result = read_char_ini(p_char, p_emote, "Time"); - - if (f_result == "") - return -1; - else return f_result.toInt(); -} - -int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote) -{ - QString f_result = read_char_ini(p_char, "%" + p_emote, "Time"); - - if (f_result == "") - return -1; - else return f_result.toInt(); -} - -int AOApplication::get_emote_number(QString p_char) -{ - QString f_result = read_char_ini(p_char, "number", "Emotions"); - - if (f_result == "") - return 0; - 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"); - - QStringList result_contents = f_result.split("#"); - - if (result_contents.size() < 4) - { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return "normal"; - } - 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"); - - QStringList result_contents = f_result.split("#"); - - if (result_contents.size() < 4) - { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return ""; - } - 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"); - - QStringList result_contents = f_result.split("#"); - - if (result_contents.size() < 4) - { - qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; - return "normal"; - } - 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"); - - QStringList result_contents = f_result.split("#"); - - 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(); -} - -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"); - - QStringList result_contents = f_result.split("#"); - - if (result_contents.size() < 5) - return -1; - - QString string_result = result_contents.at(4); - if (string_result == "") - return -1; - - 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"); - - if (f_result == "") - return "1"; - 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"); - - if (f_result == "") - return "0"; - else return f_result; -} - -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")); - if (f_result == "") - return ""; - else return f_result; -} - -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")); - if (f_result == "") - return ""; - else return f_result; -} - - -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")); - if (f_result == "") - return ""; - 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"); - - if (f_result == "") - return 1; - else return f_result.toInt(); -} - -int AOApplication::get_text_delay(QString p_char, QString p_emote) -{ - QString f_result = read_char_ini(p_char, p_emote, "TextDelay"); - - if (f_result == "") - return -1; - else return f_result.toInt(); -} - -QString AOApplication::get_custom_realization(QString p_char) -{ - QString f_result = read_char_ini(p_char, "realization", "Options"); - - if (f_result == "") - return get_sfx("realization"); - else return f_result; -} - -bool AOApplication::get_blank_blip() -{ - QString result = configini->value("blank_blip", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_looping_sfx() -{ - QString result = configini->value("looping_sfx", "true").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_objectmusic() -{ - QString result = configini->value("kill_music_on_object", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::is_discord_enabled() -{ - QString result = configini->value("discord", "true").value(); - return result.startsWith("true"); -} - +} + +// 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); + settings.beginGroup(target_tag); + QString value = settings.value(p_search_line).toString(); + settings.endGroup(); + return value; +} + +QString AOApplication::get_char_name(QString p_char) +{ + QString f_result = read_char_ini(p_char, "name", "Options"); + + if (f_result == "") + return p_char; + else + return f_result; +} + +QString AOApplication::get_showname(QString p_char) +{ + QString f_result = read_char_ini(p_char, "showname", "Options"); + QString f_needed = read_char_ini(p_char, "needs_showname", "Options"); + + if (f_needed.startsWith("false")) + return ""; + if (f_result == "") + return p_char; + else + return f_result; +} + +QString AOApplication::get_char_side(QString p_char) +{ + QString f_result = read_char_ini(p_char, "side", "Options"); + + if (f_result == "") + return "wit"; + else + return f_result; +} + +QString AOApplication::get_gender(QString p_char) +{ + QString f_result = read_char_ini(p_char, "gender", "Options"); + + if (f_result == "") + return "male"; + 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 + return f_result; +} + +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; +} + +int AOApplication::get_preanim_duration(QString p_char, QString p_emote) +{ + QString f_result = read_char_ini(p_char, p_emote, "Time"); + + if (f_result == "") + return -1; + else + return f_result.toInt(); +} + +int AOApplication::get_ao2_preanim_duration(QString p_char, QString p_emote) +{ + QString f_result = read_char_ini(p_char, "%" + p_emote, "Time"); + + if (f_result == "") + return -1; + else + return f_result.toInt(); +} + +int AOApplication::get_emote_number(QString p_char) +{ + QString f_result = read_char_ini(p_char, "number", "Emotions"); + + if (f_result == "") + return 0; + 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"); + + QStringList result_contents = f_result.split("#"); + + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; + return "normal"; + } + 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"); + + QStringList result_contents = f_result.split("#"); + + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; + return ""; + } + 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"); + + QStringList result_contents = f_result.split("#"); + + if (result_contents.size() < 4) { + qDebug() << "W: misformatted char.ini: " << p_char << ", " << p_emote; + return "normal"; + } + 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"); + + QStringList result_contents = f_result.split("#"); + + 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(); +} + +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"); + + QStringList result_contents = f_result.split("#"); + + if (result_contents.size() < 5) + return -1; + + QString string_result = result_contents.at(4); + if (string_result == "") + return -1; + + 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"); + + if (f_result == "") + return "1"; + 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"); + + if (f_result == "") + return "0"; + else + return f_result; +} + +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")); + if (f_result == "") + return ""; + else + return f_result; +} + +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")); + if (f_result == "") + return ""; + else + return f_result; +} + +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")); + if (f_result == "") + return ""; + 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"); + + if (f_result == "") + return 1; + else + return f_result.toInt(); +} + +int AOApplication::get_text_delay(QString p_char, QString p_emote) +{ + QString f_result = read_char_ini(p_char, p_emote, "TextDelay"); + + if (f_result == "") + return -1; + else + return f_result.toInt(); +} + +QString AOApplication::get_custom_realization(QString p_char) +{ + QString f_result = read_char_ini(p_char, "realization", "Options"); + + if (f_result == "") + return get_sfx("realization"); + else + return get_sfx_suffix(f_result); +} + +bool AOApplication::get_blank_blip() +{ + QString result = configini->value("blank_blip", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_looping_sfx() +{ + QString result = configini->value("looping_sfx", "true").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_objectmusic() +{ + QString result = + configini->value("kill_music_on_object", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::is_discord_enabled() +{ + QString result = configini->value("discord", "true").value(); + return result.startsWith("true"); +} + bool AOApplication::is_keepevi_enabled() -{ +{ QString result = configini->value("keep_evidence", "false").value(); - return result.startsWith("true"); -} - - -bool AOApplication::get_casing_enabled() -{ - QString result = configini->value("casing_enabled", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_defence_enabled() -{ - QString result = configini->value("casing_defence_enabled", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_prosecution_enabled() -{ - QString result = configini->value("casing_prosecution_enabled", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_judge_enabled() -{ - QString result = configini->value("casing_judge_enabled", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_juror_enabled() -{ - QString result = configini->value("casing_juror_enabled", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_steno_enabled() -{ - QString result = configini->value("casing_steno_enabled", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_wit_enabled() -{ - QString result = configini->value("casing_wit_enabled", "false").value(); - return result.startsWith("true"); -} - -bool AOApplication::get_casing_cm_enabled() -{ - QString result = configini->value("casing_cm_enabled", "false").value(); - return result.startsWith("true"); -} - -QString AOApplication::get_casing_can_host_cases() -{ - QString result = configini->value("casing_can_host_cases", "Turnabout Check Your Settings").value(); - return result; -} + return result.startsWith("true"); +} + +bool AOApplication::get_casing_enabled() +{ + QString result = configini->value("casing_enabled", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_casing_defence_enabled() +{ + QString result = + configini->value("casing_defence_enabled", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_casing_prosecution_enabled() +{ + QString result = + configini->value("casing_prosecution_enabled", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_casing_judge_enabled() +{ + QString result = + configini->value("casing_judge_enabled", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_casing_juror_enabled() +{ + QString result = + configini->value("casing_juror_enabled", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_casing_steno_enabled() +{ + QString result = + configini->value("casing_steno_enabled", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_casing_wit_enabled() +{ + QString result = + configini->value("casing_wit_enabled", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_casing_cm_enabled() +{ + QString result = + configini->value("casing_cm_enabled", "false").value(); + return result.startsWith("true"); +} + +QString AOApplication::get_casing_can_host_cases() +{ + QString result = + configini->value("casing_can_host_cases", "Turnabout Check Your Settings") + .value(); + return result; +} bool AOApplication::get_colored_iclog_enabled() { From cd034b996ad2887b3f0b310e6839603f3064d294 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Fri, 17 Apr 2020 23:13:18 -0600 Subject: [PATCH 03/30] Change "Custom shownames:" to "Show custom IC names:" "shownames" isn't a word, and what does "Custom shownames" even mean anyway? "Show custom IC names" should do a better job at explaining what this option does. --- src/aooptionsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 3be8466..e01fc10 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -137,7 +137,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_username_textbox); ui_showname_lbl = new QLabel(ui_form_layout_widget); - ui_showname_lbl->setText(tr("Custom shownames:")); + ui_showname_lbl->setText(tr("Show custom IC names:")); ui_showname_lbl->setToolTip( tr("Gives the default value for the in-game 'Custom shownames' " "tickbox, which in turn determines whether the client should " From aed439658431cb3840c2b0b20be4b62a2e811efa Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Fri, 17 Apr 2020 23:21:05 -0600 Subject: [PATCH 04/30] Change tickbox to checkbox As far as I know checkbox is more common --- src/aooptionsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index e01fc10..a777ed2 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -140,7 +140,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_showname_lbl->setText(tr("Show custom IC names:")); ui_showname_lbl->setToolTip( tr("Gives the default value for the in-game 'Custom shownames' " - "tickbox, which in turn determines whether the client should " + "checkbox, which in turn determines whether the client should " "display custom in-character names.")); ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_showname_lbl); From 50d5aa2a0e1654414e8c4530a1dbbf6775507126 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Fri, 17 Apr 2020 23:26:44 -0600 Subject: [PATCH 05/30] Revert "Change "Custom shownames:" to "Show custom IC names:"" This reverts commit cd034b996ad2887b3f0b310e6839603f3064d294. --- src/aooptionsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index a777ed2..cc620ec 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -137,7 +137,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_username_textbox); ui_showname_lbl = new QLabel(ui_form_layout_widget); - ui_showname_lbl->setText(tr("Show custom IC names:")); + ui_showname_lbl->setText(tr("Custom shownames:")); ui_showname_lbl->setToolTip( tr("Gives the default value for the in-game 'Custom shownames' " "checkbox, which in turn determines whether the client should " From ee709f3c92908755ce99c73ad1a1600f8e912d33 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Fri, 17 Apr 2020 23:36:26 -0600 Subject: [PATCH 06/30] =?UTF-8?q?Change=20tickbox=20to=20checkbox=20on=20R?= =?UTF-8?q?EADME.md=20=E2=98=91=20As=20far=20as=20I=20know=20checkbox=20is?= =?UTF-8?q?=20more=20popular=20than=20tickbox,=20on=20Wikipedia=20for=20ex?= =?UTF-8?q?ample=20it's=20called=20checkbox.=20And=20some=20spell=20checke?= =?UTF-8?q?rs=20will=20highlight=20tickbox=20as=20a=20typo,=20but=20not=20?= =?UTF-8?q?checkbox.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5d8e2c6..1abd8df 100644 --- a/README.md +++ b/README.md @@ -157,19 +157,19 @@ Areas can be listed by clicking the A/M button (or `/switch_am`). The statuses o - `ic_chat_name`, which is an input field for your custom showname. Needs the same stuff. - `ao2_ic_chat_name`, which is the same as above, but comes into play when the background has a desk. - Further comments on this: all `ao2_` UI elements come into play when the background has a desk. However, in AO2 nowadays, it's customary for every background to have a desk, even if it's just an empty gif. So you most likely have never seen the `ao2_`-less UI elements ever come into play, unless someone mis-named a desk or something. - - `showname_enable` is a tickbox that toggles whether you should see shownames or not. This does not influence whether you can USE custom shownames or not, so you can have it off, while still showing a custom showname to everyone else. Needs X, Y, width, height as usual. + - `showname_enable` is a checkbox that toggles whether you should see shownames or not. This does not influence whether you can USE custom shownames or not, so you can have it off, while still showing a custom showname to everyone else. Needs X, Y, width, height as usual. - `settings` is a plain button that takes up the OS's looks, like the 'Call mod' button. Takes the same arguments as above. - You can also just type `/settings` in OOC. - `char_search` is a text input box on the character selection screen, which allows you to filter characters down to name. Needs the same arguments. - - `char_passworded` is a tickbox, that when ticked, shows all passworded characters on the character selection screen. Needs the same as above. - - `char_taken` is another tickbox, that does the same, but for characters that are taken. + - `char_passworded` is a checkbox, that when ticked, shows all passworded characters on the character selection screen. Needs the same as above. + - `char_taken` is another checkbox, that does the same, but for characters that are taken. - `not_guilty` is a button similar to the CE / WT buttons, that if pressed, plays the Not Guilty verdict animation. Needs the same arguments. - `guilty` is similar to `not_guilty`, but for the Guilty verdict. - `pair_button` is a toggleable button, that shows and hides the pairing list and the offset spinbox. Works similarly to the mute button. - `pair_list` is a list of all characters in alphabetical order, shown when the user presses the Pair button. If a character is clicked on it, it is selected as the character the user wants to pair up with. - `pair_offset_spinbox` is a spinbox that allows the user to choose between offsets of -100% to 100%. - `switch_area_music` is a button with the text 'A/M', that toggles between the music list and the areas list. Though the two are different, they are programmed to take the same space. - - `pre_no_interrupt` is a tickbox with the text 'No Intrpt', that toggles whether preanimations should delay the text or not. + - `pre_no_interrupt` is a checkbox with the text 'No Intrpt', that toggles whether preanimations should delay the text or not. - `area_free_color` is a combination of red, green, and blue values ranging from 0 to 255. This determines the colour of the area in the Area list if it's free, and has a status of `IDLE`. - `area_lfp_color` determines the colour of the area if its status is `LOOKING-FOR-PLAYERS`. - `area_casing_color` determines the colour of the area if its status is `CASING`. @@ -180,7 +180,7 @@ Areas can be listed by clicking the A/M button (or `/switch_am`). The statuses o - `ooc_default_color` determines the colour of the username in the OOC chat if the message doesn't come from the server. - `ooc_server_color` determines the colour of the username if the message arrived from the server. - `casing_button` is a button with the text 'Casing' that when clicked, brings up the Case Announcements dialog. You can give the case a name, and tick whom do you want to alert. You need to be a CM for it to go through. Only people who have at least one of the roles ticked will get the alert. - - `casing` is a tickbox with the text 'Casing'. If ticked, you will get the case announcements alerts you should get, in accordance to the above. In the settings, you can change your defaults on the 'Casing' tab. (That's a buncha things titled 'Casing'!) + - `casing` is a checkbox with the text 'Casing'. If ticked, you will get the case announcements alerts you should get, in accordance to the above. In the settings, you can change your defaults on the 'Casing' tab. (That's a buncha things titled 'Casing'!) --- From 9a041bdf2ac2818aeb02d470e9dc4051fa945a14 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sat, 18 Apr 2020 00:00:43 -0600 Subject: [PATCH 07/30] Change some tooltips --- src/aooptionsdialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index cc620ec..7185c7f 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -311,7 +311,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_music_volume_lbl = new QLabel(ui_audio_widget); ui_music_volume_lbl->setText(tr("Music:")); - ui_music_volume_lbl->setToolTip(tr("Sets the music's default volume.")); + ui_music_volume_lbl->setToolTip(tr("Sets the default volume for music.")); ui_audio_layout->setWidget(2, QFormLayout::LabelRole, ui_music_volume_lbl); @@ -326,8 +326,8 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_sfx_volume_lbl = new QLabel(ui_audio_widget); ui_sfx_volume_lbl->setText(tr("SFX:")); ui_sfx_volume_lbl->setToolTip( - tr("Sets the SFX's default volume. " - "Interjections and actual sound effects count as 'SFX'.")); + tr("Sets the default volume for SFX sounds, " + "like interjections or other character sound effects.")); ui_audio_layout->setWidget(3, QFormLayout::LabelRole, ui_sfx_volume_lbl); From ac60466ac93374ad888898c1b234523f18400d80 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sat, 18 Apr 2020 00:14:59 -0600 Subject: [PATCH 08/30] "IC_Log" -> "IC Log" --- src/aooptionsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 7185c7f..7077b26 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -574,7 +574,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) // ICLOG ui_other_tab = new QWidget(); - ui_settings_tabs->addTab(ui_other_tab, tr("IC_Log")); + ui_settings_tabs->addTab(ui_other_tab, tr("IC Log")); ui_other_widget = new QWidget(ui_other_tab); ui_other_widget->setGeometry(QRect(10, 10, 361, 211)); From 9faf41a89fcbf68476047ed9d701cd2cd3837bf7 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sat, 18 Apr 2020 00:45:13 -0600 Subject: [PATCH 09/30] "interupted" -> "interrupted"; "expierence" -> "experience" --- src/aooptionsdialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 7077b26..98ac59e 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -615,9 +615,9 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_other_mirror_icl_enabled_lb->setText(tr("Mirror IC log:")); ui_other_mirror_icl_enabled_lb->setToolTip( tr("IC log will mirror the IC box. " - "Meaning that if somebody gets interupted nobody will know what they " + "Meaning that if somebody gets interrupted nobody will know what they " "wanted to say. " - "Enable for a more realistic expierence")); + "Enable for a more realistic experience")); ui_other_layout->setWidget(3, QFormLayout::LabelRole, ui_other_mirror_icl_enabled_lb); ui_other_mirror_icl_enabled_cb = new QCheckBox(ui_other_widget); From 26872be05d328bffcece3fb204fc90ff3b433b9e Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sat, 18 Apr 2020 02:35:09 -0600 Subject: [PATCH 10/30] Add missing periods on two tooltips --- src/aooptionsdialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 98ac59e..7737a33 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -602,7 +602,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_other_fancy_icl_limit_lb = new QLabel(ui_other_widget); ui_other_fancy_icl_limit_lb->setText(tr("Only inline coloring:")); ui_other_fancy_icl_limit_lb->setToolTip( - tr("Only inline coloring will be shown such as <>,|| etc")); + tr("Only inline coloring will be shown such as <>,|| etc.")); ui_other_layout->setWidget(2, QFormLayout::LabelRole, ui_other_fancy_icl_limit_lb); ui_other_fancy_icl_limit_cb = new QCheckBox(ui_other_widget); @@ -617,7 +617,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) tr("IC log will mirror the IC box. " "Meaning that if somebody gets interrupted nobody will know what they " "wanted to say. " - "Enable for a more realistic experience")); + "Enable for a more realistic experience.")); ui_other_layout->setWidget(3, QFormLayout::LabelRole, ui_other_mirror_icl_enabled_lb); ui_other_mirror_icl_enabled_cb = new QCheckBox(ui_other_widget); From 58b77254069906e4ac7eff6548aa7b6ff1e026ef Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sat, 18 Apr 2020 02:40:46 -0600 Subject: [PATCH 11/30] Change second exclamation to period on tooltip No need for two exclamations --- src/courtroom.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index ca1c789..c0fb24b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3731,7 +3731,7 @@ void Courtroom::on_ooc_return_pressed() append_server_chatmessage( "CLIENT", tr("Too many arguments to save a case! You only need a filename " - "without extension and the courtroom status!"), + "without extension and the courtroom status."), "1"); ui_ooc_chat_message->clear(); return; From 696e4169d35ec562396d6a0fa3d202ad563caf56 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sat, 18 Apr 2020 03:26:46 -0600 Subject: [PATCH 12/30] Update Spanish translation --- resource/translations/ao_es.qm | Bin 26673 -> 27795 bytes resource/translations/ao_es.ts | 457 +++++++++++++++++++-------------- 2 files changed, 268 insertions(+), 189 deletions(-) diff --git a/resource/translations/ao_es.qm b/resource/translations/ao_es.qm index d40478337fd6acfd293ea4fa54afb8e0ad7202a7..cf636f364a2bd35a38b3f10070339b5573fb5927 100644 GIT binary patch delta 3247 zcmaJ?2~ExblFyP0w~n&G(ICo5m3{8ey}vW-eVzJov=RNjo=Ss&8uTU&|p*HQEO ze4_D7Y2)M@L{Zmhll=(M3)g6CJI*PVcAr>DlxU+v=Pwb3*V3u*$3&sW>26p%d8nX? z(>m6m!mFJ2gH13@=fZdHAR4!q6PrMy-8_Q(DG`c5X%5lkNJUr+IuLYAF?uf&n;4{+e7FULL?}#m@`+T*iu!Lm zJy6I~H1Yf`F54x#(9NkXTuR=X=`%0pSx735yl|x=o$8~~7sX6N0&F~+2Lp^=x8{oi6wMm(Z zxMS7To~37z=~ea1B~Btmk@|PbHz31<>b5o*X53cq_y7*$@2ihR_azeEQ$LEW0_Gq2 zW#4Q?B1im+97v$zf?pY{aP%5KTlQl>aMG{kA_`0T#P6+3xX*v!cQqcJ%3Puuk`PK% zdQVev0pw1yYCKkZ6H%Wk&8nr_!P+aD)4?!|GiokQ+D|m(JI#ZHheSG?=1H9j8L!hu zHlTG={IrP+XQJW(+GHd2a;|D$$(n$Kwb~`8;aKm~t{Q+qWw*2&3m*fr|7bg}T!sG^ zw153mHuNUxR0VyA{Olf`dfFwBqg*%kWvG5}S}{8LP~WBl*JgQQ^xHOVK}+2Fy|MX3llJI8FG0)49?)N?J_v_8{gruAkN|+c>I=cfM>nQ)0{_+I0u#(V?On3Djy@}cqxKHg^aU?sOp z+N>=w>M4svsv;)|mdS)qP-ewN~}JDinu zc0MbGw>zq&+XDx9Lk4cnC69^V2r;M>vdQ~ZH%9=Gg7fJIO2$fuF` zG|^uJIks>X?1))Z+hwApVb9*bPK6FlT8SN6Do>SUiT#Hm8jHj>WA>;0cOmP|oGN&q6A zoE_p}J&%B~2xnF(vvgc|H+Lt%u;HoKn%&!Q%X-cpR)7U3z7(Fv#R-jC=&@9JB*vmJ z6dG_U;MC@U5M>AKq6Rg)AXz6&GPtZ$ChCQ1laC90z0GdtYiv%Z!zrVLW3!_nlFt)N zqD`#AnF$D1@-9b>V0Ks+@l}G`1xVe3(^*&R2F9X;o#*&G%@-Z@d_A)PIz6K28or1}3bGdC6UTCNloHjwU2$8_Lzc*pX>OQ53-H7&({D;W0 z28!LdInk6_xqb)E*p&1RfFaLUUpM``qKiHAs04WUFu_2{Epv3!>3PcZ%vBHf?ew)A z!X)F(=B`G@Hj$F#lSXQkrGV5d&$N7efoNZZ*4b_17{NCptiv(_W`TEAJL*N=RcEQ@ zO)fq$DWb8F7u*)P8$~hCWbj)w)ujONb>}XybpNr!U0PsZ>cspO%`xWDw;S-Y8r1J zHuR_5*3`LdzD9Zf9=nJ04tr_1Zf%yqJ8N4pFROHZ&I(C0H&^PK8$2ctR`X;l-yT>9J;u#i z_+(@4rg(UYV!otXb6X~|J(JRXn$<%jOJyIg#mXyH>_0$SQ#Hc( Nae?WuyQA delta 2226 zcma)6ZBSI#8Gi2Fy}NstWfugcpu&ZiB1nLW3NDBsARoaM11ef2-7jSA0=m0cKU!8q zTR*C?y-lN*n2Zx`q_v7`GS$Sdm@;Z@qhiLYNIFTzG=8LZ%%rwSu+M_&IMY9!oxSfl z?|IMjKJW9MbJS}>&qZN-Y_JF@od!(33se|^*nVLC24F@aP=AE>Jh0#|K*?Tc)i;3r zyU-qN2MQaZ?E~!{NEMTTqO@UaFNU=2S)lknq&3HYj5#ofCy3dDu@T9D{T_0lhE)7H*s#iMn$Sm_Ubx9h{eCV)6aGKo!vOk`2i2 z#V#*Njyiz7yE(^P9C>dukoz0-ULOFyZO5gwL16Sre4f0U`~D^vT7Sl(ZGz#Lt$&}yDx}r5K0x$KzuLHiXKAd|)x~`!v!vez z&k%6RROwIIBY8N!FMXA>ggwgA&1q%A`Z8U8xRTU$I#1OgFl~~qv!4}MV|2eB;Chu) z_pz0Vl-$)P6js|oaWohmJ&q9~{%()q?T$amz&iDy?CEDSM6zzHaQ2dAR0v8Tapc6_`C>Jep$z@*Wzm)>7&89^;Ls z)5L2we)M51i3g7uAI4Du;R=SNy>EkKqv za@(myAmI;@S6<}p3f5eXy!sU#N-*-)3rm^s)5xzQQ`nmvb4=18ACL}n#(W+gVAwVs zHkYomvJ$Pi{TeIJ^q7D0iHq^q%{>!1&rL8N-tZal)G70kp9;KPS>}^3(?9c+x&J0@ zQn~rj$r)_PfJGFO`C3%0vP4@Oc>fn$vNmmFZ?9U)!|y<1oTY`Y9!h#GJ1&f41s_;K z2f9fp#`4G90U){Ca@k@7#-FzIc?$UuDQv9cqJ~UURK=MrOjM6IC57IU21TJ;eZw$Y zRxl5Ctb#ohBd3fAZ5sWu5IQvW7lN=;ElbK510J;sx`Tl z(Jr{5pcXSxk4%oL)w8*2k{7M;tNEF!K_A!c@bc^DsuOJ-wID!W%h0?P&5Tu$`WPb> znTD{UI{xR@x&wYC(BxKXXV$0s6_>lw-sTM`D_Xs6&F)O4vL)d5EpVsCLN zc4wf??p6G)ZJf9p8{H$EL~wE%Q0#ssHH@R$Cnu=yOxYT8PJL5QkL5Kh%761TxA{HJ z|H;H1@uB$qak6oUSTV9ND^y&%RnR12p1QwaOz2u!o}ivfP(o?t$F=HjpG^#zs=EZ$ zTR2{o%Hu;fW=+$nzJ}OPM%^8=a9jPBGj~B5MNueybaK~b|^_6em!vfGK|V~m%-aAX*B)le=g zk+O!c6!mRa=hP?Bi-{X%5N6{XV(EF@x-dq#oy#7tke9mB{i9%*i=V!K3}qRv!ZXxt zH<22NwVFGJ{cVhFqsPZRtw=)#S4xNSt)$1tj7{{6AFA*F#55D|2~c%nW4rO2qa>UO zU1^LF)cZ>gMd{f@sk+tSSS37hAwtKSYBcJ-iez=1cf=@$j6fNAgmv@5N-j_1JF3;2 T7R4nKY;*@m)Csq`#GCOSYJ^V| diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts index 4938f43..4dc58e6 100644 --- a/resource/translations/ao_es.ts +++ b/resource/translations/ao_es.ts @@ -1,20 +1,20 @@ - + AOApplication - + Disconnected from server. Desconectado del servidor. - + Error connecting to master server. Will try again in %1 seconds. Error al conectarse a la lista de servidores. Se intentará nuevamente en %1 segundos. - + There was an error connecting to the master server. 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. Please check your Internet connection and firewall, and please try again. @@ -22,67 +22,68 @@ Please check your Internet connection and firewall, and please try again.Hubo un error al obtener la lista de servidores. Verifique su conexión a Internet y firewall, y vuelva a intentarlo. - + Outdated version! Your version: %1 Please go to aceattorneyonline.com to update. - ¡Versión desactualizada! Su versión: %1 Vaya a aceattorneyonline.com para actualizar. + ¡Versión desactualizada! Su versión: %1 +Ingrese a aceattorneyonline.com para actualizar. - + You have been exiled from AO. Have a nice day. Has sido exiliado de AO. Que tengas un buen día. - + Attorney Online 2 - Attorney Online 2 + - + Loading Cargando - + Loading evidence: %1/%2 Cargando evidencia: %1/%2 - - + + Loading music: %1/%2 Cargando música: %1/%2 - - + + Loading chars: %1/%2 Cargando personajes: %1/%2 - + You have been kicked from the server. Reason: %1 Has sido expulsado del servidor. Razón: %1 - + You have been banned from the server. Reason: %1 Has sido bloqueado de este servidor. Razón: %1 - + You are banned on this server. Reason: %1 Has sido bloqueado en este servidor. @@ -104,42 +105,42 @@ Razón: AOCaseAnnouncerDialog - + Case Announcer Anunciar caso - + Case title: Título del caso: - + Defense needed Se necesita abogado - + Prosecution needed Se necesita fiscal - + Judge needed Se necesita juez - + Jurors needed Se necesita jurado - + Stenographer needed Se necesita taquígrafo - + Witness needed Se necesita testigo @@ -147,336 +148,399 @@ Razón: AOOptionsDialog - + Settings Ajustes - + Gameplay Jugabilidad - + Theme: Tema visual: - + Sets the theme used in-game. If the new theme changes the lobby's look as well, you'll need to reload the lobby for the changes to take effect, such as by joining a server and leaving it. Establece el tema visual utilizado en el juego. Si el nuevo tema también cambia el aspecto del lobby, deberá volver a cargar el lobby para que los cambios surtan efecto, como unirse a un servidor y volver al lobby. - + + Log goes downwards: Invertir historial IC: - + + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. Si está marcado, los nuevos mensajes aparecerán en la parte inferior (como el chat OOC). - + + Log length: Limite del historial: - + + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. La cantidad de mensajes que mantendrá el historial del chat IC antes de eliminar mensajes más antiguos. 0 significa 'infinito'. - + Default username: Usuario predeterminado: - + Your OOC name will be automatically set to this value when you join a server. Su nombre OOC se establecerá automáticamente a este cuando se una a un servidor. - + Custom shownames: Mostrar nombres: - Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. - Activa la casilla 'Mostrar nombres' de forma predeterminada en el juego, que a su vez determina si el cliente debe mostrar nombres personalizados en los personajes. + Activa la casilla 'Mostrar nombres' de forma predeterminada en el juego, que a su vez determina si el cliente debe mostrar nombres personalizados en los personajes. - + Backup MS: Master SV de respaldo: - + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. Si la lista de servidores predeterminada falla, el juego probará la dirección proporcionada aquí. - + Discord: Discord: - + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. Permite a otros en Discord ver en qué servidor estás, qué personaje juegas y cuánto tiempo has estado jugando. - + Allow Shake/Flash: Permitir Shake/Flash: - + Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. Permite el movimiento de la pantalla y el parpadeo. Desactive esto si tiene inquietudes o problemas con la fotosensibilidad y/o convulsiones. - + Language: Idioma: - + Sets the language if you don't want to use your system language. Establece el idioma si no desea utilizar el idioma de su sistema. - + Callwords Palabras clave - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> <html><head/><body>Ingrese tantas palabras de llamada como desee.<br>Esto no distingue entre mayúsculas y minúsculas. ¡Asegúrese de dejar cada palabra en su propia línea!<br>No deje una línea con un espacio al final; recibirá una alerta cada vez que alguien use un espacio en sus mensajes.</body></html> - + Audio Audio - + Audio device: Dispositivo: - + Sets the audio device for all sounds. Establece el dispositivo de audio. - + Music: Música: - Sets the music's default volume. - Establece el volumen predeterminado de la música. + Establece el volumen predeterminado de la música. - + SFX: SFX: - Sets the SFX's default volume. Interjections and actual sound effects count as 'SFX'. - Establece el volumen predeterminado de SFX. Las interjecciones y los efectos de sonido reales cuentan como 'SFX'. + Establece el volumen predeterminado de SFX. Las interjecciones y los efectos de sonido reales cuentan como 'SFX'. - + + Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. + Activa la casilla 'Mostrar nombres' de forma predeterminada en el juego, que a su vez determina si el cliente debe mostrar nombres personalizados en los personajes. + + + + Sets the default volume for music. + Establece el volumen predeterminado de la música. + + + + Sets the default volume for SFX sounds, like interjections or other character sound effects. + Establece el volumen predeterminado para sonidos SFX, como las interjecciones y otros efectos de sonido de personajes. + + + Blips: Blips: - + Sets the volume of the blips, the talking sound effects. Establece el volumen de los blips, el sonido al hablar. - + Blip rate: Tasa de blips: - + Sets the delay between playing the blip sounds. Establece el retraso entre la reproducción de los sonidos blip. - + Blank blips: Blips en blanco: - + If true, the game will play a blip sound even when a space is 'being said'. Si está marcada, el juego reproducirá un sonido blip incluso cuando se 'dice' un espacio. - + Enable Looping SFX: Habilitar repetición de SFX: - + If true, the game will allow looping sound effects to play on preanimations. Si está habilitado, el juego permitirá que se reproduzcan efectos de sonido en bucle en preanimaciones. - + Kill Music On Objection: Parar la música al objetar: - + If true, the game will stop music when someone objects, like in the actual games. Si está habilitado, el juego detendrá la música cuando alguien haga una objeción, como en los juegos. - + Casing Caso - + This server supports case alerts. Este servidor admite alertas de casos. - + This server does not support case alerts. Este servidor no admite alertas de casos. - + Pretty self-explanatory. Bastante autoexplicativo. - + Casing: Caso: - + If checked, you will get alerts about case announcements. Si está marcado, recibirá anuncios de casos. - + Defense: Abogado: - + If checked, you will get alerts about case announcements if a defense spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si hay un lugar de abogado libre. - + Prosecution: Fiscal: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. Si está marcada, recibirá alertas sobre anuncios de casos si hay un puesto de fiscal libre. - + Judge: Juez: - + If checked, you will get alerts about case announcements if the judge spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si el puesto de juez está libre. - + Juror: Jurado: - + If checked, you will get alerts about case announcements if a juror spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si hay un puesto de jurado libre. - + Stenographer: Taquígrafo: - + If checked, you will get alerts about case announcements if a stenographer spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si hay un lugar de taquígrafo libre. - + CM: CM: - + If checked, you will appear amongst the potential CMs on the server. Si está marcado, aparecerá entre los posibles CM en el servidor. - + Witness: Testigo: - + If checked, you will appear amongst the potential witnesses on the server. Si está marcado, aparecerá entre los posibles testigos en el servidor. - + Hosting cases: Casos: - + If you're a CM, enter what cases you are willing to host. Si eres un CM, ingresa qué casos estás dispuesto a organizar. + + + IC Log + + + + + Only inline coloring will be shown such as <>,|| etc. + Solo se mostrará el color en línea, como <>, ||, etc. + + + + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. + El registro de IC reflejará el chat In-Character. Lo que significa que si alguien es interrumpido, nadie sabrá lo que se iba a decir. Habilitar para una experiencia más realista. + + + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience + El registro de IC reflejará el chat In-Character. Lo que significa que si alguien es interrumpido, nadie sabrá lo que se iba a decir. Habilitar para una experiencia más realista. + + + + Colorful IC log: + IC log colorido: + + + + Enables colored text in the log. + Habilita texto con color en el log. + + + + Only inline coloring: + Solo coloración en línea: + + + Only inline coloring will be shown such as <>,|| etc + Solo se mostrará el color en línea, como <>, ||, etc. + + + + Mirror IC log: + IC log refleja interrupciones: + + + IC log will mirror the IC box. Meaning that if somebody gets interupted nobody will know what they wanted to say. Enable for a more realistic expierence + El registro de IC reflejará el chat In-Character. Lo que significa que si alguien es interrumpido, nadie sabrá lo que se iba a decir. Habilitar para una experiencia más realista. + Courtroom - + Password Contraseña - + Spectator Espectador - - + + Search Buscar - + Passworded - Contraseña + Con contraseña - + Taken En uso @@ -498,28 +562,31 @@ Razón: - + Showname + A translation wouldn't fit because of the shitty theme system. - + Message Mensaje - + Name Nombre - + Pre + A translation wouldn't fit because of the shitty theme system. - + Flip + A translation wouldn't fit because of the shitty theme system. @@ -527,134 +594,138 @@ Razón: Guardia - - + + Casing - Caso + This could be translated as 'caso' and it wouldn't get cut, but there are so many other buttons that can't be translated on the courtroom window that might as well leave this also untranslated so it's at least consistent. + - + Shownames + A translation wouldn't fit because of the shitty theme system. - + No Interrupt + A translation wouldn't fit because of the shitty theme system. - + White Blanco - + Green Verde - + Red Rojo - + Orange Naranja - + Blue Azul - + Yellow Amarillo - + Rainbow Arcoíris - + Pink Rosado - + Cyan Cian - + % offset % desplazamiento - + Music - + Sfx - + Blips - + Log limit - + Change character - + Reload theme - + Call mod - + Settings - Ajustes + - + A/M - A/M + - + Preanim - + Back to Lobby - Volver al lobby + 'Volver al lobby' got cut, changed to just Lobby + Lobby - - + + You were granted the Disable Modcalls button. Se le concedió el botón para deshabilitar llamadas a moderadores. - + You have been banned. Has sido vetado. @@ -663,104 +734,104 @@ Razón: Te ha sido otorgado el botón Guardia. - + This does nothing, but there you go. Esto no hace nada, pero ahí lo tienes. - + You opened the settings menu. Abriste el menú de configuración. - + You will now pair up with Ahora te emparejarás con - + if they also choose your character in return. si ellos también eligen a tu personaje a cambio. - + You are no longer paired with anyone. Ya no estás emparejado con nadie. - + Are you sure you typed that well? The char ID could not be recognised. ¿Estás seguro de que lo escribiste bien? El ID de personaje no pudo ser reconocido. - + You have set your offset to Ha configurado su desplazamiento en - + Your offset must be between -100% and 100%! ¡Su desplazamiento debe estar entre -100% y 100%! - + That offset does not look like one. Ese desplazamiento no se parece a uno. - + You switched your music and area list. Cambiaste tu lista de música y área. - + You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this. Ha habilitado forzosamente funciones que el servidor puede no admitir. Es posible que no pueda hablar IC, o peor, debido a esto. - + Your pre-animations interrupt again. Sus pre-animaciones interrumpen de nuevo. - + Your pre-animations will not interrupt text. Sus pre-animaciones no interrumpirán el texto. - + Couldn't open chatlog.txt to write into. No se pudo abrir chatlog.txt para escribir. - + The IC chatlog has been saved. El chat IC se ha guardado. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there. ¡No tienes una carpeta `base/cases /`! Ha sido creada para ti. Pero debido a que no existia la carpeta, tampoco habían casos guardados ahí. - + You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini. Cases you can load: %1 ¡Debe dar un nombre de archivo para cargar (no se necesita extensión)! Asegúrese de que esté en la carpeta `base/cases/` y de que tenga el formato correcto. Casos que puede cargar: %1 - + Case made by %1. Caso hecho por %1. - + Navigate to %1 for the CM doc. Navegue a %1 para el documento del CM. - + Your case "%1" was loaded! Su caso "%1" fue cargado! @@ -771,7 +842,7 @@ Cases you can load: Casos que puede cargar: - + Too many arguments to load a case! You only need one filename, without extension. ¡Demasiados argumentos para cargar un caso! Solo necesita un nombre de archivo, sin extensión. @@ -796,70 +867,74 @@ Casos que puede cargar: " fue cargado! - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it. ¡No tienes una carpeta `base/cases /`! Fue creada para ti. - + You need to give a filename to save (extension not needed) and the courtroom status! ¡Debe dar un nombre de archivo para guardar (no se necesita la extensión) y el estado de la sala del tribunal! - Too many arguments to save a case! You only need a filename without extension and the courtroom status! why two exclamations, seems excesive. - ¡Demasiados argumentos para salvar un caso! Solo necesita un nombre de archivo sin extensión y el estado de la sala del tribunal. + ¡Demasiados argumentos para salvar un caso! Solo necesita un nombre de archivo sin extensión y el estado de la sala del tribunal. - + Succesfully saved, edit doc and cmdoc link on the ini! ¡Guardado con éxito, puede editar el doc y doc link en el archivo ini! - + Master - - + + Server - + OOC Message Mensaje OOC - + Disable Modcalls - + + Too many arguments to save a case! You only need a filename without extension and the courtroom status. + ¡Demasiados argumentos para salvar un caso! Solo necesita un nombre de archivo sin extensión y el estado de la sala del tribunal. + + + Reason: Razón: - + Call Moderator Llamar Moderador - - + + Error Error - + You must provide a reason. Debes proporcionar una razón. - + The message is too long. El mensaje es muy largo. @@ -869,12 +944,12 @@ Casos que puede cargar: Elegir... - + Images (*.png) Imágenes (* .png) - + Add new evidence... Añadir nueva evidencia... @@ -884,7 +959,7 @@ Casos que puede cargar: Attorney Online 2 - Attorney Online 2 + @@ -892,40 +967,44 @@ Casos que puede cargar: Nombre - + It doesn't look like your client is set up correctly. Did you download all resources correctly from tiny.cc/getao, including the large 'base' folder? No parece que su cliente esté configurado correctamente. ¿Descargó todos los recursos correctamente desde tiny.cc/getao, incluida la gran carpeta 'base'? - + Version: %1 Versión: %1 - + Loading Cargando - + Cancel Cancelar - - <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy - <h2>Attorney Online %1</h2>El simulador de drama legal<p><b>Código fuente:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https: //github.com/AttorneyOnline/AO2-Client</a><p><b>Desarrollo mayor:</b> <br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Agradecimiento especial:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (diseño de interfaz de usuario), Draxirch (diseño de interfaz de usuario), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake - + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + <h2>Attorney Online %1</h2>El simulador de drama legal<p><b>Código fuente:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https: //github.com/AttorneyOnline/AO2-Client</a><p><b>Desarrollo mayor:</b> <br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Agradecimiento especial:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (diseño de interfaz de usuario), Draxirch (diseño de interfaz de usuario), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + + Online: %1/%2 En línea: %1/%2 - - + + Offline Fuera de línea @@ -935,18 +1014,18 @@ Did you download all resources correctly from tiny.cc/getao, including the large Error: %1 - Error: %1 + - + Error - Error + - + Notice In spanish it would be "Aviso", but i believe it's going to be more useful for bug reports to not translate any debug string. - Notice + From f224ea0589de7c2656d0b190e3fd57a1ae779299 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sat, 18 Apr 2020 15:04:34 -0600 Subject: [PATCH 13/30] Add Polish to the language options --- src/aooptionsdialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 7737a33..c8ceec6 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -212,6 +212,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_language_combobox->addItem("de - Deutsch"); ui_language_combobox->addItem("es - Español"); ui_language_combobox->addItem("pt - Português"); + ui_language_combobox->addItem("pl - Polski"); ui_language_combobox->addItem("jp - 日本語"); ui_language_combobox->addItem("ru - Русский"); ui_gameplay_form->setWidget(11, QFormLayout::FieldRole, ui_language_combobox); From 33c8cf7793a6b0d590d642d5145c8ba905810c9a Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sat, 18 Apr 2020 16:14:45 -0600 Subject: [PATCH 14/30] Update Portuguese translation with the strings added on the CR branch --- resource/translations/ao_pt.qm | Bin 26655 -> 27951 bytes resource/translations/ao_pt.ts | 415 +++++++++++++++++++-------------- 2 files changed, 237 insertions(+), 178 deletions(-) diff --git a/resource/translations/ao_pt.qm b/resource/translations/ao_pt.qm index a828ee17889431883e27393b1f6674b16ea4dc58..a98eef3585ec0f57ed3176290d2a97a8fcce352c 100644 GIT binary patch delta 3052 zcmaJ@3se->8UAM2ARRIO8MUt2q^+Ba{T-xz`~cCE(WFxyB3h!RQE@3mt`8`! z6M2#hRB)h=C_FTY3atSIZlt2pkBOFMQPGwv1YQ@l?)#`@Jp$yNq4GDrLZV|-*^F`F zby{+5Cs9c!HE${*N?%G_axN2DIqL8pCA#lC?c9oaN~50REkxNlbogv9(S%p%Nq z$+PHs%2o=~ymn6Kdj=ie;B>EbVB-vKLibCk{1zuQOGI<_am&+NiRO;vnztjsuo`Yd z3o3VJaW9nQ5-ncLy;F3R=s}6Qaun;iHkDCcN|ckTN?8L0hF()m+>gRC{;0}%eGM9^ zR0&^|5NWKc`kP&HBR3>mu~BtkZxc~$o9gfx)IRigs!vYu049f3U-r%+GPkP!6T!S? zy4seK29nOJ7w#EG#I;AQYlwR54v;qUxccZO*!(T(>lG+ze7pL_`I#W`H=5F6AXNV^ z&6C|0qPQy>IkpCI)@e2u{uvlJ<20MM&n8M7AGNs~G{>_{ME0YaGxmjGt3dPlWCPKp zothg#^fJjb8_Da}qwHaNnqJWULXd4n(ZfX~FKS$*DY6W#Z z5+`b_*Peko25DE?p)6IN_W5<2!>I6WZD%Jo7O1r^y@r69N3?HS6Csyc?RRNzu>5As zoGYy;#2+)?hXR&tim6~7PCOsunR6SUUyNCE4xQQl9`j-^)=O^1e3S{K3Z9L9AS;>Z z(NnRD--n!SRk2QQ6Vc#JvFq3FMj;=^o=ym3b8{L24z=uU6(#W zf*HC${dNxga`l>dgNb5F_1Z^!iGE7@NpH*mg{Sp1!yB=|TBk2+^MLbwz1RvzcaGk_ zw;WKG=vy?GK~1H8$2cUg*Xs`sJ4vLQt3TX#jA+J_`qz8*!%wCE)&sdEUNWR)!!Ntp zPXC-WXO;oUPD7`@ndoO%47)nE1CcVr{3a;}ckO_D(gnl&)qh36QHDzw z6HvL|aB~bkpKOgk$l<_eERWiPapCyC__q>Oo{zt<>kw2t z!e}m$h<>u#*!oH`(WqI*6XjhHQ;YGP=WyT_oXpywEG z8Ak(|FHETmAugh*bzCszug*k+X{M(4j=}GU>8Vehpm?Kc??V`8g}Y4qp14XhF3r^Q zD-IleX?pqBSeU!kbnXM#(SuBVFM}&pk6ER%5EZAJ2WKwD%`nD1`IoIIe6D#myCL{P zW+@L>Qh{XN{MJ}BveO*djl!)L%x_NXB^ujiK4mV!DIxIeZddo=Plqxi4sANO^cWF!JK@!`lg)$y_N0&!9Y?*XMVIynJCE@AbLmXR?waUnD)nxw0vjg79BK z0wVbE1WBX@yxI5nBl09E^DK*-EO+DcGbN$QD+YK6%Og7Zpx6-PJrWbz8qYW?)# zor)dGIEYac2Rr(4qf!sK@HpTrDR}U-oI=>oBMy5Dh~&o1XH<)k3qAQ^J@5`Q5d8S} zVW|#N49-+6vY^sEn*s<@rTF$2)1M-085ImzC+tea&w^2bvde??9tCb5Iaou?GlYyn z7$1xU)-4Nh8A%;?LSY$S0eJYa%6edJ)-0gWhRA_$>WEVXa5MrtR)v(67S%` z(C+6V1UNpWe`76hkF-t2(e?&}Eq`szz>gHWLY{ah0Au@JJqrkR2_6h*#y&$)Qgjqm zM^s(4@L2zi723ZFMrD=M+P7U4=K39NX=< z8_OxzJ@#2jF}!OOZx&6&Wy>xxA9mK_3ksK8e*W|{cE99B$H-%)so#suE`#VL;Du*U z5vxSYBBeqmH&!9540+gH#bO5V2(*mE{!5yBFY;{FP)?u9=ZR7cLpa1{> delta 1901 zcmZWpeNkcV+BKwq~L%E4uTMlxL}~G*#HBKJIvV3V4sKa zi!^Pay!n|ShqL9%=AsU|s}^ON$5?k=!^%}7Pj&iKa#vH!f_{K?I;TJ8KJz^9^ZuUa z_x#@X?Kmgw_>b^xbTAvpod!((9GGPQqW1x1jlc{&P~J&<0GNLkussK@x*y262yI6L zkmZB62edaJ&6*5kPad`oFQldS13A5ro;U~waA`ABQ+&DcBrEgzlfjhBa1^t=nSajtjpx`1_Y_Pi_M89ul5i$Icd43V*iea2l<`@rphmc7brFi1zNFaH*TXnJY!3`XFFkDq2>N zY19=l@!*%Ne@mQxVik$Bh>ojvK${{yaFP1SB` z%?DzBH*7P{XisIBfH@}ZR}&3D;sNdT02#;mrBS=r0prg~qc<&JJVHuuf0G3dN<}*e znDm15K*vUE{JiAQ9X#^v@T%u^SW;{zT-ru>w*LI zT6VfxpZq9Cl(|r!xokeQ9-+@xn3!LzUtW+#0K0x=4}lFu`t>7OXr4*GwYZ-W_37I` z{)7yl(*NV-LgqEf+BuOxSg|b4>jm!1mG6Cf2BqqeXKrAAQjc8J?BZcxD?6K*S5Xs` zeS1qe!VU5|?U$5bf!vnB0`|l5;n>rF{(kxRz`x17TRzcwka>CXEf)`4OtZm~$-K0; z48=ciT{GJ7#LVAwg2xQoWgf1w6vM7w>+9Sks7(V_e znvDk!7;eUL0*2k;iB%0i(VxQGPm3JsK={c;iM&>G!{52W(V;bBWPb|qKvzWiqrJer z=OV0=vMAl`h|)!EoZQWb!ve2y>i%JC`(wmwz82>HCgS3*E?(coM#b&{CT1I(-WUsv zEHj?j$lDd1yVm&r_Y9b8jGs0yVZpx}e=y!n=9f)T@%?;2_M0Y@@$dk{cCp@+yV6P~ zxu%Byl6i8YY0YO<)N+GqZxa0}eWrbleZaU}Q|B`RrTE(P`iqR`oiJVafHvM@8hD+O zh@FZkT2PExk13JX2YLT%l!;F_QQKxEfAAd`b4u~p_|Vw)DO*mCBZDuL(C&6NWK;f` z)(co#m3I_7Z$qTg+zc%o+`7WGEnbuoBiH;I?n29uKCSMCEbA8;WsA?;v}mNjfzu0pYqqxqN$q% z^-TI~i}~k5b@hH%<*!R|%Uz+X)}%PKXmNCCQt1vweg&DR#Ux~@c4NHyZRH(*m_r(V z(yT*0+$2~^fKqB}0M+|{A^5v()~00000 diff --git a/resource/translations/ao_pt.ts b/resource/translations/ao_pt.ts index 062e06e..67928a5 100644 --- a/resource/translations/ao_pt.ts +++ b/resource/translations/ao_pt.ts @@ -1,88 +1,88 @@ - + AOApplication - + Disconnected from server. Desconectado do servidor. - + Error connecting to master server. Will try again in %1 seconds. Erro ao conectar ao servidor principal. Testando novamente em %1 segundos. - + There was an error connecting to the master server. 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. Please check your Internet connection and firewall, and please try again. Ocorreu um erro ao obter a lista de servidores. Verifique sua conexão à Internet e firewall e tente novamente. - + Outdated version! Your version: %1 Please go to aceattorneyonline.com to update. Versão desatualizada! Sua versão: %1 Acesse aceattorneyonline.com para atualizar. - + You have been exiled from AO. Have a nice day. Você foi exilado do Attorney Online. Tenha um bom dia. - + Attorney Online 2 - + Loading Carregando - - + + Loading chars: %1/%2 Carregando personagens: %1/%2 - + Loading evidence: %1/%2 Carregando evidências: %1/%2 - - + + Loading music: %1/%2 Carregando músicas: %1/%2 - + You have been kicked from the server. Reason: %1 Você foi expulso do servidor. Motivo: %1 - + You have been banned from the server. Reason: %1 Você foi banido do servidor. Motivo: %1 - + You are banned on this server. Reason: %1 Você foi banido neste servidor. @@ -92,42 +92,42 @@ Motivo: %1 AOCaseAnnouncerDialog - + Case Announcer Anunciar caso - + Case title: Título do caso: - + Defense needed Precisa-se de Defesa - + Prosecution needed Precisa-se de Promotor - + Judge needed Precisa-se de Juíz - + Jurors needed Precisa-se de Jurados - + Stenographer needed Precisa-se de Estenógrafo - + Witness needed Precisa-se de Testemunha @@ -135,339 +135,390 @@ Motivo: %1 AOOptionsDialog - + Settings Configurações - + Gameplay Jogabilidade - + Theme: Tema visual: - + Sets the theme used in-game. If the new theme changes the lobby's look as well, you'll need to reload the lobby for the changes to take effect, such as by joining a server and leaving it. Define o tema usado no jogo. Se o novo tema alterar a aparência do lobby, será necessário recarregá-lo para que as alterações tenham efeito, como ingressar em um servidor e deixá-lo. - + + Log goes downwards: Log vai para baixo: - + + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. Removed the part about AO1 behaviour, nobody cares boomer. Se selecionado, novas mensagens irão aparecer na parte inferior (assim como o chat OOC). - + + Log length: Tamanho do log: - + + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. A quantidade de mensagens que o chat do IC manterá antes de excluir as mensagens mais antigas. Um valor igual ou inferior a 0 conta como 'infinito'. - + Default username: Nome de usuário padrão: - + Your OOC name will be automatically set to this value when you join a server. Seu nome OOC será automaticamente definido com esse valor quando você ingressar em um servidor. - + Custom shownames: Nomes personalizados: - Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. 'Custom shownames' changed to 'Shownames' because that's the actual name - Fornece o valor padrão para a caixa de seleção 'Shownames' no jogo, que determina se o cliente deve exibir nomes personalizados nos caracteres. + Fornece o valor padrão para a caixa de seleção 'Shownames' no jogo, que determina se o cliente deve exibir nomes personalizados nos caracteres. - + Backup MS: MS de backup: - + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. Se as pesquisas internas do servidor falharem, o jogo tentará o endereço fornecido aqui e o usará como um endereço de servidor principal de backup. - + Discord: - + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. Permite que outras pessoas no Discord vejam em que servidor você está, qual personagem está jogando e há quanto tempo está jogando. - + Allow Shake/Flash: Permitir Shake/Flash: - + Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. Permite agitar e piscar. Desative isso se você tiver preocupações ou problemas com fotosensibilidade e/ou convulsões. - + Language: Língua: - + Sets the language if you don't want to use your system language. Define o idioma se você não quiser usar o idioma do sistema. - + Callwords Palavras-chave - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> <html><head/><body>Digite quantas palavras-chave você desejar. Estes não diferenciam maiúsculas de minúsculas. Certifique-se de deixar cada palavra chave em sua própria linha!<br>Não deixe uma linha com um espaço no final - você será alertado toda vez que alguém usar um espaço em suas mensagens.</body></html> - + Audio Áudio - + Audio device: Dispositivo de áudio: - + Sets the audio device for all sounds. Define o dispositivo de áudio para todos os sons. - + Music: Música: - Sets the music's default volume. - Define o volume padrão da música. + Define o volume padrão da música. - + SFX: SFX: - Sets the SFX's default volume. Interjections and actual sound effects count as 'SFX'. - Define o volume padrão do SFX. Interjeições e efeitos sonoros reais contam como 'SFX'. + Define o volume padrão do SFX. Interjeições e efeitos sonoros reais contam como 'SFX'. - + + Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. + Fornece o valor padrão para a caixa de seleção 'Shownames' no jogo, que determina se o cliente deve exibir nomes personalizados nos caracteres. + + + + Sets the default volume for music. + Define o volume padrão da música. + + + + Sets the default volume for SFX sounds, like interjections or other character sound effects. + Define o volume padrão para sons SFX, como interjeições ou outros efeitos sonoros de personagens. + + + Blips: - + Sets the volume of the blips, the talking sound effects. Define o volume dos blips, os efeitos sonoros de fala. - + Blip rate: Taxa de blip: - + Sets the delay between playing the blip sounds. Define o atraso entre a reprodução dos sons de blip. - + Blank blips: Blips em branco: - + If true, the game will play a blip sound even when a space is 'being said'. Se ativado, o jogo emitirá um sinal sonoro, mesmo quando um espaço estiver sendo "dito". - + Enable Looping SFX: Ative o SFX em loop: - + If true, the game will allow looping sound effects to play on preanimations. Se ativado, o jogo permitirá que efeitos sonoros em loop sejam reproduzidos em pré-animações. - + Kill Music On Objection: Parar a música no protesto: - + If true, the game will stop music when someone objects, like in the actual games. Se ativado, o jogo interrompe a música quando alguém protestar , como nos jogos reais. - + Casing Caso - + This server supports case alerts. Este servidor suporta anúncios de casos. - + This server does not support case alerts. Este servidor não suporta alertas de caso. - + Pretty self-explanatory. Bastante auto-explicativo. - + Casing: Caso: - + If checked, you will get alerts about case announcements. Se marcado, você será alertado quando houverem anúncios de casos. - + Defense: Defesa: - + If checked, you will get alerts about case announcements if a defense spot is open. Se marcado, você receberá alertas sobre os anúncios de casos, se um ponto de defesa estiver aberto. - + Prosecution: Promotor: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. Se marcado, você receberá alertas sobre os anúncios de casos, se uma posição de promotor estiver disponível. - + Judge: Juíz: - + If checked, you will get alerts about case announcements if the judge spot is open. Se marcado, você receberá alertas sobre os anúncios de casos, se o local do juíz: estiver aberto. - + Juror: Jurado: - + If checked, you will get alerts about case announcements if a juror spot is open. Se marcado, você receberá alertas sobre os anúncios de casos, se um local do jurado estiver aberto. - + Stenographer: Estenógrafo: - + If checked, you will get alerts about case announcements if a stenographer spot is open. Se marcado, você receberá alertas sobre anúncios de casos, se um local de estenógrafo estiver aberto. - + CM: CM: - + If checked, you will appear amongst the potential CMs on the server. Se marcado, você aparecerá entre os CMs possíveis no servidor. - + Witness: Testemunha: - + If checked, you will appear amongst the potential witnesses on the server. Se marcado, você aparecerá entre as testemunhas em potencial no servidor. - + Hosting cases: Casos: - + If you're a CM, enter what cases you are willing to host. Se você é um CM, insira os casos que deseja hospedar. + + + IC Log + + + + + Colorful IC log: + Log IC colorido: + + + + Enables colored text in the log. + Ativa o texto colorido no log. + + + + Only inline coloring: + Somente coloração em linha: + + + + Only inline coloring will be shown such as <>,|| etc. + Somente a coloração em linha será mostrada como <>, ||, etc. + + + + Mirror IC log: + O log IC reflete interrupções: + + + + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. + O log IC espelhará o chat IC Significando que se alguém for interrompido, ninguém saberá o que queria dizer. Habilite para uma experiência mais realista. + Courtroom - + Password Senha - + Spectator Espectador - - + + Search Pesquisar - + Passworded A translation wouldn't fit because of the shitty theme system. - + Taken Em uso @@ -477,340 +528,344 @@ Motivo: %1 Não foi possível encontrar %1 - + Showname A translation wouldn't fit because of the shitty theme system. - + Message Mensagem - + OOC Message Mensagem OOC - + Name Nome - + Pre A translation wouldn't fit because of the shitty theme system. - + Flip A translation wouldn't fit because of the shitty theme system. - + Disable Modcalls - - + + Casing A translation wouldn't fit because of the shitty theme system. - + Shownames A translation wouldn't fit because of the shitty theme system. - + No Interrupt A translation wouldn't fit because of the shitty theme system. - + White Branco - + Green Verde - + Red Vermelho - + Orange Laranja - + Blue Azul - + Yellow Amarelo - + Rainbow Arco Iris - + Pink Rosa - + Cyan Ciano - + % offset % deslocamento - + Music - + Sfx - + Blips - + Log limit - - + + Server - + Change character - + Reload theme - + Call mod - + Settings - + A/M - + Preanim - + Back to Lobby A translation wouldn't fit because of the shitty theme system. Lobby - - + + You were granted the Disable Modcalls button. Você recebeu o botão Desativar Modcalls. - + You have been banned. Você foi banido. - + This does nothing, but there you go. Isso não faz nada, mas lá vai você. - + You opened the settings menu. Você abriu o menu de configurações. - + You will now pair up with Agora você vai fazer par com - + if they also choose your character in return. se eles também escolherem seu personagem em troca. - + You are no longer paired with anyone. Você não está mais fazendo par com ninguém. - + Are you sure you typed that well? The char ID could not be recognised. Você tem certeza que você escreveu isso certo? O ID do personagem não pôde ser encontrado. - + You have set your offset to Você definiu seu deslocamento como - + Your offset must be between -100% and 100%! Seu deslocamento deve estar entre -100% e 100%! - + That offset does not look like one. Esse deslocamento não se parece com um. - + You switched your music and area list. Você mudou sua lista de músicas e áreas. - + You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this. Você forçou recursos que o servidor pode não suportar. Você pode não conseguir falar de IC, ou pior, por causa disso. - + Your pre-animations interrupt again. Suas pré-animações interrompem novamente. - + Your pre-animations will not interrupt text. Suas pré-animações não interromperão o texto. - + Couldn't open chatlog.txt to write into. Não foi possível abrir o chatlog.txt para gravar. - + The IC chatlog has been saved. O chat do IC foi salvo. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there. Você não possui uma pasta `base/cases/`! Foi feito para você, mas, como foi feito para você, provavelmente o arquivo do caso que você está procurando não pode ser encontrado lá. - + You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini. Cases you can load: %1 Você precisa fornecer um nome de arquivo para carregar (extensão não necessária)! Verifique se está na pasta `base/cases/` e se é um ini formatado corretamente. Casos que você pode carregar: %1 - + Too many arguments to load a case! You only need one filename, without extension. Muitos argumentos para carregar um caso! Você só precisa de um nome de arquivo, sem extensão. - + Case made by %1. Caso feito por %1. - + Navigate to %1 for the CM doc. Navegue para %1 para o documento do CM. - + Your case "%1" was loaded! Seu caso "%1" foi carregado! - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it. Você não possui uma pasta `base/cases/`! Foi feito para você, mas, como foi feito para você, é provável que você o tenha excluído. - + You need to give a filename to save (extension not needed) and the courtroom status! Você deve fornecer um nome de arquivo para salvar (sem extensão necessária) e o estado do tribunal! - - Too many arguments to save a case! You only need a filename without extension and the courtroom status! + + Too many arguments to save a case! You only need a filename without extension and the courtroom status. Muitos argumentos para salvar um caso! Você só precisa de um nome de arquivo sem extensão e o estado do tribunal. - + Too many arguments to save a case! You only need a filename without extension and the courtroom status! + Muitos argumentos para salvar um caso! Você só precisa de um nome de arquivo sem extensão e o estado do tribunal. + + + Succesfully saved, edit doc and cmdoc link on the ini! Salvo com sucesso, você pode editar o documento e o link do documento no arquivo ini! - + Master - + Reason: Razão: - + Call Moderator Chamar um Moderador - - + + Error Erro - + You must provide a reason. Você deve fornecer um motivo. - + The message is too long. A mensagem é muito longa. @@ -820,12 +875,12 @@ Casos que você pode carregar: %1 Escolha... - + Images (*.png) Imagens (* .png) - + Add new evidence... Adicionar nova evidência... @@ -843,40 +898,44 @@ Casos que você pode carregar: %1 Nome - + It doesn't look like your client is set up correctly. Did you download all resources correctly from tiny.cc/getao, including the large 'base' folder? Seu cliente não parece estar configurado corretamente. Você baixou todos os recursos corretamente do tiny.cc/getao, incluindo a grande pasta 'base'? - + Version: %1 Versão: %1 - - + + Offline Offline - + Loading Carregando - + Cancel Cancelar - - <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy - <h2>Attorney Online %1</h2>O simulador de drama jurídico<p><b>Código fonte:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Desenvolvimento principal:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Agradecimentos especiais:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake - + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + <h2>Attorney Online %1</h2>O simulador de drama jurídico<p><b>Código fonte:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Desenvolvimento principal:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Agradecimentos especiais:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + + Online: %1/%2 Online: %1/%2 @@ -889,12 +948,12 @@ Você baixou todos os recursos corretamente do tiny.cc/getao, incluindo a grande - + Error - + Notice From dfa543642726b43f96a803480f74e023bd2dd9b9 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sat, 18 Apr 2020 16:16:38 -0600 Subject: [PATCH 15/30] Change "IC log colorido" to "Log IC colorido" on the Spanish translation --- resource/translations/ao_es.qm | Bin 27795 -> 27795 bytes resource/translations/ao_es.ts | 106 ++++++++++++++++----------------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/resource/translations/ao_es.qm b/resource/translations/ao_es.qm index cf636f364a2bd35a38b3f10070339b5573fb5927..420f95945b4b5511b5720d78769ad7dd953595da 100644 GIT binary patch delta 26 hcmbPylX3D*#to*@+&&EX4CxFC44w?mn;oQs0|9dw2W9{O delta 26 hcmbPylX3D*#to*@+@1{13 - + Log goes downwards: Invertir historial IC: - + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. Si está marcado, los nuevos mensajes aparecerán en la parte inferior (como el chat OOC). - + Log length: Limite del historial: - + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. La cantidad de mensajes que mantendrá el historial del chat IC antes de eliminar mensajes más antiguos. 0 significa 'infinito'. @@ -251,32 +251,32 @@ Razón: Establece el idioma si no desea utilizar el idioma de su sistema. - + Callwords Palabras clave - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> <html><head/><body>Ingrese tantas palabras de llamada como desee.<br>Esto no distingue entre mayúsculas y minúsculas. ¡Asegúrese de dejar cada palabra en su propia línea!<br>No deje una línea con un espacio al final; recibirá una alerta cada vez que alguien use un espacio en sus mensajes.</body></html> - + Audio Audio - + Audio device: Dispositivo: - + Sets the audio device for all sounds. Establece el dispositivo de audio. - + Music: Música: @@ -285,7 +285,7 @@ Razón: Establece el volumen predeterminado de la música. - + SFX: SFX: @@ -299,187 +299,187 @@ Razón: Activa la casilla 'Mostrar nombres' de forma predeterminada en el juego, que a su vez determina si el cliente debe mostrar nombres personalizados en los personajes. - + Sets the default volume for music. Establece el volumen predeterminado de la música. - + Sets the default volume for SFX sounds, like interjections or other character sound effects. Establece el volumen predeterminado para sonidos SFX, como las interjecciones y otros efectos de sonido de personajes. - + Blips: Blips: - + Sets the volume of the blips, the talking sound effects. Establece el volumen de los blips, el sonido al hablar. - + Blip rate: Tasa de blips: - + Sets the delay between playing the blip sounds. Establece el retraso entre la reproducción de los sonidos blip. - + Blank blips: Blips en blanco: - + If true, the game will play a blip sound even when a space is 'being said'. Si está marcada, el juego reproducirá un sonido blip incluso cuando se 'dice' un espacio. - + Enable Looping SFX: Habilitar repetición de SFX: - + If true, the game will allow looping sound effects to play on preanimations. Si está habilitado, el juego permitirá que se reproduzcan efectos de sonido en bucle en preanimaciones. - + Kill Music On Objection: Parar la música al objetar: - + If true, the game will stop music when someone objects, like in the actual games. Si está habilitado, el juego detendrá la música cuando alguien haga una objeción, como en los juegos. - + Casing Caso - + This server supports case alerts. Este servidor admite alertas de casos. - + This server does not support case alerts. Este servidor no admite alertas de casos. - + Pretty self-explanatory. Bastante autoexplicativo. - + Casing: Caso: - + If checked, you will get alerts about case announcements. Si está marcado, recibirá anuncios de casos. - + Defense: Abogado: - + If checked, you will get alerts about case announcements if a defense spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si hay un lugar de abogado libre. - + Prosecution: Fiscal: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. Si está marcada, recibirá alertas sobre anuncios de casos si hay un puesto de fiscal libre. - + Judge: Juez: - + If checked, you will get alerts about case announcements if the judge spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si el puesto de juez está libre. - + Juror: Jurado: - + If checked, you will get alerts about case announcements if a juror spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si hay un puesto de jurado libre. - + Stenographer: Taquígrafo: - + If checked, you will get alerts about case announcements if a stenographer spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si hay un lugar de taquígrafo libre. - + CM: CM: - + If checked, you will appear amongst the potential CMs on the server. Si está marcado, aparecerá entre los posibles CM en el servidor. - + Witness: Testigo: - + If checked, you will appear amongst the potential witnesses on the server. Si está marcado, aparecerá entre los posibles testigos en el servidor. - + Hosting cases: Casos: - + If you're a CM, enter what cases you are willing to host. Si eres un CM, ingresa qué casos estás dispuesto a organizar. - + IC Log - + Only inline coloring will be shown such as <>,|| etc. Solo se mostrará el color en línea, como <>, ||, etc. - + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. El registro de IC reflejará el chat In-Character. Lo que significa que si alguien es interrumpido, nadie sabrá lo que se iba a decir. Habilitar para una experiencia más realista. @@ -488,17 +488,17 @@ Razón: El registro de IC reflejará el chat In-Character. Lo que significa que si alguien es interrumpido, nadie sabrá lo que se iba a decir. Habilitar para una experiencia más realista. - + Colorful IC log: - IC log colorido: + Log IC colorido: - + Enables colored text in the log. Habilita texto con color en el log. - + Only inline coloring: Solo coloración en línea: @@ -507,7 +507,7 @@ Razón: Solo se mostrará el color en línea, como <>, ||, etc. - + Mirror IC log: IC log refleja interrupciones: From 5bd8c960c99075f6c9fe58ad29a5474fd014fefe Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sun, 19 Apr 2020 12:35:03 -0600 Subject: [PATCH 16/30] Fix crash on saving settings Thanks Initiate for actually fixing this --- src/aooptionsdialog.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index c8ceec6..8b78559 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -217,6 +217,17 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_language_combobox->addItem("ru - Русский"); ui_gameplay_form->setWidget(11, QFormLayout::FieldRole, ui_language_combobox); + ui_pun_delay = new QLabel(ui_form_layout_widget); + ui_pun_delay->setText(tr("Punctation Delay:")); + ui_pun_delay->setToolTip(tr("Punctation delay modifier." + " Set it to 1 for no additional delay.")); + ui_pun_delay_spinbox = new QSpinBox(ui_form_layout_widget); + ui_pun_delay_spinbox->setMinimum(1); + ui_pun_delay_spinbox->setMaximum(3); + ui_pun_delay_spinbox->setValue(p_ao_app->get_pundelay()); + ui_gameplay_form->setWidget(12, QFormLayout::FieldRole, ui_pun_delay_spinbox); + ui_gameplay_form->setWidget(12, QFormLayout::LabelRole, ui_pun_delay); + // Here we start the callwords tab. ui_callwords_tab = new QWidget(); ui_settings_tabs->addTab(ui_callwords_tab, tr("Callwords")); From 5f88b1fd30606d510ac98b2e5da44c1dd8001234 Mon Sep 17 00:00:00 2001 From: cents Date: Sun, 19 Apr 2020 12:47:50 -0700 Subject: [PATCH 17/30] Removed Duplicates --- src/aooptionsdialog.cpp | 68 ++++++++++++----------------------------- 1 file changed, 20 insertions(+), 48 deletions(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index 8b78559..e9b38fa 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -88,39 +88,6 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_gameplay_form->setWidget(1, QFormLayout::FieldRole, ui_theme_log_divider); - ui_downwards_lbl = new QLabel(ui_form_layout_widget); - ui_downwards_lbl->setText(tr("Log goes downwards:")); - ui_downwards_lbl->setToolTip( - tr("If ticked, new messages will appear at " - "the bottom (like the OOC chatlog). The traditional " - "(AO1) behaviour is equivalent to this being unticked.")); - - ui_gameplay_form->setWidget(2, QFormLayout::LabelRole, ui_downwards_lbl); - - ui_downwards_cb = new QCheckBox(ui_form_layout_widget); - ui_downwards_cb->setChecked(p_ao_app->get_log_goes_downwards()); - - ui_gameplay_form->setWidget(2, QFormLayout::FieldRole, ui_downwards_cb); - - ui_length_lbl = new QLabel(ui_form_layout_widget); - ui_length_lbl->setText(tr("Log length:")); - ui_length_lbl->setToolTip(tr( - "The amount of messages the IC chatlog will keep before " - "deleting older messages. A value of 0 or below counts as 'infinite'.")); - - ui_gameplay_form->setWidget(3, QFormLayout::LabelRole, ui_length_lbl); - - ui_length_spinbox = new QSpinBox(ui_form_layout_widget); - ui_length_spinbox->setMaximum(10000); - ui_length_spinbox->setValue(p_ao_app->get_max_log_size()); - - ui_gameplay_form->setWidget(3, QFormLayout::FieldRole, ui_length_spinbox); - - ui_log_names_divider = new QFrame(ui_form_layout_widget); - ui_log_names_divider->setFrameShape(QFrame::HLine); - ui_log_names_divider->setFrameShadow(QFrame::Sunken); - - ui_gameplay_form->setWidget(4, QFormLayout::FieldRole, ui_log_names_divider); ui_username_lbl = new QLabel(ui_form_layout_widget); ui_username_lbl->setText(tr("Default username:")); @@ -128,13 +95,13 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) tr("Your OOC name will be automatically set to this value " "when you join a server.")); - ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_username_lbl); + ui_gameplay_form->setWidget(2, QFormLayout::LabelRole, ui_username_lbl); ui_username_textbox = new QLineEdit(ui_form_layout_widget); ui_username_textbox->setMaxLength(30); ui_username_textbox->setText(p_ao_app->get_default_username()); - ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_username_textbox); + ui_gameplay_form->setWidget(2, QFormLayout::FieldRole, ui_username_textbox); ui_showname_lbl = new QLabel(ui_form_layout_widget); ui_showname_lbl->setText(tr("Custom shownames:")); @@ -143,18 +110,18 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) "checkbox, which in turn determines whether the client should " "display custom in-character names.")); - ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_showname_lbl); + ui_gameplay_form->setWidget(3, QFormLayout::LabelRole, ui_showname_lbl); ui_showname_cb = new QCheckBox(ui_form_layout_widget); ui_showname_cb->setChecked(p_ao_app->get_showname_enabled_by_default()); - ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_showname_cb); + ui_gameplay_form->setWidget(3, QFormLayout::FieldRole, ui_showname_cb); ui_net_divider = new QFrame(ui_form_layout_widget); ui_net_divider->setFrameShape(QFrame::HLine); ui_net_divider->setFrameShadow(QFrame::Sunken); - ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_net_divider); + ui_gameplay_form->setWidget(4, QFormLayout::FieldRole, ui_net_divider); ui_ms_lbl = new QLabel(ui_form_layout_widget); ui_ms_lbl->setText(tr("Backup MS:")); @@ -162,13 +129,13 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) tr("If the built-in server lookups fail, the game will try the " "address given here and use it as a backup master server address.")); - ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_ms_lbl); + ui_gameplay_form->setWidget(5, QFormLayout::LabelRole, ui_ms_lbl); QSettings *configini = ao_app->configini; ui_ms_textbox = new QLineEdit(ui_form_layout_widget); ui_ms_textbox->setText(configini->value("master", "").value()); - ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_ms_textbox); + ui_gameplay_form->setWidget(5, QFormLayout::FieldRole, ui_ms_textbox); ui_discord_lbl = new QLabel(ui_form_layout_widget); ui_discord_lbl->setText(tr("Discord:")); @@ -177,12 +144,12 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) "what character are you playing, and how long you have " "been playing for.")); - ui_gameplay_form->setWidget(9, QFormLayout::LabelRole, ui_discord_lbl); + ui_gameplay_form->setWidget(6, QFormLayout::LabelRole, ui_discord_lbl); ui_discord_cb = new QCheckBox(ui_form_layout_widget); ui_discord_cb->setChecked(ao_app->is_discord_enabled()); - ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_discord_cb); + ui_gameplay_form->setWidget(6, QFormLayout::FieldRole, ui_discord_cb); ui_epilepsy_lbl = new QLabel(ui_form_layout_widget); ui_epilepsy_lbl->setText(tr("Allow Shake/Flash:")); @@ -190,18 +157,18 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) tr("Allows screenshaking and flashing. Disable this if you have concerns " "or issues with photosensitivity and/or seizures.")); - ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_epilepsy_lbl); + ui_gameplay_form->setWidget(7, QFormLayout::LabelRole, ui_epilepsy_lbl); ui_epilepsy_cb = new QCheckBox(ui_form_layout_widget); ui_epilepsy_cb->setChecked(ao_app->is_shakeandflash_enabled()); - ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_epilepsy_cb); + ui_gameplay_form->setWidget(7, QFormLayout::FieldRole, ui_epilepsy_cb); ui_language_label = new QLabel(ui_form_layout_widget); ui_language_label->setText(tr("Language:")); ui_language_label->setToolTip( tr("Sets the language if you don't want to use your system language.")); - ui_gameplay_form->setWidget(11, QFormLayout::LabelRole, ui_language_label); + ui_gameplay_form->setWidget(8, QFormLayout::LabelRole, ui_language_label); ui_language_combobox = new QComboBox(ui_form_layout_widget); ui_language_combobox->addItem( @@ -215,7 +182,12 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_language_combobox->addItem("pl - Polski"); ui_language_combobox->addItem("jp - 日本語"); ui_language_combobox->addItem("ru - Русский"); - ui_gameplay_form->setWidget(11, QFormLayout::FieldRole, ui_language_combobox); + ui_gameplay_form->setWidget(8, QFormLayout::FieldRole, ui_language_combobox); + + ui_net_divider = new QFrame(ui_form_layout_widget); + ui_net_divider->setFrameShape(QFrame::HLine); + ui_net_divider->setFrameShadow(QFrame::Sunken); + ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_net_divider); ui_pun_delay = new QLabel(ui_form_layout_widget); ui_pun_delay->setText(tr("Punctation Delay:")); @@ -225,8 +197,8 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_pun_delay_spinbox->setMinimum(1); ui_pun_delay_spinbox->setMaximum(3); ui_pun_delay_spinbox->setValue(p_ao_app->get_pundelay()); - ui_gameplay_form->setWidget(12, QFormLayout::FieldRole, ui_pun_delay_spinbox); - ui_gameplay_form->setWidget(12, QFormLayout::LabelRole, ui_pun_delay); + ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_pun_delay_spinbox); + ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_pun_delay); // Here we start the callwords tab. ui_callwords_tab = new QWidget(); From 7a3ebc8362a3fd3f78d74d064e91e5f2bbc5c0ff Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Sun, 19 Apr 2020 17:04:19 -0600 Subject: [PATCH 18/30] Revert faster blip speed Without an option to change it users will complain Thanks Initiate for telling me how to change this --- include/courtroom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/courtroom.h b/include/courtroom.h index 674a0cb..8b4b443 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -288,7 +288,7 @@ private: bool message_is_centered = false; int current_display_speed = 3; - int message_display_speed[7] = {10, 20, 30, 40, 50, 60, 75}; + int message_display_speed[7] = {30, 40, 50, 60, 75, 100, 120}; // This is for checking if the character should start talking again // when an inline blue text ends. From 5b6d58bd020978f4632cb2dcb2db620213175645 Mon Sep 17 00:00:00 2001 From: cents Date: Mon, 20 Apr 2020 07:49:47 -0700 Subject: [PATCH 19/30] Added additional customization options. I didn't format anything tho that is at the end --- include/aoapplication.h | 4 +++- include/aooptionsdialog.h | 5 +++-- include/courtroom.h | 7 ++++--- src/aooptionsdialog.cpp | 27 +++++++++++++++++---------- src/courtroom.cpp | 11 ++++++++--- src/text_file_functions.cpp | 17 +++++++++++------ 6 files changed, 46 insertions(+), 25 deletions(-) diff --git a/include/aoapplication.h b/include/aoapplication.h index a07bf74..5646dde 100644 --- a/include/aoapplication.h +++ b/include/aoapplication.h @@ -188,8 +188,10 @@ public: int get_max_log_size(); // Gets the punctuation delay modifier - int get_pundelay(); + bool get_pundelay(); + //Gets whether slower text speed is enabled + bool get_slower_blips(); // Returns whether the log should go upwards (new behaviour) // or downwards (vanilla behaviour). bool get_log_goes_downwards(); diff --git a/include/aooptionsdialog.h b/include/aooptionsdialog.h index 8580c34..9a1429a 100644 --- a/include/aooptionsdialog.h +++ b/include/aooptionsdialog.h @@ -52,8 +52,9 @@ private: QLabel *ui_length_lbl; QSpinBox *ui_length_spinbox; QLabel *ui_pun_delay; - QSpinBox *ui_pun_delay_spinbox; - QFrame *ui_log_names_divider; + QCheckBox *ui_pun_delay_cb; + QLabel *ui_slower_blips_lb; + QCheckBox *ui_slower_blips_cb; QLineEdit *ui_username_textbox; QLabel *ui_username_lbl; QLabel *ui_showname_lbl; diff --git a/include/courtroom.h b/include/courtroom.h index 8b4b443..396c4d7 100644 --- a/include/courtroom.h +++ b/include/courtroom.h @@ -288,7 +288,8 @@ private: bool message_is_centered = false; int current_display_speed = 3; - int message_display_speed[7] = {30, 40, 50, 60, 75, 100, 120}; + int message_display_speed_slow[7] = {30, 40, 50, 60, 75, 100, 120}; + int message_display_speed[7] = {10, 20, 30, 40, 50, 60, 75}; // This is for checking if the character should start talking again // when an inline blue text ends. @@ -388,8 +389,8 @@ private: const QString punctuation_chars = ".,?!:;"; // amount by which we multiply the delay when we parse punctuation chars - int punctuation_modifier = 2; - + int punctuation_modifier = 0; + bool slower_blips = false; // character id, which index of the char_list the player is int m_cid = -1; // cid and this may differ in cases of ini-editing diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index e9b38fa..e2f433d 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -189,16 +189,23 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_net_divider->setFrameShadow(QFrame::Sunken); ui_gameplay_form->setWidget(9, QFormLayout::FieldRole, ui_net_divider); + ui_slower_blips_lb = new QLabel(ui_form_layout_widget); + ui_slower_blips_lb->setText(tr("Slower text speed:")); + ui_slower_blips_lb->setToolTip(tr("Set the text speed to be the same as the AA games.")); + ui_slower_blips_cb = new QCheckBox(ui_form_layout_widget); + ui_slower_blips_cb->setChecked(p_ao_app->get_pundelay()); + ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_slower_blips_cb); + ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_slower_blips_lb); + ui_pun_delay = new QLabel(ui_form_layout_widget); - ui_pun_delay->setText(tr("Punctation Delay:")); + ui_pun_delay->setText(tr("Blip delay on punctuations:")); ui_pun_delay->setToolTip(tr("Punctation delay modifier." - " Set it to 1 for no additional delay.")); - ui_pun_delay_spinbox = new QSpinBox(ui_form_layout_widget); - ui_pun_delay_spinbox->setMinimum(1); - ui_pun_delay_spinbox->setMaximum(3); - ui_pun_delay_spinbox->setValue(p_ao_app->get_pundelay()); - ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_pun_delay_spinbox); - ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_pun_delay); + " Enable it for the blips to slow down on punctuations.")); + ui_pun_delay_cb = new QCheckBox(ui_form_layout_widget); + ui_pun_delay_cb->setChecked(p_ao_app->get_pundelay()); + ui_gameplay_form->setWidget(11, QFormLayout::FieldRole, ui_pun_delay_cb); + ui_gameplay_form->setWidget(11, QFormLayout::LabelRole, ui_pun_delay); + // Here we start the callwords tab. ui_callwords_tab = new QWidget(); @@ -655,8 +662,8 @@ void AOOptionsDialog::save_pressed() configini->setValue("discord", ui_discord_cb->isChecked()); configini->setValue("shakeandflash", ui_epilepsy_cb->isChecked()); configini->setValue("language", ui_language_combobox->currentText().left(2)); - configini->setValue("punctuation_delay", ui_pun_delay_spinbox->value()); - configini->setValue("keep_evidence", ui_keepevi_cb->isChecked()); + configini->setValue("punctuation_delay", ui_pun_delay_cb->isChecked()); + configini->setValue("slower_blips", ui_slower_blips_cb->isChecked()); QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini"); if (!callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate | diff --git a/src/courtroom.cpp b/src/courtroom.cpp index c0fb24b..0cacffc 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1761,7 +1761,7 @@ void Courtroom::handle_chatmessage(QStringList *p_contents) ui_vp_objection->stop(); // ui_vp_player_char->stop(); chat_tick_timer->stop(); - if (keep_evidence_display) + if (!keep_evidence_display) ui_vp_evidence_display->reset(); chatmessage_is_empty = @@ -2769,7 +2769,10 @@ void Courtroom::start_chat_ticking() // At the start of every new message, we set the text speed to the default. current_display_speed = 3; - chat_tick_timer->start(message_display_speed[current_display_speed]); + if (slower_blips) + chat_tick_timer->start(message_display_speed_slow[current_display_speed]); + else + chat_tick_timer->start(message_display_speed[current_display_speed]); QString f_char = m_chatmessage[CHAR_NAME]; QString f_gender = ao_app->get_gender(f_char); @@ -2793,6 +2796,8 @@ void Courtroom::chat_tick() // Due to our new text speed system, we always need to stop the timer now. chat_tick_timer->stop(); int msg_delay = message_display_speed[current_display_speed]; + if (slower_blips) + msg_delay = message_display_speed_slow[current_display_speed]; // Stops blips from playing when we have a formatting option. bool formatting_char = false; @@ -2829,7 +2834,7 @@ void Courtroom::chat_tick() f_character = f_character.toHtmlEscaped(); if (punctuation_chars.contains(f_character)) { - msg_delay *= punctuation_modifier; + msg_delay *= punctuation_modifier + 1; // Since we are handling a boolean, if its true its double (1 + 1) or false (1 + 0). // ui_vp_message->insertPlainText(f_character); } diff --git a/src/text_file_functions.cpp b/src/text_file_functions.cpp index 29c5c42..779765d 100644 --- a/src/text_file_functions.cpp +++ b/src/text_file_functions.cpp @@ -46,13 +46,18 @@ int AOApplication::get_max_log_size() return result; } -int AOApplication::get_pundelay() +bool AOApplication::get_slower_blips() { - int result = configini->value("punctuation_delay", 2).toInt(); - if (result < 1 || result > 3) { - result = 2; - } - return result; + QString result = + configini->value("slower_blips", "false").value(); + return result.startsWith("true"); +} + +bool AOApplication::get_pundelay() +{ + QString result = + configini->value("punctuation_delay", "false").value(); + return result.startsWith("true"); } bool AOApplication::get_log_goes_downwards() From 8fa96535efbfff148964b33cd0f1a0e0e479ddb6 Mon Sep 17 00:00:00 2001 From: cents Date: Mon, 20 Apr 2020 12:34:54 -0700 Subject: [PATCH 20/30] Hooked up the new settings Did you know you could scale the iclog with ctrl + mouse wheel? --- src/aooptionsdialog.cpp | 2 +- src/courtroom.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index e2f433d..f6507d5 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -193,7 +193,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_slower_blips_lb->setText(tr("Slower text speed:")); ui_slower_blips_lb->setToolTip(tr("Set the text speed to be the same as the AA games.")); ui_slower_blips_cb = new QCheckBox(ui_form_layout_widget); - ui_slower_blips_cb->setChecked(p_ao_app->get_pundelay()); + ui_slower_blips_cb->setChecked(p_ao_app->get_slower_blips()); ui_gameplay_form->setWidget(10, QFormLayout::FieldRole, ui_slower_blips_cb); ui_gameplay_form->setWidget(10, QFormLayout::LabelRole, ui_slower_blips_lb); diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 0cacffc..050d606 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -166,6 +166,7 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow() ui_ooc_chat_name->setText(p_ao_app->get_default_username()); punctuation_modifier = p_ao_app->get_pundelay(); + slower_blips = p_ao_app->get_slower_blips(); colorf_iclog = p_ao_app->get_colored_iclog_enabled(); mirror_iclog = p_ao_app->get_iclmir_enabled(); colorf_limit = p_ao_app->colorlog_restricted_enabled(); @@ -4256,6 +4257,7 @@ void Courtroom::on_reload_theme_clicked() { ao_app->reload_theme(); punctuation_modifier = ao_app->get_pundelay(); + slower_blips = ao_app->get_slower_blips(); colorf_iclog = ao_app->get_colored_iclog_enabled(); mirror_iclog = ao_app->get_iclmir_enabled(); colorf_limit = ao_app->colorlog_restricted_enabled(); From ee0c42ea54b1dff690e92044f49d4caa581fd25e Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Mon, 20 Apr 2020 22:41:13 -0600 Subject: [PATCH 21/30] Update reference for the themes submodule --- base/themes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/themes b/base/themes index 6e1317e..a54fa4f 160000 --- a/base/themes +++ b/base/themes @@ -1 +1 @@ -Subproject commit 6e1317ed93a9a4831047aa151c28742b1dd8afb5 +Subproject commit a54fa4f5b73c35297f141b9b4ff4751816e7d3e8 From 0a656d222d9a0cacd5b2baf08499daaf4733f0b9 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Tue, 21 Apr 2020 01:52:17 -0600 Subject: [PATCH 22/30] fix typo --- src/aooptionsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aooptionsdialog.cpp b/src/aooptionsdialog.cpp index f6507d5..e2c6ac8 100644 --- a/src/aooptionsdialog.cpp +++ b/src/aooptionsdialog.cpp @@ -199,7 +199,7 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app) ui_pun_delay = new QLabel(ui_form_layout_widget); ui_pun_delay->setText(tr("Blip delay on punctuations:")); - ui_pun_delay->setToolTip(tr("Punctation delay modifier." + ui_pun_delay->setToolTip(tr("Punctuation delay modifier." " Enable it for the blips to slow down on punctuations.")); ui_pun_delay_cb = new QCheckBox(ui_form_layout_widget); ui_pun_delay_cb->setChecked(p_ao_app->get_pundelay()); From 44670e3b0204d293dcedaa85651f7e9f10614863 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Tue, 21 Apr 2020 02:47:52 -0600 Subject: [PATCH 23/30] Update Spanish translation --- resource/translations/ao_es.qm | Bin 27795 -> 28457 bytes resource/translations/ao_es.ts | 287 +++++++++++++++++---------------- 2 files changed, 152 insertions(+), 135 deletions(-) diff --git a/resource/translations/ao_es.qm b/resource/translations/ao_es.qm index 420f95945b4b5511b5720d78769ad7dd953595da..42ca3a006295aa12bbbe5ad28617f6dd55081d1f 100644 GIT binary patch delta 2069 zcmZ8heN$dD_ex$)ZGwiXCKkj{hzxTes z_kEt{eSbG{QnjO3^-Myz8JIf*$eRun>Ve@CfQm+7{xo3m9@=xjk}m;k2h@=_fjMKL z-dzvmKL>RWfPy55g;~J7ib3m=Ao>^ZoF3vM`+zAf=!7m{**myBJ{54iiOd$(Nj{3g zeFH#vSTg2k1cBKDu$BA`cltw;d=o zpy7pLAp0OT&%6L+lwgbJFpyY+?XC196MH^e2jt$sp;Ns;+G!k1>j%dC2A5M?5k~1{ zmCpApu%J?;%;_8oBNN!7)}{642kFh-V9(St(j8Y(cXPZ+sXOaxTB2CehUxYjndurNFB@C&r_RB@LV6X4x1#$EYKK3i#2mn41w=trp^ z-yKc|;xDTs+T{fBy}Eh+0W$kg-Mnoc6TduY=ia9NEXM>avZ+s$RRAgR>VHnw1C#pH zS3+cbdxg3`qZJtWp_sCB9sNVaQJX4h3&d&d@3D1XiME%RfAS*n{@u?5?gG&sHV_;6VO5K6_ZPjVow*HH)JR$KTYrt^FM6YE3xl6eVA%S#yR2^Qttj^)jy1r#WY#V%BTgF*&0- z=pJo&>1j^+tSefFrydyM)UJPQC#QFbc54xPmoQ7)lfVR)1==$+x&XOGdp+j|Kyqsb z>eOVgNteEwQqF1CO<%c$3N-3wnHg7Hsr&u>Z04!gJ=(+k`haeIG7COXquX54&ldh& z*M9aKiN7A!z5S|{ft`|i;SfOMk;Fy4M1D~k`42Lh(kxB-cs6@`UdrFdgBklJ+tY5| zmcx?L#CUg-6zC|Y#BWLK)EC&Y9;xjv7An6k?N2-g=vGLF20o=C*QAg3>}8xwy5T0V z5li){(-}82oUJeUkpXd|^^fG=M~VIV7KuYx^}2q?mTkcO7xa5Gi>Xkd{);lUB7K7X zw5yv5x9ZP+lRyUF=&vPG3H{Od@s4_+EHS?Qn84dKCjLm(c;1$T_~U))yoPP@Ul*|@ zBXox3{tV{NHB4LG%ln_{GFYbMvd5no%B$L#_+CR3cwq8VhW#r37jlLVTI+hlJAqbU zsn78BjxJ7hqtRUK1*V=dHXR%djGk%yQ+Yc9o;QB}Jg;R%uknkU^xtva`0dln31oxu zhm?9C%WnM9IF>C;G)=4s@csj_1(X)k+(#{(+IrIi|Lq6vahmE+e#!!p>520W9_TW4 zOyE9ux#^9@?|{23rac=}yr#oU@4iTX(Gk;`uV}}1n+D!x%Y*}FK}ZJ{HkyZ6mhnI0 zHcwvL#2Gkio)`U}q&{o*&e@*EX*_OjJ~EC{8qJ+M$>5$e^C#K8{Gp69A2$~R6LZ*b zw?Fc>Yh34BqMT4N5%)ns2m#m;gby-zUcUXPqYd$G$3t-A5_c9I2|~jsWwyudmmP}7 z{#)7SmHlWuJHxrkV}!PNi-;jd~(p^TO~VutGvG=9E{krk|P_ZW`rMx zEe3HVVMGB&WpmKuAgCxb4{cP2)qF>V2yz|3U%B$c&ebwLh}zhCkp8dfE{}=g`~}@S z}4E43K2!o61i-WiQEy8t1BuBA~=Hrf+;9jIqK|+NGdjn zZ6X>HZIJ^rN(ME7ijtR6R7CNPk&~#6nc?7gL4}UPuV>!(eJ4 z7KjP~LhFH8E#Pz03R(q*b^yX%KMlz*CQESTWn8&=l-shrJ5TiM*{xQ3yLz%tpM0%ziT_4;sN7U;dvwPea9<9J^UH>uQKH)7eH}v*k&(LR@*6Ibgi;| zH*Hjb@@XmozCT6z?9XUQx?4zC4S5Nz7M4Z4ZAo4ol>SUigkUYTW$Nvl4{&Pls=J&R7+_T24rv9( zyi&gm8UW-x_0Xpx5m#t@*OIyjl_vPJh3wc>6K z`!su!1}WL!n)8@8!Zn$)wU#E)^eAnq1lb9t+GZmJhpJ0yL}T(?cD=j2!t)Q!|I`n*1t{ z!{_`&>k&-9;970c8@?;uwd&|Yxx%CZ1S-#OG@5=d#C!}$y^ZcUxTn71 zkBP?oNPbYU>Bh?Qo*eS^#>N8#ZfZ52o7Mw(HXAP+%`z~#lS1bV*vub$HeQp)IyGjx o9&xj|2bdb&r$10PE{X`$8wlSGktjeu#$u^0(>$utZr(EXe;om%bpQYW diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts index ce2a43c..ceacf5a 100644 --- a/resource/translations/ao_es.ts +++ b/resource/translations/ao_es.ts @@ -168,41 +168,37 @@ Razón: Establece el tema visual utilizado en el juego. Si el nuevo tema también cambia el aspecto del lobby, deberá volver a cargar el lobby para que los cambios surtan efecto, como unirse a un servidor y volver al lobby. - - + Log goes downwards: Invertir historial IC: - - + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. Si está marcado, los nuevos mensajes aparecerán en la parte inferior (como el chat OOC). - - + Log length: Limite del historial: - - + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. La cantidad de mensajes que mantendrá el historial del chat IC antes de eliminar mensajes más antiguos. 0 significa 'infinito'. - + Default username: Usuario predeterminado: - + Your OOC name will be automatically set to this value when you join a server. Su nombre OOC se establecerá automáticamente a este cuando se una a un servidor. - + Custom shownames: Mostrar nombres: @@ -211,72 +207,77 @@ Razón: Activa la casilla 'Mostrar nombres' de forma predeterminada en el juego, que a su vez determina si el cliente debe mostrar nombres personalizados en los personajes. - + Backup MS: Master SV de respaldo: - + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. Si la lista de servidores predeterminada falla, el juego probará la dirección proporcionada aquí. - + Discord: Discord: - + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. Permite a otros en Discord ver en qué servidor estás, qué personaje juegas y cuánto tiempo has estado jugando. - + Allow Shake/Flash: Permitir Shake/Flash: - + Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. Permite el movimiento de la pantalla y el parpadeo. Desactive esto si tiene inquietudes o problemas con la fotosensibilidad y/o convulsiones. - + Language: Idioma: - + Sets the language if you don't want to use your system language. Establece el idioma si no desea utilizar el idioma de su sistema. - + + Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + Habilítelo para agregar una pequeña pausa en los signos de puntuación. + + + Callwords Palabras clave - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> <html><head/><body>Ingrese tantas palabras de llamada como desee.<br>Esto no distingue entre mayúsculas y minúsculas. ¡Asegúrese de dejar cada palabra en su propia línea!<br>No deje una línea con un espacio al final; recibirá una alerta cada vez que alguien use un espacio en sus mensajes.</body></html> - + Audio Audio - + Audio device: Dispositivo: - + Sets the audio device for all sounds. Establece el dispositivo de audio. - + Music: Música: @@ -285,7 +286,7 @@ Razón: Establece el volumen predeterminado de la música. - + SFX: SFX: @@ -294,192 +295,207 @@ Razón: Establece el volumen predeterminado de SFX. Las interjecciones y los efectos de sonido reales cuentan como 'SFX'. - + Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. Activa la casilla 'Mostrar nombres' de forma predeterminada en el juego, que a su vez determina si el cliente debe mostrar nombres personalizados en los personajes. - + + Slower text speed: + Texto más lento: + + + + Set the text speed to be the same as the AA games. + La velocidad del texto será la misma que en los juegos de AA. + + + + Blip delay on punctuations: + Retraso en puntuación: + + + Sets the default volume for music. Establece el volumen predeterminado de la música. - + Sets the default volume for SFX sounds, like interjections or other character sound effects. Establece el volumen predeterminado para sonidos SFX, como las interjecciones y otros efectos de sonido de personajes. - + Blips: Blips: - + Sets the volume of the blips, the talking sound effects. Establece el volumen de los blips, el sonido al hablar. - + Blip rate: Tasa de blips: - + Sets the delay between playing the blip sounds. Establece el retraso entre la reproducción de los sonidos blip. - + Blank blips: Blips en blanco: - + If true, the game will play a blip sound even when a space is 'being said'. Si está marcada, el juego reproducirá un sonido blip incluso cuando se 'dice' un espacio. - + Enable Looping SFX: Habilitar repetición de SFX: - + If true, the game will allow looping sound effects to play on preanimations. Si está habilitado, el juego permitirá que se reproduzcan efectos de sonido en bucle en preanimaciones. - + Kill Music On Objection: Parar la música al objetar: - + If true, the game will stop music when someone objects, like in the actual games. Si está habilitado, el juego detendrá la música cuando alguien haga una objeción, como en los juegos. - + Casing Caso - + This server supports case alerts. Este servidor admite alertas de casos. - + This server does not support case alerts. Este servidor no admite alertas de casos. - + Pretty self-explanatory. Bastante autoexplicativo. - + Casing: Caso: - + If checked, you will get alerts about case announcements. Si está marcado, recibirá anuncios de casos. - + Defense: Abogado: - + If checked, you will get alerts about case announcements if a defense spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si hay un lugar de abogado libre. - + Prosecution: Fiscal: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. Si está marcada, recibirá alertas sobre anuncios de casos si hay un puesto de fiscal libre. - + Judge: Juez: - + If checked, you will get alerts about case announcements if the judge spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si el puesto de juez está libre. - + Juror: Jurado: - + If checked, you will get alerts about case announcements if a juror spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si hay un puesto de jurado libre. - + Stenographer: Taquígrafo: - + If checked, you will get alerts about case announcements if a stenographer spot is open. Si está marcado, recibirá alertas sobre anuncios de casos si hay un lugar de taquígrafo libre. - + CM: CM: - + If checked, you will appear amongst the potential CMs on the server. Si está marcado, aparecerá entre los posibles CM en el servidor. - + Witness: Testigo: - + If checked, you will appear amongst the potential witnesses on the server. Si está marcado, aparecerá entre los posibles testigos en el servidor. - + Hosting cases: Casos: - + If you're a CM, enter what cases you are willing to host. Si eres un CM, ingresa qué casos estás dispuesto a organizar. - + IC Log - + Only inline coloring will be shown such as <>,|| etc. Solo se mostrará el color en línea, como <>, ||, etc. - + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. El registro de IC reflejará el chat In-Character. Lo que significa que si alguien es interrumpido, nadie sabrá lo que se iba a decir. Habilitar para una experiencia más realista. @@ -488,17 +504,17 @@ Razón: El registro de IC reflejará el chat In-Character. Lo que significa que si alguien es interrumpido, nadie sabrá lo que se iba a decir. Habilitar para una experiencia más realista. - + Colorful IC log: Log IC colorido: - + Enables colored text in the log. Habilita texto con color en el log. - + Only inline coloring: Solo coloración en línea: @@ -507,7 +523,7 @@ Razón: Solo se mostrará el color en línea, como <>, ||, etc. - + Mirror IC log: IC log refleja interrupciones: @@ -530,14 +546,15 @@ Razón: - + Search Buscar Passworded - Con contraseña + A translation wouldn't fit because of the shitty theme system. + @@ -578,13 +595,13 @@ Razón: Nombre - + Pre A translation wouldn't fit because of the shitty theme system. - + Flip A translation wouldn't fit because of the shitty theme system. @@ -594,138 +611,138 @@ Razón: Guardia - - + + Casing This could be translated as 'caso' and it wouldn't get cut, but there are so many other buttons that can't be translated on the courtroom window that might as well leave this also untranslated so it's at least consistent. - + Shownames A translation wouldn't fit because of the shitty theme system. - + No Interrupt A translation wouldn't fit because of the shitty theme system. - + White Blanco - + Green Verde - + Red Rojo - + Orange Naranja - + Blue Azul - + Yellow Amarillo - + Rainbow Arcoíris - + Pink Rosado - + Cyan Cian - + % offset % desplazamiento - + Music - + Sfx - + Blips - + Log limit - + Change character - + Reload theme - + Call mod - + Settings - + A/M - + Preanim - + Back to Lobby 'Volver al lobby' got cut, changed to just Lobby Lobby - - + + You were granted the Disable Modcalls button. Se le concedió el botón para deshabilitar llamadas a moderadores. - + You have been banned. Has sido vetado. @@ -734,104 +751,104 @@ Razón: Te ha sido otorgado el botón Guardia. - + This does nothing, but there you go. Esto no hace nada, pero ahí lo tienes. - + You opened the settings menu. Abriste el menú de configuración. - + You will now pair up with Ahora te emparejarás con - + if they also choose your character in return. si ellos también eligen a tu personaje a cambio. - + You are no longer paired with anyone. Ya no estás emparejado con nadie. - + Are you sure you typed that well? The char ID could not be recognised. ¿Estás seguro de que lo escribiste bien? El ID de personaje no pudo ser reconocido. - + You have set your offset to Ha configurado su desplazamiento en - + Your offset must be between -100% and 100%! ¡Su desplazamiento debe estar entre -100% y 100%! - + That offset does not look like one. Ese desplazamiento no se parece a uno. - + You switched your music and area list. Cambiaste tu lista de música y área. - + You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this. Ha habilitado forzosamente funciones que el servidor puede no admitir. Es posible que no pueda hablar IC, o peor, debido a esto. - + Your pre-animations interrupt again. Sus pre-animaciones interrumpen de nuevo. - + Your pre-animations will not interrupt text. Sus pre-animaciones no interrumpirán el texto. - + Couldn't open chatlog.txt to write into. No se pudo abrir chatlog.txt para escribir. - + The IC chatlog has been saved. El chat IC se ha guardado. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there. ¡No tienes una carpeta `base/cases /`! Ha sido creada para ti. Pero debido a que no existia la carpeta, tampoco habían casos guardados ahí. - + You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini. Cases you can load: %1 ¡Debe dar un nombre de archivo para cargar (no se necesita extensión)! Asegúrese de que esté en la carpeta `base/cases/` y de que tenga el formato correcto. Casos que puede cargar: %1 - + Case made by %1. Caso hecho por %1. - + Navigate to %1 for the CM doc. Navegue a %1 para el documento del CM. - + Your case "%1" was loaded! Su caso "%1" fue cargado! @@ -842,7 +859,7 @@ Cases you can load: Casos que puede cargar: - + Too many arguments to load a case! You only need one filename, without extension. ¡Demasiados argumentos para cargar un caso! Solo necesita un nombre de archivo, sin extensión. @@ -867,12 +884,12 @@ Casos que puede cargar: " fue cargado! - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it. ¡No tienes una carpeta `base/cases /`! Fue creada para ti. - + You need to give a filename to save (extension not needed) and the courtroom status! ¡Debe dar un nombre de archivo para guardar (no se necesita la extensión) y el estado de la sala del tribunal! @@ -882,18 +899,18 @@ Casos que puede cargar: ¡Demasiados argumentos para salvar un caso! Solo necesita un nombre de archivo sin extensión y el estado de la sala del tribunal. - + Succesfully saved, edit doc and cmdoc link on the ini! ¡Guardado con éxito, puede editar el doc y doc link en el archivo ini! - + Master - - + + Server @@ -903,38 +920,38 @@ Casos que puede cargar: Mensaje OOC - + Disable Modcalls - + Too many arguments to save a case! You only need a filename without extension and the courtroom status. ¡Demasiados argumentos para salvar un caso! Solo necesita un nombre de archivo sin extensión y el estado de la sala del tribunal. - + Reason: Razón: - + Call Moderator Llamar Moderador - - + + Error Error - + You must provide a reason. Debes proporcionar una razón. - + The message is too long. El mensaje es muy largo. From 955a32a95af8412caceacece9bbf40077a4b7382 Mon Sep 17 00:00:00 2001 From: likeawindrammer <31085911+likeawindrammer@users.noreply.github.com> Date: Tue, 21 Apr 2020 02:48:22 -0600 Subject: [PATCH 24/30] Update Portuguese translation --- resource/translations/ao_pt.qm | Bin 27951 -> 28605 bytes resource/translations/ao_pt.ts | 284 +++++++++++++++++---------------- 2 files changed, 150 insertions(+), 134 deletions(-) diff --git a/resource/translations/ao_pt.qm b/resource/translations/ao_pt.qm index a98eef3585ec0f57ed3176290d2a97a8fcce352c..242917fff1b18c2741f31d02bb2cd94f27fafc23 100644 GIT binary patch delta 2024 zcmZ8hdr(w$6#n*d?>;X37z0C)@M1Zp)k=^rP!y4e3v3XW=6h*ZSzC8ucMWple1Wr%H+Kt?0PP5_zl zkg|sZS+jd>$%l|ib9hb*>6uMH;$mopZNTg@+!Y=VICGHH$T~4)$li1v2t>qSQi2bd za2mP!KLK-^k-NH>1-g5!vl`ZAOpuw5qP>?`Xbh%Rai3d^nHSap1v08uS%Hy$tR8m; zNGL&rYabAmiFHl%BMBW})&Qxk*nPMQ7&;gShV%e&t+*WDga959Ra(z0K#pCd-PHix z*{mAU_CD}Xgvwpz2J#eD+3;H08dcRACWtzqdbx(k=QgX}vZevE_Nl(fJqHXrs5-lk z-_zd{40W^E(FP%Y2|EyRK^VG`z)}VY8;Jw$vx{qg2%06O#)Te;%qWFAUzzl?+73(zf3E;d~ zKWPh@Jtfw!$ztN=y*9l^{4&J|JUU7|SU82+wTZtClLLd_w6?Nx5$@|FGH8qiriW1BWGB*hJRtE0qMQ4-#pm^mL&Y5YnaB zUgSVpQl!R49<-E6@9$#5vBRa$6Z!%rN2Gs}=27#}YRlPL0{LED;30rHl6q>8;eDBE zr=^Djov#i=9|n>?S1&nAf@w+Wce)r?@PzuuWOgh^& zo_vfQDA0~KG0yt5cG0Af%u}IV+{yfMu69`r3(gp&U7g=U3D0R;PW?#Y9|W`?zinY) zn@)VV51`K1Nt3%cEN)%DU&$zOgYJR76R2&cE@K4`CLGe`E_d>_Y|uGs8SiY>dDj=Q z#anbW;u%V|Q@3_73r+q>w>jznpv}?kzWxO}a#^>hVfa>`sduKZbFsf%9_y zH3o#m%Fkpx!i2KisN)dMnkF|ltl__4hrBV#$_~ZJhYBf$IZHlLvXcpy$)`?6lEDf2 zN)$UGw}ub3R|16}g|{3K*y17K`)3a2ZPAB+eZkCYxF-BW9wq79t&izR0A~K8A63!C z`=3;zPfkpw#^w5=nQNJNpuQG7Fl?26vx@(P7;$%*3gK_%B9^k>H#>(%%;DKYt7f#!$`3mFu`?yc-XWa1IIbd*u zvEwBbB|C52{yP167mY`c(GDy(Uf)j1gbtG+n1P4iH1$cI#UIuyreRBKIRhI_S;7BF z{2-G%eccdF`B78-{(IQU2vd7289bO}`fOwua8I}CYm*hYe;x&&FSf6cCPwDni!}J* zg$+JN&C^e^P@G){4stR*q1`ShRQa+WG~hs*Yq;&Cgb3*C?V7ux(zkK0!l z9~;yDZS=|5KsB;?v=~mf`1s)nCAEbLDg0um_i;YKGC{AxQVX~WmUf_wJI75ZHtu|( zZ*Io>7~|u~;5lb#XTOpCHpsRRX7f$V1^Ks7-hjTqV|UJVI=p5j!)+^eITWW~nd|W? z{t|~$Ool$i?@@d%Pq||El)L}W)Lb{Ge{|i)BN760*gyqO5`&BAf}HF`){Dtbj}l^E z!FO=&W1JU1a24dbfIHs}-oe-)xB0a5ZmiRo`xc4BLWe&D&+n-4E51^P!>;(_JW8=6 zbm)8{qMM;>^P}Ct*$~0}bA!v#X z7$mQV7?Mh65EYtI6EzDJ6;mY32Qc_(#z-w4GZkn#{MvKAZ+~mAz1H66XphizRoLa? z+z3Pl0l|9!y9&4*1X8vFbAAFAwE)pMz~bL{mjJ2sTOhO=Qd2Gv;RC4?jLnekzQp)@ zIIf6>yf%*Ss~~Sa47@fGda)Hq(_oyz3s`XjwrbXKS7ARq1UN^zBgXm;f!{}b;%y*3 z0P&T}2)unbW{!qqCjlb5kbLGL3w0nhkKZwmkoKS+a8x6&+yVHeqcY?!U=>i6)eemA zL46I+VMEJ>LLe{%ZCAU2X~%JK+92RL2amjJ;KbZALBHk`cKBG(pRD4;aA8{0J~AH= zvh%Wm*n`44-y$H+L&&QofZJ+eS0R~a1PFT^VZf3l!sYmTz$@88e>?BPf<;qlIuJ5l z^vb6KqaKLfhe*utJ2B*RJ{w6Dmp*g=l2zRBq`}FA1o4BH$IG~A;1hIwM$(|DfG@R{W((wX4FfM-(|-h%cMbT4KT(>9@|(5Og|-il%+C0ll>Zg zB!TsE{1?Rcc_J@t+6`o8$xAhntm`VTbQW}RSVqX3k~nB$g#6j|3Nkz|S6B0)T_f*1 zNkIQo@_DN(hv#kixh<2PpVh|p7m-MgcHSBiNGsPadeNbGk9Jk;AT8+A=3i%H!9Q!i z?&iH?KzqxdO4&cvjSuhy7F^OTxyIoRUZ!(qWaR=Q%XK>o8cF1~uG57NXYJKp4{8O* z=j;9pcuJ{4bVKVUGA_{jY@~EyWAuUVE#@rT)rVS`7jM*m7&D8+RsEJu0;}=*o$f5O zxLseFI7rLx=^Jj|B7V63`>$e|7p6#aM*`YJry?)t24+KfWkaN-|$PWOD#P`_(H+lzc|7dTr$i z0*+H}_PLOGj{3xn3aE_+?~GhvUW}pPqDV=P7|x}6b8G4immW|#)EasduCj2k(S6X$ z0-KC}8@stp^Ns$m2Ll0$F*&V{3bq)FzLNGmKaP=$L4bFLrepv ziB#q<^Yj$X7BC#&>NQ7h@n?fJbMEgQ+<)6C^GAPV(Bl&Gfmb`ou)%zA>pftK&D`>_ zK#%U5kA2SbxB~O_8;lc2n1_zhDzU{PiatPsuVtivI{y=sEHif$k$9XX`o;fZLaQY^ zfKHOYp><(tZra(vE`D*p>Rz=qch7&vL-kGDo=1}PIK?`DE0HR PHha!qu4}#)+UN5>srr_F diff --git a/resource/translations/ao_pt.ts b/resource/translations/ao_pt.ts index 67928a5..e20ed11 100644 --- a/resource/translations/ao_pt.ts +++ b/resource/translations/ao_pt.ts @@ -155,42 +155,38 @@ Motivo: %1 Define o tema usado no jogo. Se o novo tema alterar a aparência do lobby, será necessário recarregá-lo para que as alterações tenham efeito, como ingressar em um servidor e deixá-lo. - - + Log goes downwards: Log vai para baixo: - - + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. Removed the part about AO1 behaviour, nobody cares boomer. Se selecionado, novas mensagens irão aparecer na parte inferior (assim como o chat OOC). - - + Log length: Tamanho do log: - - + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. A quantidade de mensagens que o chat do IC manterá antes de excluir as mensagens mais antigas. Um valor igual ou inferior a 0 conta como 'infinito'. - + Default username: Nome de usuário padrão: - + Your OOC name will be automatically set to this value when you join a server. Seu nome OOC será automaticamente definido com esse valor quando você ingressar em um servidor. - + Custom shownames: Nomes personalizados: @@ -200,72 +196,77 @@ Motivo: %1 Fornece o valor padrão para a caixa de seleção 'Shownames' no jogo, que determina se o cliente deve exibir nomes personalizados nos caracteres. - + Backup MS: MS de backup: - + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. Se as pesquisas internas do servidor falharem, o jogo tentará o endereço fornecido aqui e o usará como um endereço de servidor principal de backup. - + Discord: - + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. Permite que outras pessoas no Discord vejam em que servidor você está, qual personagem está jogando e há quanto tempo está jogando. - + Allow Shake/Flash: Permitir Shake/Flash: - + Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. Permite agitar e piscar. Desative isso se você tiver preocupações ou problemas com fotosensibilidade e/ou convulsões. - + Language: Língua: - + Sets the language if you don't want to use your system language. Define o idioma se você não quiser usar o idioma do sistema. - + + Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + Habilite para adicionar uma pequena pausa nos sinais de pontuação. + + + Callwords Palavras-chave - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> <html><head/><body>Digite quantas palavras-chave você desejar. Estes não diferenciam maiúsculas de minúsculas. Certifique-se de deixar cada palavra chave em sua própria linha!<br>Não deixe uma linha com um espaço no final - você será alertado toda vez que alguém usar um espaço em suas mensagens.</body></html> - + Audio Áudio - + Audio device: Dispositivo de áudio: - + Sets the audio device for all sounds. Define o dispositivo de áudio para todos os sons. - + Music: Música: @@ -274,7 +275,7 @@ Motivo: %1 Define o volume padrão da música. - + SFX: SFX: @@ -283,212 +284,227 @@ Motivo: %1 Define o volume padrão do SFX. Interjeições e efeitos sonoros reais contam como 'SFX'. - + Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. Fornece o valor padrão para a caixa de seleção 'Shownames' no jogo, que determina se o cliente deve exibir nomes personalizados nos caracteres. - + + Slower text speed: + Texto mais lento: + + + + Set the text speed to be the same as the AA games. + A velocidade do texto será a mesma dos jogos AA. + + + + Blip delay on punctuations: + Atraso na pontuação: + + + Sets the default volume for music. Define o volume padrão da música. - + Sets the default volume for SFX sounds, like interjections or other character sound effects. Define o volume padrão para sons SFX, como interjeições ou outros efeitos sonoros de personagens. - + Blips: - + Sets the volume of the blips, the talking sound effects. Define o volume dos blips, os efeitos sonoros de fala. - + Blip rate: Taxa de blip: - + Sets the delay between playing the blip sounds. Define o atraso entre a reprodução dos sons de blip. - + Blank blips: Blips em branco: - + If true, the game will play a blip sound even when a space is 'being said'. Se ativado, o jogo emitirá um sinal sonoro, mesmo quando um espaço estiver sendo "dito". - + Enable Looping SFX: Ative o SFX em loop: - + If true, the game will allow looping sound effects to play on preanimations. Se ativado, o jogo permitirá que efeitos sonoros em loop sejam reproduzidos em pré-animações. - + Kill Music On Objection: Parar a música no protesto: - + If true, the game will stop music when someone objects, like in the actual games. Se ativado, o jogo interrompe a música quando alguém protestar , como nos jogos reais. - + Casing Caso - + This server supports case alerts. Este servidor suporta anúncios de casos. - + This server does not support case alerts. Este servidor não suporta alertas de caso. - + Pretty self-explanatory. Bastante auto-explicativo. - + Casing: Caso: - + If checked, you will get alerts about case announcements. Se marcado, você será alertado quando houverem anúncios de casos. - + Defense: Defesa: - + If checked, you will get alerts about case announcements if a defense spot is open. Se marcado, você receberá alertas sobre os anúncios de casos, se um ponto de defesa estiver aberto. - + Prosecution: Promotor: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. Se marcado, você receberá alertas sobre os anúncios de casos, se uma posição de promotor estiver disponível. - + Judge: Juíz: - + If checked, you will get alerts about case announcements if the judge spot is open. Se marcado, você receberá alertas sobre os anúncios de casos, se o local do juíz: estiver aberto. - + Juror: Jurado: - + If checked, you will get alerts about case announcements if a juror spot is open. Se marcado, você receberá alertas sobre os anúncios de casos, se um local do jurado estiver aberto. - + Stenographer: Estenógrafo: - + If checked, you will get alerts about case announcements if a stenographer spot is open. Se marcado, você receberá alertas sobre anúncios de casos, se um local de estenógrafo estiver aberto. - + CM: CM: - + If checked, you will appear amongst the potential CMs on the server. Se marcado, você aparecerá entre os CMs possíveis no servidor. - + Witness: Testemunha: - + If checked, you will appear amongst the potential witnesses on the server. Se marcado, você aparecerá entre as testemunhas em potencial no servidor. - + Hosting cases: Casos: - + If you're a CM, enter what cases you are willing to host. Se você é um CM, insira os casos que deseja hospedar. - + IC Log - + Colorful IC log: Log IC colorido: - + Enables colored text in the log. Ativa o texto colorido no log. - + Only inline coloring: Somente coloração em linha: - + Only inline coloring will be shown such as <>,|| etc. Somente a coloração em linha será mostrada como <>, ||, etc. - + Mirror IC log: O log IC reflete interrupções: - + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. O log IC espelhará o chat IC Significando que se alguém for interrompido, ninguém saberá o que queria dizer. Habilite para uma experiência mais realista. @@ -507,7 +523,7 @@ Motivo: %1 - + Search Pesquisar @@ -549,283 +565,283 @@ Motivo: %1 Nome - + Pre A translation wouldn't fit because of the shitty theme system. - + Flip A translation wouldn't fit because of the shitty theme system. - + Disable Modcalls - - + + Casing A translation wouldn't fit because of the shitty theme system. - + Shownames A translation wouldn't fit because of the shitty theme system. - + No Interrupt A translation wouldn't fit because of the shitty theme system. - + White Branco - + Green Verde - + Red Vermelho - + Orange Laranja - + Blue Azul - + Yellow Amarelo - + Rainbow Arco Iris - + Pink Rosa - + Cyan Ciano - + % offset % deslocamento - + Music - + Sfx - + Blips - + Log limit - - + + Server - + Change character - + Reload theme - + Call mod - + Settings - + A/M - + Preanim - + Back to Lobby A translation wouldn't fit because of the shitty theme system. Lobby - - + + You were granted the Disable Modcalls button. Você recebeu o botão Desativar Modcalls. - + You have been banned. Você foi banido. - + This does nothing, but there you go. Isso não faz nada, mas lá vai você. - + You opened the settings menu. Você abriu o menu de configurações. - + You will now pair up with Agora você vai fazer par com - + if they also choose your character in return. se eles também escolherem seu personagem em troca. - + You are no longer paired with anyone. Você não está mais fazendo par com ninguém. - + Are you sure you typed that well? The char ID could not be recognised. Você tem certeza que você escreveu isso certo? O ID do personagem não pôde ser encontrado. - + You have set your offset to Você definiu seu deslocamento como - + Your offset must be between -100% and 100%! Seu deslocamento deve estar entre -100% e 100%! - + That offset does not look like one. Esse deslocamento não se parece com um. - + You switched your music and area list. Você mudou sua lista de músicas e áreas. - + You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this. Você forçou recursos que o servidor pode não suportar. Você pode não conseguir falar de IC, ou pior, por causa disso. - + Your pre-animations interrupt again. Suas pré-animações interrompem novamente. - + Your pre-animations will not interrupt text. Suas pré-animações não interromperão o texto. - + Couldn't open chatlog.txt to write into. Não foi possível abrir o chatlog.txt para gravar. - + The IC chatlog has been saved. O chat do IC foi salvo. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there. Você não possui uma pasta `base/cases/`! Foi feito para você, mas, como foi feito para você, provavelmente o arquivo do caso que você está procurando não pode ser encontrado lá. - + You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini. Cases you can load: %1 Você precisa fornecer um nome de arquivo para carregar (extensão não necessária)! Verifique se está na pasta `base/cases/` e se é um ini formatado corretamente. Casos que você pode carregar: %1 - + Too many arguments to load a case! You only need one filename, without extension. Muitos argumentos para carregar um caso! Você só precisa de um nome de arquivo, sem extensão. - + Case made by %1. Caso feito por %1. - + Navigate to %1 for the CM doc. Navegue para %1 para o documento do CM. - + Your case "%1" was loaded! Seu caso "%1" foi carregado! - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it. Você não possui uma pasta `base/cases/`! Foi feito para você, mas, como foi feito para você, é provável que você o tenha excluído. - + You need to give a filename to save (extension not needed) and the courtroom status! Você deve fornecer um nome de arquivo para salvar (sem extensão necessária) e o estado do tribunal! - + Too many arguments to save a case! You only need a filename without extension and the courtroom status. Muitos argumentos para salvar um caso! Você só precisa de um nome de arquivo sem extensão e o estado do tribunal. @@ -834,38 +850,38 @@ Casos que você pode carregar: %1 Muitos argumentos para salvar um caso! Você só precisa de um nome de arquivo sem extensão e o estado do tribunal. - + Succesfully saved, edit doc and cmdoc link on the ini! Salvo com sucesso, você pode editar o documento e o link do documento no arquivo ini! - + Master - + Reason: Razão: - + Call Moderator Chamar um Moderador - - + + Error Erro - + You must provide a reason. Você deve fornecer um motivo. - + The message is too long. A mensagem é muito longa. From 2c71bd1adc879ba2cc0e1d5716b5eb05537044b4 Mon Sep 17 00:00:00 2001 From: sD Date: Thu, 23 Apr 2020 20:01:37 +0200 Subject: [PATCH 25/30] run lupdate so translators can do their work --- resource/translations/ao_de.ts | 437 +++++++++++++++++++------------- resource/translations/ao_en.ts | 441 +++++++++++++++++++-------------- resource/translations/ao_es.ts | 2 +- resource/translations/ao_jp.ts | 435 ++++++++++++++++++-------------- resource/translations/ao_pl.ts | 439 +++++++++++++++++++------------- resource/translations/ao_pt.ts | 2 +- resource/translations/ao_ru.ts | 439 +++++++++++++++++++------------- 7 files changed, 1286 insertions(+), 909 deletions(-) diff --git a/resource/translations/ao_de.ts b/resource/translations/ao_de.ts index 2fd6c7f..f63fa91 100644 --- a/resource/translations/ao_de.ts +++ b/resource/translations/ao_de.ts @@ -4,12 +4,12 @@ AOApplication - + Disconnected from server. Vom Server getrennt. - + Error connecting to master server. Will try again in %1 seconds. Fehler bei der Verbindung zum Master Server. Erneuter Versuch in %1 Sekunden. @@ -18,7 +18,7 @@ Fehler bei der Verbindung zum Master Server. Erneuter Versuch in %n Sekunden. - + There was an error connecting to the master server. 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. Please check your Internet connection and firewall, and please try again. @@ -27,68 +27,68 @@ Wir verwenden mehrere Master Server um Ausfälle zu verhindern, jedoch hat der C Bitte prüfe deine Internetverbindung und Firewall, und versuche es erneut. - + Outdated version! Your version: %1 Please go to aceattorneyonline.com to update. Version zu alt! Deine Version: %1 Bitte besuche aceattorneyonline.com für ein Update. - + You have been exiled from AO. Have a nice day. Du wurdest von AO befreit. Schönen Urlaub. - + Attorney Online 2 Attorney Online 2 - + Loading Laden - + Loading evidence: %1/%2 Lade Beweisstücke: %1/%2 - - + + Loading music: %1/%2 Lade Musik: %1/%2 - - + + Loading chars: %1/%2 Lade Charaktere: %1/%2 - + You have been kicked from the server. Reason: %1 Du wurdest von diesem Server geschmissen. Grund: %1 - + You have been banned from the server. Reason: %1 Du wurdest von diesem Server verbannt. Grund: %1 - + You are banned on this server. Reason: %1 Du bist von diesem Server verbannt. @@ -118,42 +118,42 @@ Grund: AOCaseAnnouncerDialog - + Case Announcer Fallansager - + Case title: Fallname: - + Defense needed Verteidiger benötigt - + Prosecution needed Kläger benötigt - + Judge needed Richter benötigt - + Jurors needed Jury benötigt - + Stenographer needed Stenograph benötigt - + Witness needed Zeuge benötigt @@ -161,307 +161,374 @@ Grund: AOOptionsDialog - + Settings Einstellungen - + Gameplay Spiel - + Theme: Theme: - + Sets the theme used in-game. If the new theme changes the lobby's look as well, you'll need to reload the lobby for the changes to take effect, such as by joining a server and leaving it. Setzt das Theme. Wenn das neue Theme auch das Aussehen der Lobby verändert, must du diese neu laden um die Änderungen zu sehen. - + + Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. + + + + + Sets the default volume for music. + + + + + Sets the default volume for SFX sounds, like interjections or other character sound effects. + + + + + IC Log + + + + + Colorful IC log: + + + + + Enables colored text in the log. + + + + + Only inline coloring: + + + + + Only inline coloring will be shown such as <>,|| etc. + + + + + Mirror IC log: + + + + + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. + + + + Log goes downwards: Verlauf geht nach unten: - + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. Wenn angehakt werden neue Nachrichten unten erscheinen (wie beim OOC). Das traditionelle (AO1) Verhalten wäre nicht angehakt. - + Log length: Länge: - + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. Die Menge an Nachrichten die aufgehoben werden bevor alte gelöscht werden. 0 bedeutet unendlich. - + Default username: Standard Benutzername: - + Your OOC name will be automatically set to this value when you join a server. Dein OOC Name wird automatisch auf dies gesetzt. - + Custom shownames: Eigener Anzeigename: - Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. - Standardwert für die Anzeigename Box, welche den In-Charakter Namen bestimmt. + Standardwert für die Anzeigename Box, welche den In-Charakter Namen bestimmt. - + Backup MS: Rückfall MS: - + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. Wenn dereingebaute Master Server fehlschlägt, wird das Spiel diesen hier verwenden. - + Discord: Discord: - + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. Erlaubt anderen auf Discord zu sehen auf welchem Server du spielst, welchen Charakter du spielst und wie lange. - + Allow Shake/Flash: Schütteln/Geistesblitz erlauben: - + Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. Erlaubt schütteln des Bildschirms und weiße Blitze. Deaktiviere dies falls du Bedenken wegen Photosensitivität hast. - + Language: Sprache: - + Sets the language if you don't want to use your system language. Setzte die Sprache falls du nicht die Systemsprache verwenden möchtest. - + + Slower text speed: + + + + + Set the text speed to be the same as the AA games. + + + + + Blip delay on punctuations: + + + + + Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + + + + Callwords Alarmwörter - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> <html><head/><body>Gib so viele Alarmwörter ein wie du möchtest. Groß/Kleinschreibung ist egal. Für jede Wort nur eine Zeile!<br>Bitte keine leere Zeile am Ende -- du bekommst sonst bei jeder Nachricht einen Alarm.</body></html> - + Audio Audio - + Audio device: Audiogerät: - + Sets the audio device for all sounds. Setzt das Audiogerät für all Geräusche. - + Music: Musik: - Sets the music's default volume. - Setzt die Musiklautstärke. + Setzt die Musiklautstärke. - + SFX: SFX: - Sets the SFX's default volume. Interjections and actual sound effects count as 'SFX'. - Setzt die Lautstärke der Soundeffekte wie Einsprüche und die Geräusche der Charaktere. + Setzt die Lautstärke der Soundeffekte wie Einsprüche und die Geräusche der Charaktere. - + Blips: Blips: - + Sets the volume of the blips, the talking sound effects. Setzt die Lautstärke der Blips, das ist das Geräusch das die Charaktere beim Reden machen. - + Blip rate: Bliprate: - + Sets the delay between playing the blip sounds. Setzt die Pause zwischen einzelnen Blips. - + Blank blips: Leere Blips: - + If true, the game will play a blip sound even when a space is 'being said'. Wenn angehakt wird das Spiel auch bei einem Leerzeichen einen Blip machen. - + Enable Looping SFX: Wiederholende Soundeffekte: - + If true, the game will allow looping sound effects to play on preanimations. Wenn aktiviert, werden wiederholende Soundeffekte bei den Voranimationen erlaubt. - + Kill Music On Objection: Stoppe Musik bei Einspruch: - + If true, the game will stop music when someone objects, like in the actual games. Hält die Musik an wenn jemand "Einspruch" ruft, wie im echten Spiel. - + Casing Fälle - + This server supports case alerts. Dieser Server unterstützt Fallalarme. - + This server does not support case alerts. Dieser Server unterstützt Fallalarme nicht. - + Pretty self-explanatory. Eigentlich selbsterklärend. - + Casing: Fälle: - + If checked, you will get alerts about case announcements. Wenn angehakt wirst du benachrichtigt wenn ein Fall angekündigt wird. - + Defense: Verteidigung: - + If checked, you will get alerts about case announcements if a defense spot is open. Wenn angehakt wirst du benachrichtigt wenn ein Verteidiger benötigt wird. - + Prosecution: Kläger: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. Wenn angehakt wirst du benachrichtigt wenn ein Kläger benötigt wird. - + Judge: Richter: - + If checked, you will get alerts about case announcements if the judge spot is open. Wenn angehakt wirst du benachrichtigt wenn ein Richter benötigt wird. - + Juror: Jury: - + If checked, you will get alerts about case announcements if a juror spot is open. Wenn angehakt wirst du benachrichtigt wenn eine Jury benötigt wird. - + Stenographer: Stenograph: - + If checked, you will get alerts about case announcements if a stenographer spot is open. Wenn angehakt wirst du benachrichtigt wenn ein Stenograph benötigt wird. - + CM: CM: - + If checked, you will appear amongst the potential CMs on the server. Wenn angehakt wirst du als potentielle CM angezeigt. - + Witness: Zeuge: - + If checked, you will appear amongst the potential witnesses on the server. Wenn angehakt wirst du als potentielle Zeuge angezeigt. - + Hosting cases: Fallleitung: - + If you're a CM, enter what cases you are willing to host. Wenn du CM bist, gib ein welche Fälle du spielen möchtest. @@ -469,28 +536,28 @@ Grund: Courtroom - + Password Passwort - + Spectator Zuschauer - - + + Search Suche - + Passworded Gesperrt - + Taken Benutzt @@ -512,27 +579,32 @@ Grund: Konnte %1 nicht finden - + Showname Anzeigename - + Message Nachricht - + + OOC Message + + + + Name Name - + Pre Vor - + Flip Spiegeln @@ -541,254 +613,264 @@ Grund: Wache - + Disable Modcalls Deaktiviere Moderatorenrufe - - + + Casing Fall - + Shownames Anzeigenamen - + No Interrupt Keine Unterbrechung - + White Weiß - + Green Grün - + Red Rot - + Orange Orange - + Blue Blau - + Yellow Gelb - + Music Musik - + Sfx Sfx - + Blips Blips - + Log limit Verlaufsgrenze - - + + Server Server - + Change character Charakter ändern - + Reload theme Aussehen neu laden - + Call mod Moderator rufen - + Settings Einstellungen - + A/M A/M - + Preanim Voranimation - + Back to Lobby Zurück zur Lobby - + + + You were granted the Disable Modcalls button. + + + + You have been banned. Du wurdest verbannt. + + + Too many arguments to save a case! You only need a filename without extension and the courtroom status. + + %1 has played a song: %2 %1 hat ein Lied gespielt: %2 - + Rainbow Regenbogen - + Pink Pink - + Cyan Cyan - + % offset % Abstand - You were granted the Guard button. - Dir wurde der Wache Knopf gegeben. + Dir wurde der Wache Knopf gegeben. This does nohing, but there you go. Dies bewirkt nichts, aber egal. - + This does nothing, but there you go. Dies bewirkt nichts, aber egal. - + You opened the settings menu. Du hast die Einstellungen geöffnet. - + You will now pair up with Du wirst nun mit - + if they also choose your character in return. gepaart, wenn der andere dies auch tut. - + You are no longer paired with anyone. Du bist nicht mehr gepaart. - + Are you sure you typed that well? The char ID could not be recognised. Hast du dich vertippt? Die ID konnte nicht erkannt werden. - + You have set your offset to Dein Abstand ist auf - + Your offset must be between -100% and 100%! Der Abstand muss zwischen -100% und 100% liegen! - + That offset does not look like one. Das sieht nicht wie ein Abstand aus. - + You switched your music and area list. Du hast zwischen Musik- und Gebitsliste umgeschaltet. - + You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this. Du hast Funktionen erzwungen die der Server eventuell nicht unterstützt. Möglicherweise wirst du nicht mehr sprechen können. - + Your pre-animations interrupt again. Deine Voranimation unterbrechen nun Text. - + Your pre-animations will not interrupt text. Deine Voranimation unterbrechen Text nicht. - + Couldn't open chatlog.txt to write into. Konnte chatlog.txt nicht öffnen. - + The IC chatlog has been saved. Der IC Verlauf wurde gespeichert. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there. Du hattest keinen 'base/cases' Ordner! Ich hab ihn nun angelegt aber bedenke das er leer sein wird. - + You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini. Cases you can load: %1 Du musst einen Dateinamen angeben (ohne .ini). Stelle sicher das er im 'base/cases' Ordner ist und das er korrekt formatiert ist. Verfügbare Fälle: %1 - + Case made by %1. Fall von %1. - + Navigate to %1 for the CM doc. Gehe zu %1 für das CM Dokument. - + Your case "%1" was loaded! Dein Fall "%1" wurde geladen! @@ -799,7 +881,7 @@ Cases you can load: Verfügbare Fälle: - + Too many arguments to load a case! You only need one filename, without extension. Zu viele Argumente! Du brauchst nur den Dateinamen, ohne Erweiterung. @@ -824,53 +906,52 @@ Verfügbare Fälle: " wurde geladen! - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it. Du hattest keinen 'base/cases' Ordner! Ich hab ihn nun angelegt aber bedenke das er leer sein wird. - + You need to give a filename to save (extension not needed) and the courtroom status! Du musst einen Dateinamen (ohne Erweiterung) angebenn, sowie den Gebietsstatus! - Too many arguments to save a case! You only need a filename without extension and the courtroom status! - Zu viele Argumente! Du brauchst nur den Dateinamen, ohne Erweiterung sowie den Gebietsstatus! + Zu viele Argumente! Du brauchst nur den Dateinamen, ohne Erweiterung sowie den Gebietsstatus! - + Succesfully saved, edit doc and cmdoc link on the ini! Erfolgreich gespeichert! - + Master Master - + Reason: Grund: - + Call Moderator Moderator rufen - - + + Error Fehler - + You must provide a reason. Du musst einen Grund angeben. - + The message is too long. Die Nachricht ist zu lang. @@ -884,12 +965,12 @@ Verfügbare Fälle: Wähle... - + Images (*.png) Bilder (*.png) - + Add new evidence... Neues Beweisstück... @@ -934,34 +1015,38 @@ Verfügbare Fälle: Name - + It doesn't look like your client is set up correctly. Did you download all resources correctly from tiny.cc/getao, including the large 'base' folder? Dein Client ist nicht korrekt eingerichtet. Hast du ALLES von tiny.cc/getao heruntergeladen und entpackt, auch den großen 'base' Ordner? - + Version: %1 Version: %1 - + Loading Laden - + Cancel Abbrechen - - <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy - <h2>Attorney Online %1</h2>Der Gerichtsdrama Simulator<p><b>Quelltext:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Leitende Entwicklung:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Danksagungen:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake + - + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + <h2>Attorney Online %1</h2>Der Gerichtsdrama Simulator<p><b>Quelltext:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Leitende Entwicklung:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Danksagungen:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + + Online: %1/%2 Online: %1/%2 @@ -1006,8 +1091,8 @@ Noevain Cronnicossy - - + + Offline Offline @@ -1020,12 +1105,12 @@ Cronnicossy Fehler: %1 - + Error Fehler - + Notice Hinweis diff --git a/resource/translations/ao_en.ts b/resource/translations/ao_en.ts index 7ea610b..9719319 100644 --- a/resource/translations/ao_en.ts +++ b/resource/translations/ao_en.ts @@ -4,78 +4,78 @@ AOApplication - + Disconnected from server. - + Error connecting to master server. Will try again in %1 seconds. - + There was an error connecting to the master server. 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. Please check your Internet connection and firewall, and please try again. - + Outdated version! Your version: %1 Please go to aceattorneyonline.com to update. - + You have been exiled from AO. Have a nice day. - + Attorney Online 2 - + Loading - + Loading evidence: %1/%2 - - + + Loading music: %1/%2 - - + + Loading chars: %1/%2 - + You have been kicked from the server. Reason: %1 - + You have been banned from the server. Reason: %1 - + You are banned on this server. Reason: %1 @@ -84,42 +84,42 @@ Reason: %1 AOCaseAnnouncerDialog - + Case Announcer - + Case title: - + Defense needed - + Prosecution needed - + Judge needed - + Jurors needed - + Stenographer needed - + Witness needed @@ -127,307 +127,362 @@ Reason: %1 AOOptionsDialog - + Settings - + Gameplay - + Theme: - + Sets the theme used in-game. If the new theme changes the lobby's look as well, you'll need to reload the lobby for the changes to take effect, such as by joining a server and leaving it. - + + Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. + + + + + Sets the default volume for music. + + + + + Sets the default volume for SFX sounds, like interjections or other character sound effects. + + + + + IC Log + + + + + Colorful IC log: + + + + + Enables colored text in the log. + + + + + Only inline coloring: + + + + + Only inline coloring will be shown such as <>,|| etc. + + + + + Mirror IC log: + + + + + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. + + + + Log goes downwards: - + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. - + Log length: - + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. - + Default username: - + Your OOC name will be automatically set to this value when you join a server. - + Custom shownames: - - Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. - - - - + Backup MS: - + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. - + Discord: - + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. - + Allow Shake/Flash: - + Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Language: - + Sets the language if you don't want to use your system language. - + + Slower text speed: + + + + + Set the text speed to be the same as the AA games. + + + + + Blip delay on punctuations: + + + + + Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + + + + Callwords - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> - + Audio - + Audio device: - + Sets the audio device for all sounds. - + Music: - - Sets the music's default volume. - - - - + SFX: - - Sets the SFX's default volume. Interjections and actual sound effects count as 'SFX'. - - - - + Blips: - + Sets the volume of the blips, the talking sound effects. - + Blip rate: - + Sets the delay between playing the blip sounds. - + Blank blips: - + If true, the game will play a blip sound even when a space is 'being said'. - + Enable Looping SFX: - + If true, the game will allow looping sound effects to play on preanimations. - + Kill Music On Objection: - + If true, the game will stop music when someone objects, like in the actual games. - + Casing - + This server supports case alerts. - + This server does not support case alerts. - + Pretty self-explanatory. - + Casing: - + If checked, you will get alerts about case announcements. - + Defense: - + If checked, you will get alerts about case announcements if a defense spot is open. - + Prosecution: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. - + Judge: - + If checked, you will get alerts about case announcements if the judge spot is open. - + Juror: - + If checked, you will get alerts about case announcements if a juror spot is open. - + Stenographer: - + If checked, you will get alerts about case announcements if a stenographer spot is open. - + CM: - + If checked, you will appear amongst the potential CMs on the server. - + Witness: - + If checked, you will appear amongst the potential witnesses on the server. - + Hosting cases: - + If you're a CM, enter what cases you are willing to host. @@ -435,28 +490,28 @@ Reason: %1 Courtroom - + Password - + Spectator - - + + Search - + Passworded - + Taken @@ -466,326 +521,332 @@ Reason: %1 - + Showname - + Message - + + OOC Message + + + + Name - + Pre - + Flip - - + + Casing - + Shownames - + No Interrupt - + White - + Green - + Red - + Orange - + Blue - + Yellow - + + + You were granted the Disable Modcalls button. + + + + This does nothing, but there you go. - + You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini. Cases you can load: %1 - + Case made by %1. - + Navigate to %1 for the CM doc. - + Your case "%1" was loaded! - - + + Too many arguments to save a case! You only need a filename without extension and the courtroom status. + + + + + Server - + Back to Lobby - + Rainbow - + Disable Modcalls - + Pink - + Cyan - + % offset - + Music - + Sfx - + Blips - + Log limit - + Change character - + Reload theme - + Call mod - + Settings - + A/M - + Preanim - + You have been banned. - - You were granted the Guard button. - - - - + You opened the settings menu. - + You will now pair up with - + if they also choose your character in return. - + You are no longer paired with anyone. - + Are you sure you typed that well? The char ID could not be recognised. - + You have set your offset to - + Your offset must be between -100% and 100%! - + That offset does not look like one. - + You switched your music and area list. - + You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this. - + Your pre-animations interrupt again. - + Your pre-animations will not interrupt text. - + Couldn't open chatlog.txt to write into. - + The IC chatlog has been saved. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there. - + Too many arguments to load a case! You only need one filename, without extension. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it. - + You need to give a filename to save (extension not needed) and the courtroom status! - - Too many arguments to save a case! You only need a filename without extension and the courtroom status! - - - - + Succesfully saved, edit doc and cmdoc link on the ini! - + Master - + Reason: - + Call Moderator - - + + Error - + You must provide a reason. - + The message is too long. @@ -795,12 +856,12 @@ Cases you can load: %1 - + Images (*.png) - + Add new evidence... @@ -818,39 +879,39 @@ Cases you can load: %1 - + It doesn't look like your client is set up correctly. Did you download all resources correctly from tiny.cc/getao, including the large 'base' folder? - + Version: %1 - + Loading - + Cancel - - <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake - + Online: %1/%2 - - + + Offline @@ -863,12 +924,12 @@ Did you download all resources correctly from tiny.cc/getao, including the large - + Error - + Notice diff --git a/resource/translations/ao_es.ts b/resource/translations/ao_es.ts index ceacf5a..2cad7ce 100644 --- a/resource/translations/ao_es.ts +++ b/resource/translations/ao_es.ts @@ -1,6 +1,6 @@ - + AOApplication diff --git a/resource/translations/ao_jp.ts b/resource/translations/ao_jp.ts index 5e1e8b8..8aa4090 100644 --- a/resource/translations/ao_jp.ts +++ b/resource/translations/ao_jp.ts @@ -4,78 +4,78 @@ AOApplication - + Disconnected from server. - + Error connecting to master server. Will try again in %1 seconds. - + There was an error connecting to the master server. 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. Please check your Internet connection and firewall, and please try again. - + Outdated version! Your version: %1 Please go to aceattorneyonline.com to update. - + You have been exiled from AO. Have a nice day. - + Attorney Online 2 - + Loading ロード中 - + Loading evidence: %1/%2 証拠がロード中: %1/%2 - - + + Loading music: %1/%2 音楽がロード中: %1/%2 - - + + Loading chars: %1/%2 キャラがロード中: %1/%2 - + You have been kicked from the server. Reason: %1 - + You have been banned from the server. Reason: %1 - + You are banned on this server. Reason: %1 @@ -84,42 +84,42 @@ Reason: %1 AOCaseAnnouncerDialog - + Case Announcer - + Case title: - + Defense needed - + Prosecution needed - + Judge needed - + Jurors needed - + Stenographer needed - + Witness needed @@ -127,307 +127,362 @@ Reason: %1 AOOptionsDialog - + Settings - + Gameplay - + Theme: - + Sets the theme used in-game. If the new theme changes the lobby's look as well, you'll need to reload the lobby for the changes to take effect, such as by joining a server and leaving it. - + + Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. + + + + + Sets the default volume for music. + + + + + Sets the default volume for SFX sounds, like interjections or other character sound effects. + + + + + IC Log + + + + + Colorful IC log: + + + + + Enables colored text in the log. + + + + + Only inline coloring: + + + + + Only inline coloring will be shown such as <>,|| etc. + + + + + Mirror IC log: + + + + + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. + + + + Log goes downwards: - + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. - + Log length: - + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. - + Default username: - + Your OOC name will be automatically set to this value when you join a server. - + Custom shownames: - - Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. - - - - + Backup MS: - + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. - + Discord: - + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. - + Allow Shake/Flash: - + Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Language: - + Sets the language if you don't want to use your system language. - + + Slower text speed: + + + + + Set the text speed to be the same as the AA games. + + + + + Blip delay on punctuations: + + + + + Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + + + + Callwords - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> - + Audio - + Audio device: - + Sets the audio device for all sounds. - + Music: 音楽: - - Sets the music's default volume. - - - - + SFX: 効果音: - - Sets the SFX's default volume. Interjections and actual sound effects count as 'SFX'. - - - - + Blips: ブリップ: - + Sets the volume of the blips, the talking sound effects. - + Blip rate: - + Sets the delay between playing the blip sounds. - + Blank blips: - + If true, the game will play a blip sound even when a space is 'being said'. - + Enable Looping SFX: - + If true, the game will allow looping sound effects to play on preanimations. - + Kill Music On Objection: - + If true, the game will stop music when someone objects, like in the actual games. - + Casing - + This server supports case alerts. - + This server does not support case alerts. - + Pretty self-explanatory. - + Casing: - + If checked, you will get alerts about case announcements. - + Defense: - + If checked, you will get alerts about case announcements if a defense spot is open. - + Prosecution: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. - + Judge: - + If checked, you will get alerts about case announcements if the judge spot is open. - + Juror: - + If checked, you will get alerts about case announcements if a juror spot is open. - + Stenographer: - + If checked, you will get alerts about case announcements if a stenographer spot is open. - + CM: - + If checked, you will appear amongst the potential CMs on the server. - + Witness: - + If checked, you will appear amongst the potential witnesses on the server. - + Hosting cases: - + If you're a CM, enter what cases you are willing to host. @@ -435,28 +490,28 @@ Reason: %1 Courtroom - + Password - + Spectator 観客 - - + + Search - + Passworded - + Taken @@ -466,27 +521,27 @@ Reason: %1 - + Showname - + Message - + Name 名前 - + Pre - + Flip フリップ @@ -495,301 +550,307 @@ Reason: %1 ガード - - + + Casing - + Shownames - + No Interrupt - + White - + Green - + Red - + Orange オレンジ - + Blue - + Yellow 黄色 - + This does nothing, but there you go. - + You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini. Cases you can load: %1 - + Case made by %1. - + Navigate to %1 for the CM doc. - + Your case "%1" was loaded! - - + + Server - + Back to Lobby ロビーに戻る - + Rainbow - + + OOC Message + + + + Disable Modcalls - + Pink - + Cyan - + % offset - + Music 音楽 - + Sfx 効果音 - + Blips ブリップ - + Log limit - + Change character - + Reload theme - + Call mod - + Settings - + A/M - + Preanim - + + + You were granted the Disable Modcalls button. + + + + You have been banned. - - You were granted the Guard button. + + Too many arguments to save a case! You only need a filename without extension and the courtroom status. - + You opened the settings menu. - + You will now pair up with - + if they also choose your character in return. - + You are no longer paired with anyone. - + Are you sure you typed that well? The char ID could not be recognised. - + You have set your offset to - + Your offset must be between -100% and 100%! - + That offset does not look like one. - + You switched your music and area list. - + You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this. - + Your pre-animations interrupt again. - + Your pre-animations will not interrupt text. - + Couldn't open chatlog.txt to write into. - + The IC chatlog has been saved. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there. - + Too many arguments to load a case! You only need one filename, without extension. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it. - + You need to give a filename to save (extension not needed) and the courtroom status! - - Too many arguments to save a case! You only need a filename without extension and the courtroom status! - - - - + Succesfully saved, edit doc and cmdoc link on the ini! - + Master マスター - + Reason: - + Call Moderator モデレーターを呼ぶ - - + + Error エラー - + You must provide a reason. - + The message is too long. @@ -799,12 +860,12 @@ Cases you can load: %1 選択... - + Images (*.png) イメージ (*.png) - + Add new evidence... 新しい証拠を付け加える... @@ -845,39 +906,39 @@ Cases you can load: %1 名前 - + It doesn't look like your client is set up correctly. Did you download all resources correctly from tiny.cc/getao, including the large 'base' folder? - + Version: %1 - + Loading ロード中 - + Cancel キャンセル - - <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake - + Online: %1/%2 - - + + Offline オフライン @@ -890,12 +951,12 @@ Did you download all resources correctly from tiny.cc/getao, including the large エラー: %1 - + Error エラー - + Notice diff --git a/resource/translations/ao_pl.ts b/resource/translations/ao_pl.ts index 81879b1..2662fcf 100644 --- a/resource/translations/ao_pl.ts +++ b/resource/translations/ao_pl.ts @@ -4,17 +4,17 @@ AOApplication - + Disconnected from server. Odłączono od serwera. - + Error connecting to master server. Will try again in %1 seconds. Błąd podczas łączenia się z głównym serwerem. Spróbuj ponownie za %1 sekundy. - + There was an error connecting to the master server. 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. Please check your Internet connection and firewall, and please try again. @@ -23,69 +23,69 @@ Używamy wielu głównych serwerów, aby zminimalizować każdą możliwą przer Sprawdź swoje połączenie internetowe oraz zaporę ogniową i spróbuj ponownie. - + Outdated version! Your version: %1 Please go to aceattorneyonline.com to update. Nieaktualna wersja! Twoja wersja: %1 Udaj się do aceattorneyonline.com, aby zaktualizować. - + You have been exiled from AO. Have a nice day. Zostałeś wygnany z AO. Życzymy miłego dnia. - + Attorney Online 2 Prawnik w Internecie 2 - + Loading Ładowanie - + Loading evidence: %1/%2 Ładowanie dowodów: %1/%2 - - + + Loading music: %1/%2 Ładowanie muzyki: %1/%2 - - + + Loading chars: %1/%2 Ładowanie postaci: %1/%2 - + You have been kicked from the server. Reason: %1 Zostałeś wyrzucony z tego serwera. Powód: %1 - + You have been banned from the server. Reason: %1 Zostałeś zbanowany z tego serwera. Powód: %1 - + You are banned on this server. Reason: %1 Jesteś zbanowany na tym serwerze. @@ -95,42 +95,42 @@ Powód: %1 AOCaseAnnouncerDialog - + Case Announcer Ogłaszacz rozpraw - + Case title: Tytuł rozprawy: - + Defense needed Potrzebny obrońca - + Prosecution needed Potrzebny prokurator - + Judge needed Potrzebny sędzia - + Jurors needed Potrzebny ławnik - + Stenographer needed Potrzebny stenograf - + Witness needed Potrzebny świadek @@ -138,308 +138,375 @@ Powód: %1 AOOptionsDialog - + Settings Ustawienia - + Gameplay Rozgrywka - + Theme: Motyw: - + Sets the theme used in-game. If the new theme changes the lobby's look as well, you'll need to reload the lobby for the changes to take effect, such as by joining a server and leaving it. Ustawia motyw używany w grze. Jeżeli nowy motyw równiesz zmienia wygląd poczekalni, musisz odświeżyć poczekalnię, aby zmiany zaczęły działać, np. poprzez dołączenie do serwera i wyjście z niego. - + + Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. + + + + + Sets the default volume for music. + + + + + Sets the default volume for SFX sounds, like interjections or other character sound effects. + + + + + IC Log + + + + + Colorful IC log: + + + + + Enables colored text in the log. + + + + + Only inline coloring: + + + + + Only inline coloring will be shown such as <>,|| etc. + + + + + Mirror IC log: + + + + + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. + + + + Log goes downwards: Dziennik idzie w dół: - + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. Jeżeli zaznaczone, nowe wiadomości zaczną się pojawiać na dole (tak jak na czacie OOC). Tradycyjne (AO1) zachowanie jest równoważne do tego bycia nie zaznaczonym. - + Log length: Długość dziennika: - + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. Ilość wiadomości, jakie czat IC będzie zostawiał zanim usunie starsze wiadomości. Wartośc 0 albo niżej, liczy się jako 'nieskończone'. - + Default username: Domyślna nazwa użytkownika: - + Your OOC name will be automatically set to this value when you join a server. Twoja nazwa OOC będzie ustawiana automatycznie do tej wartości, kiedy dołączysz na serwer. - + Custom shownames: Niestandardowe ksywki: - Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. - Daje domyślną wartość przyciskowi 'Niestandardowe ksywki', który określa, czy klient powinien pokazywać niestandardowe nazwy IC. + Daje domyślną wartość przyciskowi 'Niestandardowe ksywki', który określa, czy klient powinien pokazywać niestandardowe nazwy IC. - + Backup MS: Kopia zapasowa głównego serwera: - + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. Jeśli wbudowane szukanie serwerów zawiedzie, gra spróbuje użyć adresu podanego tutaj i użyje go jako adresu zapasowego głównego serwera. - + Discord: - + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. Pozwala innym na Discordzie zobaczyć na jakim serwerze się znajdujesz, jaką postać używasz i jak długo grałeś. - + Allow Shake/Flash: Zezwalaj Wstrząśnięcia/Błyśnięcia: - + Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. Pozwala na wstrząśnięcia ekranu i błyśnięcia. Wyłącz to, jeśli przejmujesz się lub masz problemy z światłoczułością oraz/lub napady padaczkowe. - + Language: Język: - + Sets the language if you don't want to use your system language. Ustawia język, jeśli nie chcesz używać języka systemowego. - + + Slower text speed: + + + + + Set the text speed to be the same as the AA games. + + + + + Blip delay on punctuations: + + + + + Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + + + + Callwords Zawołania - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> <html><head/><body>Wpisz tyle zawołań, ile dusza zapragnie. Wielkość liter nie ma znaczenia. Miej na uwadze, aby każde zawołanie było w swojej lini!<br>Nie zostawiaj spacji na końcu -- zostaniesz zaalarmowany za każdym razem, kiedy ktoś użyje spacji w swojej wiadomości.</body></html> - + Audio Dźwięk - + Audio device: Urządzenie dźwiękowe: - + Sets the audio device for all sounds. Ustawia urządzenie dźwiękowe dla wszystkich dźwięków. - + Music: Muzyka: - Sets the music's default volume. - Ustawia domyślną głośność muzyki. + Ustawia domyślną głośność muzyki. - + SFX: Efekty dźwiękowe (SFX): - Sets the SFX's default volume. Interjections and actual sound effects count as 'SFX'. - Ustawia domyślną głośność efektów dźwiękowych (SFX). Sprzeciwy i same efekty specjalne są zaliczane jako 'SFX'. + Ustawia domyślną głośność efektów dźwiękowych (SFX). Sprzeciwy i same efekty specjalne są zaliczane jako 'SFX'. - + Blips: Blipy: - + Sets the volume of the blips, the talking sound effects. Ustawia głośność blipów, efektów dźwiękowych mówienia. - + Blip rate: Szybkość blipów: - + Sets the delay between playing the blip sounds. Ustawia opóźnienie pomiędzy graniem blipów. - + Blank blips: The 'blip' isn't an accurate polish representation of this english word. Puste blipy: - + If true, the game will play a blip sound even when a space is 'being said'. Jeżeli zaznaczone, gra zagra dźwięk blip za każdym razem spacja 'jest mówiona'. - + Enable Looping SFX: Włącz pętlące się efekty dźwiękowe (SFX): - + If true, the game will allow looping sound effects to play on preanimations. Jeśli zaznaczone, gra zezwoli na pętlące się efekty dźwiękowe (SFX). - + Kill Music On Objection: Przerwij muzykę w czasie sprzeciwu: - + If true, the game will stop music when someone objects, like in the actual games. Jeśli zaznaczone, gra przerwie muzykę, kiedy ktoś sprzeciwi się, tak jak w oryginalnych grach. - + Casing Rozprawy - + This server supports case alerts. Ten serwer wspiera komunikaty rozpraw. - + This server does not support case alerts. Ten serwer nie wspiera komunikatów rozpraw. - + Pretty self-explanatory. Dosyć oczywiste. - + Casing: Rozprawy: - + If checked, you will get alerts about case announcements. Jeżeli zaznaczone, dostaniesz komunikaty o ogłoszeniach rozpraw. - + Defense: Obrona: - + If checked, you will get alerts about case announcements if a defense spot is open. Jeśli zaznaczone, dostaniesz komunikaty o ogłoszeniach rozpraw, jeśli miejsce obrony jest otwarte. - + Prosecution: Prokuratura: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. Jeśli zaznaczone, dostaniesz komunikaty o ogłoszeniach rozpraw, jeśli miejsce prokuratora jest otwarte. - + Judge: Sędzia: - + If checked, you will get alerts about case announcements if the judge spot is open. Jeśli zaznaczone, dostaniesz komunikaty o ogłoszeniach rozpraw, jeśli miejsce sędzi jest otwarte. - + Juror: Ławnik: - + If checked, you will get alerts about case announcements if a juror spot is open. Jeżeli zaznaczone, dostaniesz komunikaty o ogłoszeniach rozpraw, jeśli miejsce ławnika jest otwarte. - + Stenographer: Stenograf: - + If checked, you will get alerts about case announcements if a stenographer spot is open. Jeżeli zaznaczone, dostaniesz komunikaty o ogłoszeniach rozpraw, jeśli miejsce stenografa jest otwarte. - + CM: Zarządca rozpraw (CM): - + If checked, you will appear amongst the potential CMs on the server. Jeśli zaznaczone, pojawisz się wśród potencjalnych zarządców rozpraw (CM) na serwerze. - + Witness: Świadek: - + If checked, you will appear amongst the potential witnesses on the server. Jeżeli zaznaczone, pojawisz się wśród potencjalnych świadków na serwerze. - + Hosting cases: Hostowane rozprawy: - + If you're a CM, enter what cases you are willing to host. Jeżeli jesteś zarządcą rozpraw (CM), wpisz jakie rozprawy jesteś chętny hostowania. @@ -447,28 +514,28 @@ Powód: %1 Courtroom - + Password Hasło - + Spectator Widz - - + + Search Wyszukaj - + Passworded Zahasłowany - + Taken Zajęty @@ -484,27 +551,27 @@ Powód: %1 %1.%2 - + Showname Ksywka - + Message Wiadomość - + Name Nazwa - + Pre przed- - + Flip Odwróć @@ -513,304 +580,318 @@ Powód: %1 Na Służbie (mod) - - + + Casing Rozprawa - + Shownames Ksywki - + No Interrupt Bez ociągania się - + White Biały - + Green Zielony - + Red Czerwony - + Orange Pomarańczowy - + Blue Niebieski - + Yellow Żółty - + This does nothing, but there you go. To nic nie robi, ale proszę bardzo. - + You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini. Cases you can load: %1 Musisz podać nazwę pliku, którego chcesz załadować (rozszerzenie nie potrzebne!) Upewnij się, że jest w folderze `base/cases/` i że jest to poprawnie sformatowane ini. Rozprawy które możesz załadować: %1 - + Case made by %1. Rozprawa zrobiona przez %1. - + Navigate to %1 for the CM doc. Przejdź do %1, aby dojść do dokumentu CM. - + Your case "%1" was loaded! Twoja rozprawa "%1" została wczytana! - - + + Server Serwer - + Back to Lobby Powrót do poczekalni - + Rainbow Tęczowy - + + OOC Message + + + + Disable Modcalls Wyłącz wezwania moda - + Pink Różowy - + Cyan Turkusowy - + % offset % wyrówanie - + Music Muzyka - + Sfx Sfx - + Blips Blipy - + Log limit Limit dziennika - + Change character Zmiana postaci - + Reload theme Odśwież motyw - + Call mod Wezwij moda - + Settings Ustawienia - + A/M O meaning 'Obszar' and M meaning 'Muzyka'. O/M - + Preanim Sounds weird but I don't know how to translate it other than this. przed-animacja - + + + You were granted the Disable Modcalls button. + + + + You have been banned. Zostałeś zbanowany. - - You were granted the Guard button. - Zostałeś obdarzonym przyciskiem Na Służbie. + + Too many arguments to save a case! You only need a filename without extension and the courtroom status. + - + You were granted the Guard button. + Zostałeś obdarzonym przyciskiem Na Służbie. + + + You opened the settings menu. Otworzyłeś opcje. - + You will now pair up with Będzie teraz w parze z - + if they also choose your character in return. jeżeli oni również wybiorą ciebie spowrotem. - + You are no longer paired with anyone. Nie jesteś już w parze z kimkolwiek. - + Are you sure you typed that well? The char ID could not be recognised. Czy jesteś pewien, że dobrze to napisałeś? ID postaci nie zostało rozpoznane. - + You have set your offset to Musisz ustawić swoje wyrównanie do - + Your offset must be between -100% and 100%! Twoje wyrównanie musi być między -100%, a 100%! - + That offset does not look like one. To wyrównanie nie wygląda na takie. - + You switched your music and area list. Przełączyłeś swoją listę obszarów i muzyki. - + You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this. Włączyłeś funkcje, które ten serwer może nie wspierać. Możliwe że, nie możesz rozmawiać na czacie IC lub gorzej z powodu tego. - + Your pre-animations interrupt again. Twoje przed-animacje przerywają tekst spowrotem. - + Your pre-animations will not interrupt text. Twoje przed-animacje nie będą przerywać tekstu. - + Couldn't open chatlog.txt to write into. Nie można było otworzyć chatlog.txt, aby pisać w nim. - + The IC chatlog has been saved. Dziennik czatu IC został zapisany. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there. Nie masz folderu `base/cases/`! Został zrobiony tylko dla ciebie, ale widząc, że ZOSTAŁ zrobiony tylko dla ciebie, prawdopodobnie plik rozpraw, którego szukasz nie został znaleziony tutaj. - + Too many arguments to load a case! You only need one filename, without extension. Zbyt dużo parametrów, aby załadować rozprawę! Potrzebujesz tylko jedną nazwę pliku, bez rozszerzenia nazwy pliku. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it. Nie masz folderu `base/cases/`! Został zrobiony tylko dla ciebie, ale widząc, że ZOSTAŁ zrobiony tylko dla ciebie, prawdopodobnie jakoś usunąłeś go. - + You need to give a filename to save (extension not needed) and the courtroom status! Musisz podać nazwę pliku, aby go zapisać (rozszerzenie nie potrzebne) i status sali sądowej! - Too many arguments to save a case! You only need a filename without extension and the courtroom status! - Zbyt dużo parametrów, aby zapisać rozprawę! Potrzebujesz tylko jedną nazwę pliku, bez rozszerzenia nazwy pliku i statusu sali sądowej! + Zbyt dużo parametrów, aby zapisać rozprawę! Potrzebujesz tylko jedną nazwę pliku, bez rozszerzenia nazwy pliku i statusu sali sądowej! - + Succesfully saved, edit doc and cmdoc link on the ini! Zapisano pomyślnie, edytuj dokument i link cmdoc w .ini! - + Master Główny - + Reason: Powód: - + Call Moderator Wezwij Moderatora - - + + Error Błąd - + You must provide a reason. Musisz podać przyczynę. - + The message is too long. Ta wiadomość jest za długa. @@ -820,12 +901,12 @@ Rozprawy które możesz załadować: %1 Wybierz... - + Images (*.png) Plik obrazu (*.png) - + Add new evidence... Dodaj nowe dowody... @@ -843,40 +924,44 @@ Rozprawy które możesz załadować: %1 Nazwa - + It doesn't look like your client is set up correctly. Did you download all resources correctly from tiny.cc/getao, including the large 'base' folder? Wygłąda na to, że twój klient nie jest ustawiony poprawnie. Czy pobrałeś wszystkie zasoby poprawnie z tiny.cc/getao, włączając duży folder 'base'? - + Version: %1 Wersja: %1 - + Loading Ładowanie - + Cancel Anuluj - - <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy - <h2>Attorney Online: %1</h2>Symulator dramy sądowej<p><b>Kod żródłowy:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Główny rozwój:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Szczególne podziękowania:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake + - + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + <h2>Attorney Online: %1</h2>Symulator dramy sądowej<p><b>Kod żródłowy:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Główny rozwój:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Szczególne podziękowania:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + + Online: %1/%2 - - + + Offline @@ -889,12 +974,12 @@ Czy pobrałeś wszystkie zasoby poprawnie z tiny.cc/getao, włączając duży fo Błąd: %1 - + Error Błąd - + Notice Ogłoszenie diff --git a/resource/translations/ao_pt.ts b/resource/translations/ao_pt.ts index e20ed11..824c81e 100644 --- a/resource/translations/ao_pt.ts +++ b/resource/translations/ao_pt.ts @@ -1,6 +1,6 @@ - + AOApplication diff --git a/resource/translations/ao_ru.ts b/resource/translations/ao_ru.ts index da481ae..93a3295 100644 --- a/resource/translations/ao_ru.ts +++ b/resource/translations/ao_ru.ts @@ -4,17 +4,17 @@ AOApplication - + Disconnected from server. Соединение с сервером прервано. - + Error connecting to master server. Will try again in %1 seconds. Ошибка соединения с главным сервером. Попытка пересоединения будет через %1 с. - + There was an error connecting to the master server. 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. Please check your Internet connection and firewall, and please try again. @@ -22,67 +22,67 @@ Please check your Internet connection and firewall, and please try again. - + Outdated version! Your version: %1 Please go to aceattorneyonline.com to update. Устаревшая версия! У вас установлена %1 Проследуйте на сайт aceattorneyonline.com для обновления. - + You have been exiled from AO. Have a nice day. Из AO вас отправили в жизнь. Хорошего дня. - + Attorney Online 2 Attorney Online 2 - + Loading Загрузка - + Loading evidence: %1/%2 Загрузка вещдоков: %1/%2 - - + + Loading music: %1/%2 Загрузка музыки: %1/%2 - - + + Loading chars: %1/%2 Загрузка персонажей: %1/%2 - + You have been kicked from the server. Reason: %1 Вас выпнули с сервера. Причина: %1 - + You have been banned from the server. Reason: %1 - + You are banned on this server. Reason: %1 Вас отправили в баню. @@ -104,42 +104,42 @@ Reason: AOCaseAnnouncerDialog - + Case Announcer Материалы дела - + Case title: Название: - + Defense needed Сторона защиты - + Prosecution needed Сторона обвинения - + Judge needed Без судьи никак - + Jurors needed Суд присяжных - + Stenographer needed Нужен стенографист? - + Witness needed @@ -147,307 +147,374 @@ Reason: AOOptionsDialog - + Settings Настройки - + Gameplay Игра - + Theme: Тема: - + Sets the theme used in-game. If the new theme changes the lobby's look as well, you'll need to reload the lobby for the changes to take effect, such as by joining a server and leaving it. Устанавливает внешний вид игры. Может понадобиться перезайти на сервер. - + + Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. + + + + + Sets the default volume for music. + + + + + Sets the default volume for SFX sounds, like interjections or other character sound effects. + + + + + IC Log + + + + + Colorful IC log: + + + + + Enables colored text in the log. + + + + + Only inline coloring: + + + + + Only inline coloring will be shown such as <>,|| etc. + + + + + Mirror IC log: + + + + + IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. + + + + Log goes downwards: Портянку вниз: - + If ticked, new messages will appear at the bottom (like the OOC chatlog). The traditional (AO1) behaviour is equivalent to this being unticked. Отметьте галочку, если хотите, чтобы сообщения в игровом чате отображались снизу, а не сверху. - + Log length: Длина игрового чата: - + The amount of messages the IC chatlog will keep before deleting older messages. A value of 0 or below counts as 'infinite'. Количество сообщений, максимально хранимых в игровом чате. Значение, равное 0 или меньше, будет расценено как снятие такого ограничения. - + Default username: Никнейм по умолчанию: - + Your OOC name will be automatically set to this value when you join a server. Псевдоним, используемый при соединении с сервером. В основном, его видно в чате сервера. - + Custom shownames: Произвольные имена: - Gives the default value for the in-game 'Custom shownames' tickbox, which in turn determines whether the client should display custom in-character names. - Отображать произвольные имена персонажей, установленные самими игроками. + Отображать произвольные имена персонажей, установленные самими игроками. - + Backup MS: Запасной ГС: - + If the built-in server lookups fail, the game will try the address given here and use it as a backup master server address. Отображать перечень серверов от главного сервера, указанного здесь, когда не удалось соединиться с первичным ГС. - + Discord: Discord: - + Allows others on Discord to see what server you are in, what character are you playing, and how long you have been playing for. Показать в Discord сервер, на котором вы играете, каким персонажем управляете и время игры. - + Allow Shake/Flash: - + Allows screenshaking and flashing. Disable this if you have concerns or issues with photosensitivity and/or seizures. - + Language: Язык: - + Sets the language if you don't want to use your system language. - + + Slower text speed: + + + + + Set the text speed to be the same as the AA games. + + + + + Blip delay on punctuations: + + + + + Punctuation delay modifier. Enable it for the blips to slow down on punctuations. + + + + Callwords Позывные - + <html><head/><body>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</body></html> <html><head/><body>Введите на отдельных строках свои позывные, при указании которых в сообщениях будет подан звуковой сигнал.</body></html> - + Audio Аудио - + Audio device: Устройство воспроизведения: - + Sets the audio device for all sounds. Куда вещать звук из игры. - + Music: Музыка: - Sets the music's default volume. - Громкость музыки по умолчанию. + Громкость музыки по умолчанию. - + SFX: Звук. эффекты: - Sets the SFX's default volume. Interjections and actual sound effects count as 'SFX'. - Громкость звуковых эффектов по умолчанию. + Громкость звуковых эффектов по умолчанию. - + Blips: Сигналы: - + Sets the volume of the blips, the talking sound effects. Громкость сигналов, заменяющих голос, по умолчанию. - + Blip rate: Пер. сигналов: - + Sets the delay between playing the blip sounds. Период между сигналами, заменяющими голос, по умолчанию. - + Blank blips: Пустые сигналы: - + If true, the game will play a blip sound even when a space is 'being said'. Проигрывать сигналы даже для пробелов. - + Enable Looping SFX: - + If true, the game will allow looping sound effects to play on preanimations. - + Kill Music On Objection: - + If true, the game will stop music when someone objects, like in the actual games. - + Casing Заседание - + This server supports case alerts. Этот сервер поддерживает объявление заседания. - + This server does not support case alerts. Этот сервер не поддерживает объявление заседания. - + Pretty self-explanatory. Весьма доходчиво. - + Casing: Новое дело: - + If checked, you will get alerts about case announcements. При заведении дела вы получите уведомление. - + Defense: Защита: - + If checked, you will get alerts about case announcements if a defense spot is open. При заведении дела, в котором нужна сторона защиты, вы получите уведомление. - + Prosecution: Обвинение: - + If checked, you will get alerts about case announcements if a prosecutor spot is open. При заведении дела, в котором нужна сторона обвинения, вы получите уведомление. - + Judge: Судья: - + If checked, you will get alerts about case announcements if the judge spot is open. При заведении дела, в котором нужен судья, вы получите уведомление. - + Juror: Присяжный: - + If checked, you will get alerts about case announcements if a juror spot is open. При заведении дела, в котором нужны присяжные заседатели, вы получите уведомление. - + Stenographer: Стенографист: - + If checked, you will get alerts about case announcements if a stenographer spot is open. При заведении дела, в котором нужна стенография, вы получите уведомление. - + CM: ПД: - + If checked, you will appear amongst the potential CMs on the server. Отметьте, если вы хотите состоять в числе производителей дел. - + Witness: - + If checked, you will appear amongst the potential witnesses on the server. - + Hosting cases: ПД акт.: - + If you're a CM, enter what cases you are willing to host. Будучи производителем дела (ПД), вы можете войти в зону и заниматься её оркестровкой. @@ -455,28 +522,28 @@ Reason: Courtroom - + Password Пароль - + Spectator Наблюдатель - - + + Search Поиск - + Passworded Ограничен паролем - + Taken Занят @@ -498,27 +565,27 @@ Reason: - + Showname Имя - + Message Сообщение - + Name Никнейм - + Pre Пред. - + Flip Разв. @@ -527,302 +594,316 @@ Reason: Охрана - - + + Casing Дело - + Shownames Произв. имена - + No Interrupt Говорить сразу - + White Белый - + Green Зелëный - + Red Красный - + Orange Оранжевый - + Blue Синий - + Yellow Жëлтый - + This does nothing, but there you go. В общем-то, это ни на что не влияет... - + You need to give a filename to load (extension not needed)! Make sure that it is in the `base/cases/` folder, and that it is a correctly formatted ini. Cases you can load: %1 Укажите имя файла с делом (без расширения) для загрузки. Убедитесь, что оно расположено в папке `base/cases`. Были найдены: %1 - + Case made by %1. Дело завëл игрок: %1. - + Navigate to %1 for the CM doc. Перейдите к %1 для получения материалов дела. - + Your case "%1" was loaded! Дело под кодовым названием "%1" готово! - - + + Server Сервер - + Back to Lobby Назад в лобби - + Rainbow Радужный - + + OOC Message + + + + Disable Modcalls - + Pink Розовый - + Cyan Голубой - + % offset % сдвига - + Music Музыка - + Sfx Звук. эффекты - + Blips Сигналы - + Log limit - + Change character - + Reload theme - + Call mod - + Settings Настройки - + A/M - + Preanim - + + + You were granted the Disable Modcalls button. + + + + You have been banned. - - You were granted the Guard button. - Теперь у вас есть кнопка "Охрана". + + Too many arguments to save a case! You only need a filename without extension and the courtroom status. + - + You were granted the Guard button. + Теперь у вас есть кнопка "Охрана". + + + You opened the settings menu. Вы открыли меню настроек. - + You will now pair up with Вы встанете парой с персонажем по имени - + if they also choose your character in return. (если он выберет вас в ответ). - + You are no longer paired with anyone. Теперь вы не стоите в парах. - + Are you sure you typed that well? The char ID could not be recognised. Кажется, вам нужно поменять запрос: такой идентификатор персонажа не был найден. - + You have set your offset to Вы установили сдвиг персонажа на - + Your offset must be between -100% and 100%! Сдвиг персонажа должен быть между -100% и 100%! - + That offset does not look like one. Неверный сдвиг персонажа. - + You switched your music and area list. Вы переключили перечень зон и музыки. - + You have forcefully enabled features that the server may not support. You may not be able to talk IC, or worse, because of this. Из-за того, что вы включили не поддержимаемые сервером возможности, он может не принять ваши сообщения. - + Your pre-animations interrupt again. Персонаж будет говорить только после анимации. - + Your pre-animations will not interrupt text. Персонаж будет говорить и во время анимации. - + Couldn't open chatlog.txt to write into. Не могу открыть `chatlog.txt` для записи лога. - + The IC chatlog has been saved. Лог игрового чата сохранëн. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely the case file you're looking for can't be found in there. Файл с делом не найден. Если найдëте, положите его в папку `base/cases/`, которую мы для вас создали. - + Too many arguments to load a case! You only need one filename, without extension. Введите имя файла без расширения. - + You don't have a `base/cases/` folder! It was just made for you, but seeing as it WAS just made for you, it's likely that you somehow deleted it. Папка `base/cases/` отсутствует! - + You need to give a filename to save (extension not needed) and the courtroom status! Введите имя файла (без расширения) и предоставьте статус зоны. - Too many arguments to save a case! You only need a filename without extension and the courtroom status! - Убедитесь, что имя файла не содержит расширение. + Убедитесь, что имя файла не содержит расширение. - + Succesfully saved, edit doc and cmdoc link on the ini! Сохранение прошло успешно! - + Master Мастер - + Reason: Причина: - + Call Moderator Позвать модератора - - + + Error Ошибка - + You must provide a reason. Укажите причину. - + The message is too long. Слишком длинный текст. @@ -832,12 +913,12 @@ Cases you can load: %1 Выбрать... - + Images (*.png) Изображения (*.png) - + Add new evidence... Добавить новую улику... @@ -855,40 +936,44 @@ Cases you can load: %1 Никнейм - + It doesn't look like your client is set up correctly. Did you download all resources correctly from tiny.cc/getao, including the large 'base' folder? Не похоже, что ваш клиент установлен правильно. Скачали ли вы все ресурсы (tiny.cc/getao), включая огромную папку `base`? - + Version: %1 Версия: %1 - + Loading Загрузка - + Cancel Отмена - - <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy - <h2>Attorney Online %1</h2>Симулятор судебной драмы<p><b>Исходный код:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Основной разработкой занимались:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Особенная благодарность:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (дизайн интерфейса), Draxirch (дизайн интерфейса), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake + - + <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + <h2>Attorney Online %1</h2>Симулятор судебной драмы<p><b>Исходный код:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Основной разработкой занимались:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Особенная благодарность:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (дизайн интерфейса), Draxirch (дизайн интерфейса), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy + + + Online: %1/%2 Онлайн: %1/%2 - - + + Offline Вне сети @@ -901,12 +986,12 @@ Did you download all resources correctly from tiny.cc/getao, including the large Ошибка: %1 - + Error Ошибка - + Notice На заметку From 0e3fe4c0040cd01e7fd6c27e4a07d6db77b022d3 Mon Sep 17 00:00:00 2001 From: sD Date: Thu, 23 Apr 2020 20:32:49 +0200 Subject: [PATCH 26/30] add german translations for new features --- resource/translations/ao_de.ts | 36 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/resource/translations/ao_de.ts b/resource/translations/ao_de.ts index f63fa91..c4e9f30 100644 --- a/resource/translations/ao_de.ts +++ b/resource/translations/ao_de.ts @@ -183,52 +183,52 @@ Grund: Gives the default value for the in-game 'Custom shownames' checkbox, which in turn determines whether the client should display custom in-character names. - + Setzt den Standardwerd für den eigenen Anzeigenamen. Sets the default volume for music. - + Standardlautstärke für die Musik. Sets the default volume for SFX sounds, like interjections or other character sound effects. - + Standardlautstärke für Soundeffekte. IC Log - + Log Colorful IC log: - + Farbiges Log: Enables colored text in the log. - + Aktiviert farbigen Text im Log. Only inline coloring: - + Nur in-Zeilen Farben: Only inline coloring will be shown such as <>,|| etc. - + Nur die in-Zeilen Farben wie <>,|| etc. werden gezeigt. Mirror IC log: - + Log spiegeln: IC log will mirror the IC box. Meaning that if somebody gets interrupted nobody will know what they wanted to say. Enable for a more realistic experience. - + Das Log spiegelt die Nachrichten. Bedeutet dass wenn jemand unterbrochen wird, kann man nicht sehen was derjenige sagen wollte. Für ein realistischeres Spielerlebnis. @@ -312,22 +312,22 @@ Grund: Slower text speed: - + Langsamerer Text: Set the text speed to be the same as the AA games. - + Setzt den Text auf die gleiche Geschwindigkeit wie in den AA Spielen. Blip delay on punctuations: - + Blip Pausen bei Satzzeichen: Punctuation delay modifier. Enable it for the blips to slow down on punctuations. - + Aktivieren damit die Blips bei Satzzeichen langsamer werden. @@ -591,7 +591,7 @@ Grund: OOC Message - + OOC Nachricht @@ -728,7 +728,7 @@ Grund: You were granted the Disable Modcalls button. - + Du hast nun den "Modcall deaktivieren" Knopf. @@ -738,7 +738,7 @@ Grund: Too many arguments to save a case! You only need a filename without extension and the courtroom status. - + Zu viele Argumente zum Speichern! Bitte gib nur den Dateinamen ohne Erweiterung und den Saalstatus an. %1 has played a song: %2 @@ -1039,7 +1039,7 @@ Hast du ALLES von tiny.cc/getao heruntergeladen und entpackt, auch den großen & <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake - + <h2>Attorney Online %1</h2>Der Gerichtsdrama Simulator<p><b>Quelltext:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Leitende Entwicklung:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter, Cents02<p><b>Danksagungen:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy, Raidensnake <h2>Attorney Online %1</h2>The courtroom drama simulator<p><b>Source code:</b> <a href='https://github.com/AttorneyOnline/AO2-Client'>https://github.com/AttorneyOnline/AO2-Client</a><p><b>Major development:</b><br>OmniTroid, stonedDiscord, longbyte1, gameboyprinter, Cerapter<p><b>Special thanks:</b><br>Remy, Iamgoofball, Hibiki, Qubrick (webAO), Ruekasu (UI design), Draxirch (UI design), Unishred, Argoneus (tsuserver), Fiercy, Noevain, Cronnicossy From c4b0262c728c9019ea2d84d53308176fe3c73810 Mon Sep 17 00:00:00 2001 From: sD Date: Thu, 23 Apr 2020 20:39:27 +0200 Subject: [PATCH 27/30] it's just the katakana for the colors but here you go --- resource/translations/ao_jp.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resource/translations/ao_jp.ts b/resource/translations/ao_jp.ts index 8aa4090..029e84a 100644 --- a/resource/translations/ao_jp.ts +++ b/resource/translations/ao_jp.ts @@ -650,12 +650,12 @@ Cases you can load: %1 Pink - + ピンク Cyan - + シアン @@ -903,7 +903,7 @@ Cases you can load: %1 Name - 名前 + 名前 @@ -958,7 +958,7 @@ Did you download all resources correctly from tiny.cc/getao, including the large Notice - + 通知 From 896c4e4dbc28470454c9fd37c9ec1b0fe26beb99 Mon Sep 17 00:00:00 2001 From: cents Date: Thu, 23 Apr 2020 11:57:27 -0700 Subject: [PATCH 28/30] Fixed wrong name being written in mirror mode --- src/courtroom.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 050d606..a813d0b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -2169,8 +2169,8 @@ void Courtroom::handle_chatmessage_3() ui_ic_chatlog->textCursor().insertHtml("
"); else first_message_sent = true; - - ui_ic_chatlog->textCursor().insertHtml("" + m_chatmessage[CHAR_NAME] + + QString char_name = char_list.at(m_chatmessage[CHAR_ID].toInt()).name; + ui_ic_chatlog->textCursor().insertHtml("" + char_name + ": "); } else { @@ -2512,9 +2512,9 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, * \param p_name The name of the character/entity who sent said text * \param is_songchange Whether we are appending a song entry * \param force_filter If we are sending plain text and we want to force the - * filtering regardless of its status (e.g chat entry, song change etc) \param - * skip_filter If we are sending appending text such as html so we skip the - * filter \param chat_color The color of the message sent + * \param filtering regardless of its status (e.g chat entry, song change etc) + * \param skip_filter If we are sending appending text such as html so we skip the + * \param filter chat_color The color of the message sent */ void Courtroom::append_ic_text(QString p_text, QString p_name, From c7fd5c9bd93366277f158382be6c6e12be2fdb75 Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 24 Apr 2020 12:49:21 +0200 Subject: [PATCH 29/30] use the smaller themes --- base/themes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/themes b/base/themes index a54fa4f..6e1317e 160000 --- a/base/themes +++ b/base/themes @@ -1 +1 @@ -Subproject commit a54fa4f5b73c35297f141b9b4ff4751816e7d3e8 +Subproject commit 6e1317ed93a9a4831047aa151c28742b1dd8afb5 From 992c0b14e155059a7e22ad72c0309b620c850a46 Mon Sep 17 00:00:00 2001 From: sD Date: Fri, 24 Apr 2020 12:54:48 +0200 Subject: [PATCH 30/30] what is this, c++ for ANDs this kept it from buildinf with MSVC --- src/courtroom.cpp | 48 +++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index a813d0b..11c0bda 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -1479,7 +1479,7 @@ void Courtroom::on_chat_return_pressed() f_emote_mod = 2; } } - else if (ui_pre->isChecked() and !ui_pre_non_interrupt->isChecked()) { + else if (ui_pre->isChecked() && !ui_pre_non_interrupt->isChecked()) { if (f_emote_mod == 0) f_emote_mod = 1; else if (f_emote_mod == 5 && ao_app->prezoom_enabled) @@ -2300,7 +2300,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, f_character = ">"; } // Escape character. - if (f_character == "\\" and !ic_next_is_not_special) { + if (f_character == "\\" && !ic_next_is_not_special) { ic_next_is_not_special = true; p_text.remove(trick_check_pos, 1); f_character = ""; @@ -2316,17 +2316,17 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, p_text.remove(trick_check_pos, 1); f_character = ""; } - else if (f_character == "$" and !ic_next_is_not_special) { + else if (f_character == "$" && !ic_next_is_not_special) { p_text.remove(trick_check_pos, 1); f_character = ""; } - else if (f_character == "@" and !ic_next_is_not_special) { + else if (f_character == "@" && !ic_next_is_not_special) { p_text.remove(trick_check_pos, 1); f_character = ""; } // Orange inline colourisation. - else if (f_character == "|" and !ic_next_is_not_special) { + else if (f_character == "|" && !ic_next_is_not_special) { if (!ic_colour_stack.empty()) { if (ic_colour_stack.top() == INLINE_ORANGE) { ic_colour_stack.pop(); @@ -2345,12 +2345,12 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, } // Blue inline colourisation. - else if (f_character == "(" and !ic_next_is_not_special) { + else if (f_character == "(" && !ic_next_is_not_special) { ic_colour_stack.push(INLINE_BLUE); if (!colorf_iclog) trick_check_pos++; } - else if (f_character == ")" and !ic_next_is_not_special and + else if (f_character == ")" && !ic_next_is_not_special && !ic_colour_stack.empty()) { if (ic_colour_stack.top() == INLINE_BLUE) { // ic_colour_stack.pop(); @@ -2364,12 +2364,12 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, } // Grey inline colourisation. - else if (f_character == "[" and !ic_next_is_not_special) { + else if (f_character == "[" && !ic_next_is_not_special) { ic_colour_stack.push(INLINE_GREY); if (!colorf_iclog) trick_check_pos++; } - else if (f_character == "]" and !ic_next_is_not_special and + else if (f_character == "]" && !ic_next_is_not_special && !ic_colour_stack.empty()) { if (ic_colour_stack.top() == INLINE_GREY) { // ic_colour_stack.pop(); @@ -2383,7 +2383,7 @@ QString Courtroom::filter_ic_text(QString p_text, bool skip_filter, } // Green inline colourisation. - else if (f_character == "`" and !ic_next_is_not_special) { + else if (f_character == "`" && !ic_next_is_not_special) { if (!ic_colour_stack.empty()) { if (ic_colour_stack.top() == INLINE_GREEN) { ic_colour_stack.pop(); @@ -2844,12 +2844,12 @@ void Courtroom::chat_tick() if (mirror_iclog) ui_ic_chatlog->insertPlainText(" "); } - else if (f_character == "@" and !next_character_is_not_special) { + else if (f_character == "@" && !next_character_is_not_special) { this->doScreenShake(); formatting_char = true; } - else if (f_character == "^" and !next_character_is_not_special) { + else if (f_character == "^" && !next_character_is_not_special) { this->doRealization(); formatting_char = true; @@ -2871,30 +2871,30 @@ void Courtroom::chat_tick() } // Text speed modifier. - else if (f_character == "{" and !next_character_is_not_special) { + else if (f_character == "{" && !next_character_is_not_special) { // ++, because it INCREASES delay! current_display_speed++; msg_delay++; formatting_char = true; } - else if (f_character == "}" and !next_character_is_not_special) { + else if (f_character == "}" && !next_character_is_not_special) { current_display_speed--; msg_delay++; formatting_char = true; } - else if (f_character == "@" and !next_character_is_not_special) { + else if (f_character == "@" && !next_character_is_not_special) { this->doScreenShake(); formatting_char = true; } - else if (f_character == "$" and !next_character_is_not_special) { + else if (f_character == "$" && !next_character_is_not_special) { this->doRealization(); formatting_char = true; } // Orange inline colourisation. - else if (f_character == "|" and !next_character_is_not_special) { + else if (f_character == "|" && !next_character_is_not_special) { if (!inline_colour_stack.empty()) { if (inline_colour_stack.top() == INLINE_ORANGE) { inline_colour_stack.pop(); @@ -2911,7 +2911,7 @@ void Courtroom::chat_tick() } // Blue inline colourisation. - else if (f_character == "(" and + else if (f_character == "(" && !next_character_is_not_special) // EXAMPLE HERE { inline_colour_stack.push(INLINE_BLUE); @@ -2927,13 +2927,13 @@ void Courtroom::chat_tick() // Here, we check if the entire message is blue. // If it isn't, we stop talking. - if (!entire_message_is_blue and anim_state != 4) { + if (!entire_message_is_blue && anim_state != 4) { f_char = m_chatmessage[CHAR_NAME]; QString f_emote = m_chatmessage[EMOTE]; ui_vp_player_char->play_idle(f_char, f_emote); } } - else if (f_character == ")" and !next_character_is_not_special and + else if (f_character == ")" && !next_character_is_not_special && !inline_colour_stack.empty()) { if (inline_colour_stack.top() == INLINE_BLUE) { inline_colour_stack.pop(); @@ -2954,7 +2954,7 @@ void Courtroom::chat_tick() if (!entire_message_is_blue) { // We should only go back to talking if we're out of inline blues, // not during a non. int. pre, and not on the last character. - if (inline_blue_depth == 0 and anim_state != 4 and + if (inline_blue_depth == 0 && anim_state != 4 && !(tick_pos + 1 >= f_message.size())) { QString f_char = char_name; f_char = m_chatmessage[CHAR_NAME]; @@ -2971,7 +2971,7 @@ void Courtroom::chat_tick() } // Grey inline colourisation. - else if (f_character == "[" and !next_character_is_not_special) { + else if (f_character == "[" && !next_character_is_not_special) { inline_colour_stack.push(INLINE_GREY); ui_vp_message->insertHtml("" + @@ -2981,7 +2981,7 @@ void Courtroom::chat_tick() get_text_color("_inline_grey").name() + "\">" + f_character + ""); } - else if (f_character == "]" and !next_character_is_not_special and + else if (f_character == "]" && !next_character_is_not_special && !inline_colour_stack.empty()) { if (inline_colour_stack.top() == INLINE_GREY) { inline_colour_stack.pop(); @@ -3000,7 +3000,7 @@ void Courtroom::chat_tick() } // Green inline colourisation. - else if (f_character == "`" and !next_character_is_not_special) { + else if (f_character == "`" && !next_character_is_not_special) { if (!inline_colour_stack.empty()) { if (inline_colour_stack.top() == INLINE_GREEN) { inline_colour_stack.pop();